use of pcgen.cdom.facet.event.DataFacetChangeEvent in project pcgen by PCGen.
the class VariableFacetTest method testAddSameTwo.
@Test
public void testAddSameTwo() {
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")));
}
use of pcgen.cdom.facet.event.DataFacetChangeEvent in project pcgen by PCGen.
the class VariableFacetTest method testAddSameTwice.
@Test
public void testAddSameTwice() {
Object source = new Object();
CDOMObject t1 = new PCTemplate();
CDOMObject t2 = new PCTemplate();
VariableKey vk = VariableKey.getConstant("Var1");
t1.put(vk, FormulaFactory.getFormulaFor(2));
t2.put(vk, FormulaFactory.getFormulaFor(4));
DataFacetChangeEvent<CharID, CDOMObject> dfce = new DataFacetChangeEvent<>(id, t1, source, DataFacetChangeEvent.DATA_ADDED);
getFacet().dataAdded(dfce);
assertTrue(getFacet().contains(id, vk));
assertFalse(getFacet().contains(altid, vk));
assertFalse(getFacet().contains(id, VariableKey.getConstant("Var2")));
dfce = new DataFacetChangeEvent<>(id, t2, source, DataFacetChangeEvent.DATA_ADDED);
getFacet().dataAdded(dfce);
assertTrue(getFacet().contains(id, vk));
assertFalse(getFacet().contains(altid, vk));
assertFalse(getFacet().contains(id, VariableKey.getConstant("Var2")));
}
use of pcgen.cdom.facet.event.DataFacetChangeEvent in project pcgen by PCGen.
the class VariableFacetTest method testAddRemove2First.
@Test
public void testAddRemove2First() {
Object source = new Object();
CDOMObject t1 = new PCTemplate();
CDOMObject t2 = new PCTemplate();
VariableKey vk = VariableKey.getConstant("Var1");
t1.put(vk, FormulaFactory.getFormulaFor(2));
t2.put(vk, FormulaFactory.getFormulaFor(4));
DataFacetChangeEvent<CharID, CDOMObject> dfce = new DataFacetChangeEvent<>(id, t1, source, DataFacetChangeEvent.DATA_ADDED);
getFacet().dataAdded(dfce);
assertTrue(getFacet().contains(id, vk));
assertFalse(getFacet().contains(altid, vk));
assertFalse(getFacet().contains(id, VariableKey.getConstant("Var2")));
dfce = new DataFacetChangeEvent<>(id, t2, source, DataFacetChangeEvent.DATA_ADDED);
getFacet().dataAdded(dfce);
assertTrue(getFacet().contains(id, vk));
assertFalse(getFacet().contains(altid, vk));
assertFalse(getFacet().contains(id, VariableKey.getConstant("Var2")));
dfce = new DataFacetChangeEvent<>(id, t2, source, DataFacetChangeEvent.DATA_REMOVED);
getFacet().dataRemoved(dfce);
assertTrue(getFacet().contains(id, vk));
dfce = new DataFacetChangeEvent<>(id, t1, source, DataFacetChangeEvent.DATA_REMOVED);
getFacet().dataRemoved(dfce);
assertFalse(getFacet().contains(id, vk));
}
use of pcgen.cdom.facet.event.DataFacetChangeEvent in project pcgen by PCGen.
the class VariableFacetTest method testAddSimple.
@Test
public void testAddSimple() {
Object source = new Object();
CDOMObject t1 = new PCTemplate();
VariableKey vk = VariableKey.getConstant("Var1");
t1.put(vk, FormulaFactory.getFormulaFor(2));
DataFacetChangeEvent<CharID, CDOMObject> dfce = new DataFacetChangeEvent<>(id, t1, source, DataFacetChangeEvent.DATA_ADDED);
getFacet().dataAdded(dfce);
assertTrue(getFacet().contains(id, vk));
assertFalse(getFacet().contains(altid, vk));
assertFalse(getFacet().contains(id, VariableKey.getConstant("Var2")));
}
use of pcgen.cdom.facet.event.DataFacetChangeEvent in project pcgen by PCGen.
the class LocalSkillCostFacetTest method removeCosts.
private void removeCosts(CharID cid, CDOMObject cl) {
DataFacetChangeEvent<CharID, CDOMObject> dfce = new DataFacetChangeEvent<>(cid, cl, new Object(), DataFacetChangeEvent.DATA_REMOVED);
getFacet().dataRemoved(dfce);
}
Aggregations