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));
}
}
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();
}
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();
}
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));
}
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();
}
Aggregations