Search in sources :

Example 6 with DataFacetChangeEvent

use of pcgen.cdom.facet.event.DataFacetChangeEvent in project pcgen by PCGen.

the class UnencumberedArmorFacetTest method testIgnoreLoad.

@Test
public void testIgnoreLoad() {
    assertTrue(facet.ignoreLoad(id, Load.LIGHT));
    assertFalse(facet.ignoreLoad(id, Load.MEDIUM));
    Object source1 = new Object();
    DataFacetChangeEvent<CharID, CDOMObject> dfce = new DataFacetChangeEvent<>(id, source[1], source1, DataFacetChangeEvent.DATA_ADDED);
    getListener().dataAdded(dfce);
    assertTrue(facet.ignoreLoad(id, Load.LIGHT));
    assertTrue(facet.ignoreLoad(id, Load.MEDIUM));
    assertFalse(facet.ignoreLoad(id, Load.HEAVY));
    dfce = new DataFacetChangeEvent<>(id, source[0], source1, DataFacetChangeEvent.DATA_ADDED);
    getListener().dataAdded(dfce);
    assertTrue(facet.ignoreLoad(id, Load.LIGHT));
    assertTrue(facet.ignoreLoad(id, Load.MEDIUM));
    assertTrue(facet.ignoreLoad(id, Load.HEAVY));
}
Also used : DataFacetChangeEvent(pcgen.cdom.facet.event.DataFacetChangeEvent) CDOMObject(pcgen.cdom.base.CDOMObject) CDOMObject(pcgen.cdom.base.CDOMObject) CharID(pcgen.cdom.enumeration.CharID) AbstractExtractingFacetTest(pcgen.cdom.testsupport.AbstractExtractingFacetTest) Test(org.junit.Test)

Example 7 with DataFacetChangeEvent

use of pcgen.cdom.facet.event.DataFacetChangeEvent in project pcgen by PCGen.

the class UnencumberedLoadFacetTest method testMultipleLoad.

@Test
public void testMultipleLoad() {
    assertEquals(Load.LIGHT, facet.getBestLoad(id));
    Object source1 = new Object();
    DataFacetChangeEvent<CharID, CDOMObject> dfce = new DataFacetChangeEvent<>(id, source[1], source1, DataFacetChangeEvent.DATA_ADDED);
    getListener().dataAdded(dfce);
    assertEquals(Load.MEDIUM, facet.getBestLoad(id));
    dfce = new DataFacetChangeEvent<>(id, source[0], source1, DataFacetChangeEvent.DATA_ADDED);
    getListener().dataAdded(dfce);
    assertEquals(Load.HEAVY, facet.getBestLoad(id));
}
Also used : DataFacetChangeEvent(pcgen.cdom.facet.event.DataFacetChangeEvent) CDOMObject(pcgen.cdom.base.CDOMObject) CDOMObject(pcgen.cdom.base.CDOMObject) CharID(pcgen.cdom.enumeration.CharID) AbstractExtractingFacetTest(pcgen.cdom.testsupport.AbstractExtractingFacetTest) Test(org.junit.Test)

Example 8 with DataFacetChangeEvent

use of pcgen.cdom.facet.event.DataFacetChangeEvent in project pcgen by PCGen.

the class UnencumberedArmorFacetTest method testMultipleLoad.

@Test
public void testMultipleLoad() {
    assertEquals(Load.LIGHT, facet.getBestLoad(id));
    Object source1 = new Object();
    DataFacetChangeEvent<CharID, CDOMObject> dfce = new DataFacetChangeEvent<>(id, source[1], source1, DataFacetChangeEvent.DATA_ADDED);
    getListener().dataAdded(dfce);
    assertEquals(Load.MEDIUM, facet.getBestLoad(id));
    dfce = new DataFacetChangeEvent<>(id, source[0], source1, DataFacetChangeEvent.DATA_ADDED);
    getListener().dataAdded(dfce);
    assertEquals(Load.HEAVY, facet.getBestLoad(id));
}
Also used : DataFacetChangeEvent(pcgen.cdom.facet.event.DataFacetChangeEvent) CDOMObject(pcgen.cdom.base.CDOMObject) CDOMObject(pcgen.cdom.base.CDOMObject) CharID(pcgen.cdom.enumeration.CharID) AbstractExtractingFacetTest(pcgen.cdom.testsupport.AbstractExtractingFacetTest) Test(org.junit.Test)

