Search in sources :

Example 26 with ExportHandler

use of pcgen.io.ExportHandler in project pcgen by PCGen.

the class AbilityListTokenTest method testTypes.

/**
	 * Test the output for positive numbers with fractions.
	 */
public void testTypes() {
    AbilityListToken tok = new AbilityListToken();
    ExportHandler eh = new ExportHandler(null);
    PlayerCharacter character = getCharacter();
    is(tok.getToken("ABILITYLIST.FEAT", character, eh), strEq("Perform (Dance), Perform (Oratory), Silent Step"), "ABILITYLIST.FEAT");
    is(tok.getToken("ABILITYLIST.FEAT.TYPE=Fighter", character, eh), strEq("Perform (Dance), Perform (Oratory)"), "ABILITYLIST.FEAT.TYPE=Fighter");
    is(tok.getToken("ABILITYLIST.FEAT.!TYPE=Fighter", character, eh), strEq("Silent Step"), "ABILITYLIST.FEAT.!TYPE=Fighter");
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) ExportHandler(pcgen.io.ExportHandler)

Example 27 with ExportHandler

use of pcgen.io.ExportHandler in project pcgen by PCGen.

the class AbilityTokenTest method testAspect.

/**
	 * Tests the aspect subtoken of ABILITY without a specific aspect.
	 */
public void testAspect() {
    AbilityToken tok = new AbilityToken();
    ExportHandler eh = new ExportHandler(null);
    PlayerCharacter character = getCharacter();
    assertEquals("Age In Years: 2000, Colour: Green, Shape: Icosahedron, Sides: 20, Size: L", tok.getToken("ABILITY.FEAT.0.ASPECT", character, eh));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) ExportHandler(pcgen.io.ExportHandler)

Example 28 with ExportHandler

use of pcgen.io.ExportHandler in project pcgen by PCGen.

the class AbilityTokenTest method testNonExistantSingleAspect.

/**
	 * Tests the ASPECT subtoken of ABILITY with an invalid aspect specified.
	 */
public void testNonExistantSingleAspect() {
    AbilityToken tok = new AbilityToken();
    ExportHandler eh = new ExportHandler(null);
    PlayerCharacter character = getCharacter();
    assertEquals("", tok.getToken("ABILITY.FEAT.0.ASPECT.-5", character, eh));
    assertEquals("", tok.getToken("ABILITY.FEAT.0.ASPECT.5", character, eh));
    assertEquals("", tok.getToken("ABILITY.FEAT.0.ASPECT.500", character, eh));
    assertEquals("", tok.getToken("ABILITY.FEAT.0.ASPECT.Attack Type", character, eh));
    assertEquals("", tok.getToken("ABILITY.FEAT.0.ASPECT.Target", character, eh));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) ExportHandler(pcgen.io.ExportHandler)

Example 29 with ExportHandler

use of pcgen.io.ExportHandler in project pcgen by PCGen.

the class AbilityTokenTest method testSingleAspect.

/**
	 * Tests the ASPECT subtoken of ABILITY with an aspect specified.
	 */
public void testSingleAspect() {
    AbilityToken tok = new AbilityToken();
    ExportHandler eh = new ExportHandler(null);
    PlayerCharacter character = getCharacter();
    assertEquals("Shape: Icosahedron", tok.getToken("ABILITY.FEAT.0.ASPECT.2", character, eh));
    assertEquals("20", tok.getToken("ABILITY.FEAT.0.ASPECT.Sides", character, eh));
    assertEquals("Green", tok.getToken("ABILITY.FEAT.0.ASPECT.Colour", character, eh));
    assertEquals("2000", tok.getToken("ABILITY.FEAT.0.ASPECT.Age In Years", character, eh));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) ExportHandler(pcgen.io.ExportHandler)

Example 30 with ExportHandler

use of pcgen.io.ExportHandler in project pcgen by PCGen.

the class AbilityTokenTest method testKey.

/**
	 * Tests the key subtoken of ABILITY.
	 */
public void testKey() {
    AbilityToken tok = new AbilityToken();
    ExportHandler eh = new ExportHandler(null);
    PlayerCharacter character = getCharacter();
    assertEquals("KEY_Perform (Dance)", tok.getToken("ABILITY.FEAT.0.KEY", character, eh));
    assertEquals("KEY_Skill Focus", tok.getToken("ABILITY.FEAT.1.KEY", character, eh));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) ExportHandler(pcgen.io.ExportHandler)

Aggregations

ExportHandler (pcgen.io.ExportHandler)31 PlayerCharacter (pcgen.core.PlayerCharacter)24 File (java.io.File)7 BufferedWriter (java.io.BufferedWriter)6 StringWriter (java.io.StringWriter)4 IOException (java.io.IOException)3 TextToken (plugin.exporttokens.TextToken)3 OutputStreamWriter (java.io.OutputStreamWriter)2 Test (org.junit.Test)2 FileOutputStream (java.io.FileOutputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 CharacterFacade (pcgen.facade.core.CharacterFacade)1 ExportException (pcgen.io.ExportException)1 PCGFile (pcgen.io.PCGFile)1