Search in sources :

Example 1 with DummyFormEntryPrompt

use of org.javarosa.core.model.test.DummyFormEntryPrompt in project javarosa by opendatakit.

the class TextFormTests method testPromptsWithLocalizer.

public void testPromptsWithLocalizer() {
    Localizer l = new Localizer();
    TableLocaleSource table = new TableLocaleSource();
    l.addAvailableLocale("locale");
    l.setDefaultLocale("locale");
    table.setLocaleMapping("prompt;long", "loc: long text");
    table.setLocaleMapping("prompt;short", "loc: short text");
    table.setLocaleMapping("help", "loc: help text");
    l.registerLocaleResource("locale", table);
    l.setLocale("locale");
    QuestionDef q = new QuestionDef();
    q.setHelpTextID("help");
    FormEntryPrompt fep = new DummyFormEntryPrompt(l, "prompt", q);
    if (!"loc: long text".equals(fep.getLongText())) {
        fail("Long text did not localize properly");
    }
    if (!"loc: short text".equals(fep.getShortText())) {
        fail("Short text did not localize properly");
    }
}
Also used : FormEntryPrompt(org.javarosa.form.api.FormEntryPrompt) DummyFormEntryPrompt(org.javarosa.core.model.test.DummyFormEntryPrompt) DummyFormEntryPrompt(org.javarosa.core.model.test.DummyFormEntryPrompt) TableLocaleSource(org.javarosa.core.services.locale.TableLocaleSource) Localizer(org.javarosa.core.services.locale.Localizer) QuestionDef(org.javarosa.core.model.QuestionDef)

Aggregations

QuestionDef (org.javarosa.core.model.QuestionDef)1 DummyFormEntryPrompt (org.javarosa.core.model.test.DummyFormEntryPrompt)1 Localizer (org.javarosa.core.services.locale.Localizer)1 TableLocaleSource (org.javarosa.core.services.locale.TableLocaleSource)1 FormEntryPrompt (org.javarosa.form.api.FormEntryPrompt)1