Search in sources :

Example 1 with TextToken

use of plugin.exporttokens.TextToken in project pcgen by PCGen.

the class TextTokenTest method testTextFormatting.

/**
	 * Test the output for positive numbers with fractions.
	 */
public void testTextFormatting() {
    TextToken tok = new TextToken();
    ExportHandler eh = new ExportHandler(null);
    PlayerCharacter character = getCharacter();
    assertEquals("TEXT.LOWER.NAME", "the vitamins are in my fresh brussels sprouts", tok.getToken("TEXT.LOWER.NAME", character, eh));
    assertEquals("TEXT.UPPER.NAME", "THE VITAMINS ARE IN MY FRESH BRUSSELS SPROUTS", tok.getToken("TEXT.UPPER.NAME", character, eh));
    assertEquals("TEXT.SENTENCE.NAME", "The vitamins are in my fresh brussels sprouts", tok.getToken("TEXT.SENTENCE.NAME", character, eh));
    assertEquals("TEXT.SENTENCE.NAME", "The vitamins are in my fresh brussels sprouts", tok.getToken("TEXT.SENTENCE.NAME", character, eh));
    character.setPCAttribute(PCAttribute.NAME, "The Vitamins are in my Fresh Brussels Sprouts");
    assertEquals("TEXT.SENTENCE.INTERESTS", "One potatoe. Two potatoe. More", tok.getToken("TEXT.SENTENCE.INTERESTS", character, eh));
    assertEquals("TEXT.TITLE.NAME", "The Vitamins Are In My Fresh Brussels Sprouts", tok.getToken("TEXT.TITLE.NAME", getCharacter(), eh));
    assertEquals("TEXT.TITLE.NAME", "One Potatoe. Two Potatoe. More", tok.getToken("TEXT.TITLE.INTERESTS", character, eh));
}
Also used : TextToken(plugin.exporttokens.TextToken) PlayerCharacter(pcgen.core.PlayerCharacter) ExportHandler(pcgen.io.ExportHandler)

Example 2 with TextToken

use of plugin.exporttokens.TextToken in project pcgen by PCGen.

the class TextTokenTest method testNumSuffix.

/**
	 * Test the output for negative numbers with fractions.
	 */
public void testNumSuffix() {
    TextToken tok = new TextToken();
    ExportHandler eh = new ExportHandler(null);
    PlayerCharacter character = getCharacter();
    character.setPCAttribute(NumericPCAttribute.AGE, 1);
    assertEquals("Suffix 1", "st", tok.getToken("TEXT.NUMSUFFIX.AGE", getCharacter(), eh));
    character.setPCAttribute(NumericPCAttribute.AGE, 2);
    assertEquals("Suffix 2", "nd", tok.getToken("TEXT.NUMSUFFIX.AGE", getCharacter(), eh));
    character.setPCAttribute(NumericPCAttribute.AGE, 3);
    assertEquals("Suffix 3", "rd", tok.getToken("TEXT.NUMSUFFIX.AGE", getCharacter(), eh));
    character.setPCAttribute(NumericPCAttribute.AGE, 4);
    assertEquals("Suffix 4", "th", tok.getToken("TEXT.NUMSUFFIX.AGE", getCharacter(), eh));
    character.setPCAttribute(NumericPCAttribute.AGE, 11);
    assertEquals("Suffix 11", "th", tok.getToken("TEXT.NUMSUFFIX.AGE", getCharacter(), eh));
    character.setPCAttribute(NumericPCAttribute.AGE, 12);
    assertEquals("Suffix 12", "th", tok.getToken("TEXT.NUMSUFFIX.AGE", getCharacter(), eh));
    character.setPCAttribute(NumericPCAttribute.AGE, 13);
    assertEquals("Suffix 13", "th", tok.getToken("TEXT.NUMSUFFIX.AGE", getCharacter(), eh));
    character.setPCAttribute(NumericPCAttribute.AGE, 14);
    assertEquals("Suffix 14", "th", tok.getToken("TEXT.NUMSUFFIX.AGE", getCharacter(), eh));
    character.setPCAttribute(NumericPCAttribute.AGE, 21);
    assertEquals("Suffix 21", "st", tok.getToken("TEXT.NUMSUFFIX.AGE", getCharacter(), eh));
    character.setPCAttribute(NumericPCAttribute.AGE, 22);
    assertEquals("Suffix 22", "nd", tok.getToken("TEXT.NUMSUFFIX.AGE", getCharacter(), eh));
    character.setPCAttribute(NumericPCAttribute.AGE, 23);
    assertEquals("Suffix 23", "rd", tok.getToken("TEXT.NUMSUFFIX.AGE", getCharacter(), eh));
    character.setPCAttribute(NumericPCAttribute.AGE, 24);
    assertEquals("Suffix 24", "th", tok.getToken("TEXT.NUMSUFFIX.AGE", getCharacter(), eh));
    character.setPCAttribute(NumericPCAttribute.AGE, 133);
    assertEquals("Suffix 133", "rd", tok.getToken("TEXT.NUMSUFFIX.AGE", getCharacter(), eh));
}
Also used : TextToken(plugin.exporttokens.TextToken) PlayerCharacter(pcgen.core.PlayerCharacter) ExportHandler(pcgen.io.ExportHandler)

Example 3 with TextToken

use of plugin.exporttokens.TextToken in project pcgen by PCGen.

the class TextTokenTest method testNumSuffixDirect.

/**
	 * Test the output for negative numbers with fractions.
	 */
public void testNumSuffixDirect() {
    TextToken tok = new TextToken();
    ExportHandler eh = new ExportHandler(null);
    assertEquals("Suffix 1", "st", tok.getToken("TEXT.NUMSUFFIX.1", getCharacter(), eh));
    assertEquals("Suffix 2", "nd", tok.getToken("TEXT.NUMSUFFIX.2", getCharacter(), eh));
    assertEquals("Suffix 3", "rd", tok.getToken("TEXT.NUMSUFFIX.3", getCharacter(), eh));
    assertEquals("Suffix 4", "th", tok.getToken("TEXT.NUMSUFFIX.4", getCharacter(), eh));
    assertEquals("Suffix 12", "th", tok.getToken("TEXT.NUMSUFFIX.12", getCharacter(), eh));
    assertEquals("Suffix 133", "rd", tok.getToken("TEXT.NUMSUFFIX.133", getCharacter(), eh));
    assertEquals("Suffix 133", "rd", tok.getToken("TEXT.NUMSUFFIX.133.0", getCharacter(), eh));
}
Also used : TextToken(plugin.exporttokens.TextToken) ExportHandler(pcgen.io.ExportHandler)

Aggregations

ExportHandler (pcgen.io.ExportHandler)3 TextToken (plugin.exporttokens.TextToken)3 PlayerCharacter (pcgen.core.PlayerCharacter)2