Example 9 with DataFacetChangeEvent

use of pcgen.cdom.facet.event.DataFacetChangeEvent in project pcgen by PCGen.

the class UnencumberedLoadFacetTest method testIgnoreLoad.

@Test
public void testIgnoreLoad() {
    assertTrue(facet.ignoreLoad(id, Load.LIGHT));
    assertFalse(facet.ignoreLoad(id, Load.MEDIUM));
    Object source1 = new Object();
    DataFacetChangeEvent<CharID, CDOMObject> dfce = new DataFacetChangeEvent<>(id, source[1], source1, DataFacetChangeEvent.DATA_ADDED);
    getListener().dataAdded(dfce);
    assertTrue(facet.ignoreLoad(id, Load.LIGHT));
    assertTrue(facet.ignoreLoad(id, Load.MEDIUM));
    assertFalse(facet.ignoreLoad(id, Load.HEAVY));
    dfce = new DataFacetChangeEvent<>(id, source[0], source1, DataFacetChangeEvent.DATA_ADDED);
    getListener().dataAdded(dfce);
    assertTrue(facet.ignoreLoad(id, Load.LIGHT));
    assertTrue(facet.ignoreLoad(id, Load.MEDIUM));
    assertTrue(facet.ignoreLoad(id, Load.HEAVY));
}
Also used : DataFacetChangeEvent(pcgen.cdom.facet.event.DataFacetChangeEvent) CDOMObject(pcgen.cdom.base.CDOMObject) CDOMObject(pcgen.cdom.base.CDOMObject) CharID(pcgen.cdom.enumeration.CharID) AbstractExtractingFacetTest(pcgen.cdom.testsupport.AbstractExtractingFacetTest) Test(org.junit.Test)

Example 10 with DataFacetChangeEvent

use of pcgen.cdom.facet.event.DataFacetChangeEvent in project pcgen by PCGen.

the class VariableFacetTest method testAddRemove.

@Test
public void testAddRemove() {
    Object source = new Object();
    CDOMObject t1 = new PCTemplate();
    VariableKey vk1 = VariableKey.getConstant("Var1");
    VariableKey vk2 = VariableKey.getConstant("Var2");
    t1.put(vk1, FormulaFactory.getFormulaFor(2));
    t1.put(vk2, FormulaFactory.getFormulaFor(4));
    DataFacetChangeEvent<CharID, CDOMObject> dfce = new DataFacetChangeEvent<>(id, t1, source, DataFacetChangeEvent.DATA_ADDED);
    getFacet().dataAdded(dfce);
    assertTrue(getFacet().contains(id, vk1));
    assertTrue(getFacet().contains(id, vk2));
    assertFalse(getFacet().contains(altid, vk1));
    assertFalse(getFacet().contains(id, VariableKey.getConstant("Var3")));
    dfce = new DataFacetChangeEvent<>(id, t1, source, DataFacetChangeEvent.DATA_REMOVED);
    getFacet().dataRemoved(dfce);
    assertFalse(getFacet().contains(id, vk1));
    assertFalse(getFacet().contains(id, vk2));
    assertFalse(getFacet().contains(altid, vk1));
    assertFalse(getFacet().contains(id, VariableKey.getConstant("Var3")));
}
Also used : DataFacetChangeEvent(pcgen.cdom.facet.event.DataFacetChangeEvent) CDOMObject(pcgen.cdom.base.CDOMObject) VariableKey(pcgen.cdom.enumeration.VariableKey) CDOMObject(pcgen.cdom.base.CDOMObject) PCTemplate(pcgen.core.PCTemplate) CharID(pcgen.cdom.enumeration.CharID) Test(org.junit.Test)

Aggregations

CDOMObject (pcgen.cdom.base.CDOMObject)17 CharID (pcgen.cdom.enumeration.CharID)17 DataFacetChangeEvent (pcgen.cdom.facet.event.DataFacetChangeEvent)17 Test (org.junit.Test)15 VariableKey (pcgen.cdom.enumeration.VariableKey)8 PCTemplate (pcgen.core.PCTemplate)8 CDOMReference (pcgen.cdom.base.CDOMReference)4 AbstractExtractingFacetTest (pcgen.cdom.testsupport.AbstractExtractingFacetTest)4 PCClassLevel (pcgen.cdom.inst.PCClassLevel)3 Skill (pcgen.core.Skill)3