Пример #1
0
  public void testUserListReset() {
    dataContainer.addSpriteUserList(SPRITE_USER_LIST_NAME);
    dataContainer.addSpriteUserList(PROJECT_USER_LIST_NAME_2);
    dataContainer.addSpriteUserList(PROJECT_USER_LIST_NAME);

    dataContainer
        .getUserList(SPRITE_USER_LIST_NAME, firstSprite)
        .setList(USER_LIST_VALUES_MULTIPLE_NUMBERS);
    dataContainer
        .getUserList(PROJECT_USER_LIST_NAME, firstSprite)
        .setList(USER_LIST_VALUES_MULTIPLE_NUMBERS);
    dataContainer
        .getUserList(PROJECT_USER_LIST_NAME_2, firstSprite)
        .setList(USER_LIST_VALUES_MULTIPLE_NUMBERS);

    dataContainer.resetAllDataObjects();

    assertEquals(
        "Sprite UserList did not reset",
        EMPTY_USER_LIST_INTERPRETATION_VALUE,
        interpretUserList(SPRITE_USER_LIST_NAME));
    assertEquals(
        "Project UserList did not reset",
        EMPTY_USER_LIST_INTERPRETATION_VALUE,
        interpretUserList(PROJECT_USER_LIST_NAME));
    assertEquals(
        "Project UserList 2 did not reset",
        EMPTY_USER_LIST_INTERPRETATION_VALUE,
        interpretUserList(PROJECT_USER_LIST_NAME_2));
  }
Пример #2
0
  public void testFunctionListItem() {
    dataContainer.addSpriteUserList(PROJECT_USER_LIST_NAME);
    dataContainer
        .getUserList(PROJECT_USER_LIST_NAME, firstSprite)
        .setList(USER_LIST_VALUES_MULTIPLE_NUMBERS);
    dataContainer.addProjectUserVariable(PROJECT_USER_VARIABLE);

    String index = "1";
    FormulaEditorTestUtil.testDoubleParameterFunction(
        Functions.LIST_ITEM,
        InternTokenType.NUMBER,
        index,
        InternTokenType.USER_LIST,
        PROJECT_USER_LIST_NAME,
        1.0,
        firstSprite);

    index = "0";
    FormulaEditorTestUtil.testDoubleParameterFunction(
        Functions.LIST_ITEM,
        InternTokenType.NUMBER,
        index,
        InternTokenType.USER_LIST,
        PROJECT_USER_LIST_NAME,
        "",
        firstSprite);

    index = "4";
    FormulaEditorTestUtil.testDoubleParameterFunction(
        Functions.LIST_ITEM,
        InternTokenType.NUMBER,
        index,
        InternTokenType.USER_LIST,
        PROJECT_USER_LIST_NAME,
        "",
        firstSprite);

    index = "1.4";
    FormulaEditorTestUtil.testDoubleParameterFunction(
        Functions.LIST_ITEM,
        InternTokenType.NUMBER,
        index,
        InternTokenType.USER_LIST,
        PROJECT_USER_LIST_NAME,
        1.0,
        firstSprite);

    index = "1.0";
    FormulaEditorTestUtil.testDoubleParameterFunction(
        Functions.LIST_ITEM,
        InternTokenType.STRING,
        index,
        InternTokenType.USER_LIST,
        PROJECT_USER_LIST_NAME,
        1.0,
        firstSprite);

    dataContainer.getUserVariable(PROJECT_USER_VARIABLE, firstSprite).setValue("1");
    FormulaEditorTestUtil.testDoubleParameterFunction(
        Functions.LIST_ITEM,
        InternTokenType.USER_VARIABLE,
        PROJECT_USER_VARIABLE,
        InternTokenType.USER_LIST,
        PROJECT_USER_LIST_NAME,
        1.0,
        firstSprite);

    dataContainer.getUserVariable(PROJECT_USER_VARIABLE, firstSprite).setValue("0");
    FormulaEditorTestUtil.testDoubleParameterFunction(
        Functions.LIST_ITEM,
        InternTokenType.USER_VARIABLE,
        PROJECT_USER_VARIABLE,
        InternTokenType.USER_LIST,
        PROJECT_USER_LIST_NAME,
        "",
        firstSprite);

    dataContainer.getUserVariable(PROJECT_USER_VARIABLE, firstSprite).setValue("4");
    FormulaEditorTestUtil.testDoubleParameterFunction(
        Functions.LIST_ITEM,
        InternTokenType.USER_VARIABLE,
        PROJECT_USER_VARIABLE,
        InternTokenType.USER_LIST,
        PROJECT_USER_LIST_NAME,
        "",
        firstSprite);

    dataContainer.getUserVariable(PROJECT_USER_VARIABLE, firstSprite).setValue(1d);
    FormulaEditorTestUtil.testDoubleParameterFunction(
        Functions.LIST_ITEM,
        InternTokenType.USER_VARIABLE,
        PROJECT_USER_VARIABLE,
        InternTokenType.USER_LIST,
        PROJECT_USER_LIST_NAME,
        1.0,
        firstSprite);

    dataContainer.getUserVariable(PROJECT_USER_VARIABLE, firstSprite).setValue(0d);
    FormulaEditorTestUtil.testDoubleParameterFunction(
        Functions.LIST_ITEM,
        InternTokenType.USER_VARIABLE,
        PROJECT_USER_VARIABLE,
        InternTokenType.USER_LIST,
        PROJECT_USER_LIST_NAME,
        "",
        firstSprite);

    dataContainer.getUserVariable(PROJECT_USER_VARIABLE, firstSprite).setValue(4d);
    FormulaEditorTestUtil.testDoubleParameterFunction(
        Functions.LIST_ITEM,
        InternTokenType.USER_VARIABLE,
        PROJECT_USER_VARIABLE,
        InternTokenType.USER_LIST,
        PROJECT_USER_LIST_NAME,
        "",
        firstSprite);
  }