use of pcgen.core.PCTemplate in project pcgen by PCGen.
the class VariableFacetTest method testAddEmptyObject.
@Test
public void testAddEmptyObject() {
Object source = new Object();
CDOMObject t1 = new PCTemplate();
DataFacetChangeEvent<CharID, CDOMObject> dfce = new DataFacetChangeEvent<>(id, t1, source, DataFacetChangeEvent.DATA_ADDED);
getFacet().dataAdded(dfce);
VariableKey vk = VariableKey.getConstant("Var1");
assertFalse(getFacet().contains(id, vk));
}
use of pcgen.core.PCTemplate in project pcgen by PCGen.
the class VariableFacetTest method testAddRemove1First.
@Test
public void testAddRemove1First() {
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, t1, source, DataFacetChangeEvent.DATA_REMOVED);
getFacet().dataRemoved(dfce);
assertTrue(getFacet().contains(id, vk));
dfce = new DataFacetChangeEvent<>(id, t2, source, DataFacetChangeEvent.DATA_REMOVED);
getFacet().dataRemoved(dfce);
assertFalse(getFacet().contains(id, vk));
}
use of pcgen.core.PCTemplate in project pcgen by PCGen.
the class VariableFacetTest method testUselessRemove.
@Test
public void testUselessRemove() {
Object source = new Object();
CDOMObject t1 = new PCTemplate();
VariableKey vk1 = VariableKey.getConstant("Var1");
DataFacetChangeEvent<CharID, CDOMObject> dfce = new DataFacetChangeEvent<>(id, t1, source, DataFacetChangeEvent.DATA_REMOVED);
getFacet().dataRemoved(dfce);
assertFalse(getFacet().contains(id, vk1));
}
use of pcgen.core.PCTemplate in project pcgen by PCGen.
the class VisionFacetTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
CDOMObject cdo1 = new PCTemplate();
cdo1.setName("Template1");
CDOMObject cdo2 = new Race();
cdo2.setName("Race1");
Vision vision1 = new Vision(VisionType.getVisionType("Normal"), FormulaFactory.getFormulaFor(30));
Vision vision2 = new Vision(VisionType.getVisionType("Darkvision"), FormulaFactory.getFormulaFor(20));
CDOMDirectSingleRef<Vision> ref1 = new CDOMDirectSingleRef<>(vision1);
SimpleAssociatedObject apo1 = new SimpleAssociatedObject();
cdo1.putToList(Vision.VISIONLIST, ref1, apo1);
CDOMDirectSingleRef<Vision> ref2 = new CDOMDirectSingleRef<>(vision2);
SimpleAssociatedObject apo2 = new SimpleAssociatedObject();
cdo2.putToList(Vision.VISIONLIST, ref2, apo2);
QualifiedObject<Vision> st1 = new QualifiedObject<>(vision1);
QualifiedObject<Vision> st2 = new QualifiedObject<>(vision2);
source = new CDOMObject[] { cdo1, cdo2 };
target = new QualifiedObject[] { st1, st2 };
}
use of pcgen.core.PCTemplate in project pcgen by PCGen.
the class HandedFacetTest method testWithNothingInTemplates.
@Test
public void testWithNothingInTemplates() {
tfacet.add(id, new PCTemplate(), this);
assertEquals(Handed.getDefaultValue(), facet.getHanded(id));
}
Aggregations