Search in sources :

Example 96 with PCTemplate

use of pcgen.core.PCTemplate in project pcgen by PCGen.

the class AbstractGlobalTargetedSaveRestoreTest method testAddTemplate.

@Test
public void testAddTemplate() {
    PCTemplate granted = create(PCTemplate.class, "MyTemplate");
    create(PCTemplate.class, "Ignored");
    T target = create(getObjectClass(), "Target");
    new plugin.lsttokens.add.TemplateToken().parseToken(context, target, "MyTemplate");
    Object o = prepare(target);
    finishLoad();
    assertFalse(pc.hasTemplate(granted));
    applyObject(target);
    assertTrue(pc.hasTemplate(granted));
    runRoundRobin(getPreEqualityCleanup());
    assertTrue(pc.hasTemplate(granted));
    assertTrue(reloadedPC.hasTemplate(granted));
    remove(o);
    reloadedPC.setDirty(true);
    if (isSymmetric()) {
        assertFalse(reloadedPC.hasTemplate(granted));
    }
}
Also used : CDOMObject(pcgen.cdom.base.CDOMObject) PCTemplate(pcgen.core.PCTemplate) Test(org.junit.Test)

Example 97 with PCTemplate

use of pcgen.core.PCTemplate in project pcgen by PCGen.

the class StatIntegrationTest method testNonStatToStatOverrideNonAbilityLockComplex.

@Test
public void testNonStatToStatOverrideNonAbilityLockComplex() {
    testNonAbilityUnset();
    Race r = new Race();
    causeLockNonAbility(r, stat1);
    rfacet.set(id, r);
    PCTemplate t1 = new PCTemplate();
    causeUnLockNonAbility(t1, stat1);
    tfacet.add(id, t1, tsource);
    testNonAbilityUnset();
    testLockUnsetConditional();
}
Also used : Race(pcgen.core.Race) PCTemplate(pcgen.core.PCTemplate) Test(org.junit.Test)

Example 98 with PCTemplate

use of pcgen.core.PCTemplate in project pcgen by PCGen.

the class StatIntegrationTest method testUnlockOverrideLockComplex.

@Test
public void testUnlockOverrideLockComplex() {
    testNonAbilityUnset();
    Race r = new Race();
    causeLock(r, stat1, 13);
    rfacet.set(id, r);
    PCTemplate t1 = new PCTemplate();
    causeUnlock(t1, stat1);
    tfacet.add(id, t1, tsource);
    testNonAbilityUnset();
    testLockUnsetConditional();
}
Also used : Race(pcgen.core.Race) PCTemplate(pcgen.core.PCTemplate) Test(org.junit.Test)

Example 99 with PCTemplate

use of pcgen.core.PCTemplate in project pcgen by PCGen.

the class StatIntegrationTest method testLockComplex.

@Test
public void testLockComplex() {
    Race r = new Race();
    causeLock(r, stat1, 14);
    rfacet.set(id, r);
    testNonAbilityUnset();
    assertEquals(14, lockFacet.getLockedStat(id, stat1));
    assertNull(lockFacet.getLockedStat(id, stat2));
    PCTemplate t1 = new PCTemplate();
    causeLock(t1, stat1, 15);
    tfacet.add(id, t1, tsource);
    testNonAbilityUnset();
    assertEquals(15, lockFacet.getLockedStat(id, stat1));
    assertNull(lockFacet.getLockedStat(id, stat2));
    // Make sure cleans up when template removed
    tfacet.remove(id, t1, tsource);
    testNonAbilityUnset();
    assertEquals(14, lockFacet.getLockedStat(id, stat1));
    assertNull(lockFacet.getLockedStat(id, stat2));
}
Also used : Race(pcgen.core.Race) PCTemplate(pcgen.core.PCTemplate) Test(org.junit.Test)

Example 100 with PCTemplate

use of pcgen.core.PCTemplate in project pcgen by PCGen.

the class StatIntegrationTest method testLockNonAbilityInTemplate.

@Test
public void testLockNonAbilityInTemplate() {
    Race r = new Race();
    rfacet.set(id, r);
    testNonAbilityUnset();
    PCTemplate t1 = new PCTemplate();
    causeLockNonAbility(t1, stat1);
    tfacet.add(id, t1, tsource);
    assertFalse(nonAbilityFacet.isNonAbility(id, stat2));
    assertTrue(nonAbilityFacet.isNonAbility(id, stat1));
    assertFalse(nonAbilityFacet.isNonAbility(altid, stat1));
    // Make sure cleans up when template removed
    tfacet.remove(id, t1, tsource);
    testNonAbilityUnset();
    testLockUnset();
}
Also used : Race(pcgen.core.Race) 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