use of pcgen.core.PCTemplate in project pcgen by PCGen.
the class GenderFacetTest method testWithNothingInTemplates.
@Test
public void testWithNothingInTemplates() {
tfacet.add(id, new PCTemplate(), this);
assertEquals(Gender.getDefaultValue(), facet.getGender(id));
}
use of pcgen.core.PCTemplate in project pcgen by PCGen.
the class RacialSubTypesFacetTest method testCount.
@Test
public void testCount() {
assertEquals(0, facet.getCount(id));
Race r = new Race();
r.addToListFor(ListKey.RACESUBTYPE, TEST_RACE_TYPE);
rfacet.set(id, r);
assertEquals(1, facet.getCount(id));
assertList(facet.getRacialSubTypes(id), TEST_RACE_TYPE);
PCTemplate t = new PCTemplate();
t.setName("PCT");
t.addToListFor(ListKey.RACESUBTYPE, RACE_TYPE_TOO);
tfacet.add(id, t, this);
assertEquals(2, facet.getCount(id));
PCTemplate t2 = new PCTemplate();
t2.setName("Other");
t2.addToListFor(ListKey.RACESUBTYPE, LAST_RACE_TYPE);
tfacet.add(id, t2, this);
assertEquals(3, facet.getCount(id));
tfacet.remove(id, t, this);
assertEquals(2, facet.getCount(id));
tfacet.add(id, t, this);
assertEquals(3, facet.getCount(id));
tfacet.remove(id, t, this);
assertEquals(2, facet.getCount(id));
tfacet.remove(id, t2, this);
assertEquals(1, facet.getCount(id));
/*
* TODO Note this doesn't test duplicates. We need to check appropriate
* behavior of RaceSubType (set vs. list)
*/
}
use of pcgen.core.PCTemplate in project pcgen by PCGen.
the class RacialSubTypesFacetTest method testGetFromRaceAndTemplate.
@Test
public void testGetFromRaceAndTemplate() {
Race r = new Race();
r.addToListFor(ListKey.RACESUBTYPE, TEST_RACE_TYPE);
rfacet.set(id, r);
assertList(facet.getRacialSubTypes(id), TEST_RACE_TYPE);
PCTemplate t = new PCTemplate();
t.addToListFor(ListKey.RACESUBTYPE, RACE_TYPE_TOO);
tfacet.add(id, t, this);
assertList(facet.getRacialSubTypes(id), TEST_RACE_TYPE, RACE_TYPE_TOO);
tfacet.remove(id, t, this);
assertList(facet.getRacialSubTypes(id), TEST_RACE_TYPE);
}
use of pcgen.core.PCTemplate in project pcgen by PCGen.
the class SubRaceFacetTest method testWithNothingInTemplates.
@Test
public void testWithNothingInTemplates() {
tfacet.add(id, new PCTemplate(), this);
assertNull(facet.getSubRace(id));
}
use of pcgen.core.PCTemplate in project pcgen by PCGen.
the class SubRaceFacetTest method testSubRaceSetUseNameTrueSubRaceDominates.
@Test
public void testSubRaceSetUseNameTrueSubRaceDominates() {
PCTemplate pct = new PCTemplate();
pct.put(ObjectKey.SUBRACE, SubRace.getConstant("TestSubRace"));
pct.setName("TestTemplate");
pct.put(ObjectKey.USETEMPLATENAMEFORSUBRACE, true);
tfacet.add(id, pct, this);
assertEquals("TestSubRace", facet.getSubRace(id));
tfacet.remove(id, pct, this);
assertNull(facet.getSubRace(altid));
}
Aggregations