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));
}
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));
}
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));
}
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));
}
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")));
}
Aggregations