Commit c588d155 authored by Aneta Steimarova's avatar Aneta Steimarova

#929 Made NewUserScenario work on Android

parent 0318c5e8
......@@ -112,6 +112,8 @@ public class FormScreen extends AbstractTablexiaScreen<Void> {
public static final String SCENARIO_STEP_IMAGE_CHOSEN = "image chosen";
public static final String SCENARIO_STEP_TEXT_FIELD_TIMEOUT = "text field timeout";
public static final String PEN_SHAKED = "pen shaked";
public static final String ALTERNATIVE_TEXT_FIELD_SHOWN = "alternative text field shown";
public static final String ALTERNATIVE_NAME_FIELD_HIDDEN = "alternative name field hidden";
public static final String FORM_SIGNATURE_DIALOG = "signature dialog";
......@@ -123,6 +125,8 @@ public class FormScreen extends AbstractTablexiaScreen<Void> {
public static final String FORM_SIGNATURE = "formSignature";
public static final String FORM_AVATAR_IMAGE = "avatar image";
public static final String FORM_STAMP = "formStamp";
public static final String ALTERNATIVE_TEXT_FIELD = "alternative text field";
public static final String YES_ICON = "yes icon";
private static final int PRIVACY_LABEL_WIDTH = 340;
private static final int PRIVACY_LABEL_HEIGHT = 40;
......@@ -361,6 +365,7 @@ public class FormScreen extends AbstractTablexiaScreen<Void> {
if(TablexiaSettings.getInstance().getPlatform() != TablexiaSettings.Platform.DESKTOP) {
Gdx.input.setOnscreenKeyboardVisible(true);
showAlternativeTextField();
triggerScenarioStepEvent(ALTERNATIVE_TEXT_FIELD_SHOWN);
}
}
});
......@@ -543,6 +548,7 @@ public class FormScreen extends AbstractTablexiaScreen<Void> {
alternativeTextField.setPosition(getStage().getWidth()/2 - alternativeTextField.getWidth()/2, 3*getStage().getHeight()/5);
alternativeTextField.setFocusTraversal(false);
alternativeTextField.setMaxLength(MAX_NAME_LENGTH);
alternativeTextField.setName(ALTERNATIVE_TEXT_FIELD);
alternativeTextField.addListener(new InputListener() {
@Override
public boolean keyTyped(InputEvent event, char character) {
......@@ -571,6 +577,7 @@ public class FormScreen extends AbstractTablexiaScreen<Void> {
noIcon.setPosition(alternativeTextField.getX() - PRIVACY_LABEL_OFFSET_X - noIcon.getWidth(), alternativeTextField.getY());
yesIcon = new Image(getScreenTextureRegion(FormScreenAssets.YES_ICON));
yesIcon.setName(YES_ICON);
yesIcon.addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y) {
......@@ -578,6 +585,7 @@ public class FormScreen extends AbstractTablexiaScreen<Void> {
hideAlternativeField();
validate();
Gdx.input.setOnscreenKeyboardVisible(false);
triggerScenarioStepEvent(ALTERNATIVE_NAME_FIELD_HIDDEN);
}
});
yesIcon.setPosition(alternativeTextField.getX() + alternativeTextField.getWidth() + PRIVACY_LABEL_OFFSET_X, alternativeTextField.getY());
......
NewUserScenario
TestScenarioSpecial
TestScenarioHallOfFameRobberyTrophies
TestScenarioHeapOfTrophies
TestGameShootingRangeEasyNoneStar
TestGameRobberyMediumOneStar
TestGameInTheDarknessMedium
TestGameNightWatchMediumNoneStar
TestGamePursuitHardThreeStar
TestGameCrimeSceneHardOneStar
TestGameKidnappingEasyTwoStar
TestGameRunesMediumThreeStar
TestGameProtocolEasyOneStar
TestGameSafeHardNoneStars
TestStatisticsInTheDarkness
TestEncyclopedia
TestProfile
\ No newline at end of file
NewUserScenario
NewUserScenario
NewUserScenario
\ No newline at end of file
......@@ -23,6 +23,7 @@ import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Actor;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.TablexiaSettings;
import cz.nic.tablexia.menu.AbstractMenu;
import cz.nic.tablexia.menu.user.UserAvatarDefinition;
import cz.nic.tablexia.menu.user.UserMenu;
......@@ -71,8 +72,17 @@ public class NewUserScenario extends AbstractTestScenario {
//Text field
clickAt("25. Click at text field", FormScreen.FIELD_FORM_NAME);
typeToTextField("26. Type text to text field", "Detektiv", FormScreen.FIELD_FORM_NAME);
waitForEvent("27. Wait for text field timeout", FormScreen.SCENARIO_STEP_TEXT_FIELD_TIMEOUT);
if(TablexiaSettings.getInstance().isRunningOnMobileDevice()){
clickAt("26. a) Click at alternative text field", FormScreen.ALTERNATIVE_TEXT_FIELD);
waitForEvent("26. b) Wait for event alternative text field shown", FormScreen.ALTERNATIVE_TEXT_FIELD_SHOWN);
typeToTextField("26. c) Type text to text field", "Detektiv", FormScreen.ALTERNATIVE_TEXT_FIELD);
clickAt("26. d) Click at yes", FormScreen.YES_ICON);
waitForEvent("27. Wait for alternative name field hidden", FormScreen.ALTERNATIVE_NAME_FIELD_HIDDEN);
}
else {
typeToTextField("26. Type text to text field", "Detektiv", FormScreen.FIELD_FORM_NAME);
waitForEvent("27. Wait for text field timeout", FormScreen.SCENARIO_STEP_TEXT_FIELD_TIMEOUT);
}
//Setting up age
clickAt("28. Click at age plus button", FormScreen.BUTTON_FORM_AGE_PLUS);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment