Search in sources :

Example 86 with PCTemplate

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));
}
Also used : PCTemplate(pcgen.core.PCTemplate) Test(org.junit.Test)

Example 87 with PCTemplate

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)
		 */
}
Also used : Race(pcgen.core.Race) PCTemplate(pcgen.core.PCTemplate) Test(org.junit.Test)

Example 88 with PCTemplate

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);
}
Also used : Race(pcgen.core.Race) PCTemplate(pcgen.core.PCTemplate) Test(org.junit.Test)

Example 89 with PCTemplate

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));
}
Also used : PCTemplate(pcgen.core.PCTemplate) Test(org.junit.Test)

Example 90 with PCTemplate

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));
}
Also used : PCTemplate(pcgen.core.PCTemplate) Test(org.junit.Test)

Aggregations

PCTemplate (pcgen.core.PCTemplate)215 Test (org.junit.Test)105 Race (pcgen.core.Race)66 PlayerCharacter (pcgen.core.PlayerCharacter)38 CDOMObject (pcgen.cdom.base.CDOMObject)31 ArrayList (java.util.ArrayList)19 CharID (pcgen.cdom.enumeration.CharID)18 ParseResult (pcgen.rules.persistence.token.ParseResult)14 SimpleAssociatedObject (pcgen.cdom.base.SimpleAssociatedObject)13 Vision (pcgen.core.Vision)12 LoadContext (pcgen.rules.context.LoadContext)12 PCClass (pcgen.core.PCClass)11 StringTokenizer (java.util.StringTokenizer)10 VariableKey (pcgen.cdom.enumeration.VariableKey)8 DataFacetChangeEvent (pcgen.cdom.facet.event.DataFacetChangeEvent)8 Ability (pcgen.core.Ability)8 Formula (pcgen.base.formula.Formula)6 Equipment (pcgen.core.Equipment)6 PCStat (pcgen.core.PCStat)6 AbstractTokenModelTest (tokenmodel.testsupport.AbstractTokenModelTest)6