Skip to content

Commit 2bbc8b1

Browse files
committed
fix for orientation tests
these tests would have failed, if the activity before allowed orientation landscape, because solo.getCurrentActivity would have returned the wrong activity without the wait
1 parent 49d65b2 commit 2bbc8b1

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

catroidUiTest/src/org/catrobat/catroid/uitest/ui/ProgramMenuActivityTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public void testOrientation() throws NameNotFoundException {
8484
createProject();
8585
solo.clickOnButton(solo.getString(R.string.main_menu_continue));
8686
solo.clickOnText("Background");
87+
solo.waitForActivity(ProgramMenuActivity.class.getSimpleName());
8788
assertEquals("ProgramMenuActivity not in Portrait mode!", Configuration.ORIENTATION_PORTRAIT, solo
8889
.getCurrentActivity().getResources().getConfiguration().orientation);
8990

@@ -96,6 +97,7 @@ public void testOrientation() throws NameNotFoundException {
9697
// Note that the activity is _indeed_ rotated on your device/emulator!
9798
// Robotium can _force_ the activity to be in landscape mode (and so could we, programmatically)
9899
solo.setActivityOrientation(Solo.LANDSCAPE);
100+
solo.sleep(200);
99101

100102
assertEquals(ProgramMenuActivity.class.getSimpleName()
101103
+ " not set to be in portrait mode in AndroidManifest.xml!", ActivityInfo.SCREEN_ORIENTATION_PORTRAIT,

catroidUiTest/src/org/catrobat/catroid/uitest/ui/ProjectActivityTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ public void testAddedSpriteVisibleOnLongList() {
162162
public void testOrientation() throws NameNotFoundException {
163163
/// Method 1: Assert it is currently in portrait mode.
164164
solo.clickOnButton(solo.getString(R.string.main_menu_continue));
165+
solo.waitForActivity(ProjectActivity.class.getSimpleName());
165166
assertEquals("ProjectActivity not in Portrait mode!", Configuration.ORIENTATION_PORTRAIT, solo
166167
.getCurrentActivity().getResources().getConfiguration().orientation);
167168

@@ -174,6 +175,7 @@ public void testOrientation() throws NameNotFoundException {
174175
// Note that the activity is _indeed_ rotated on your device/emulator!
175176
// Robotium can _force_ the activity to be in landscape mode (and so could we, programmatically)
176177
solo.setActivityOrientation(Solo.LANDSCAPE);
178+
solo.sleep(200);
177179

178180
assertEquals(ProjectActivity.class.getSimpleName() + " not set to be in portrait mode in AndroidManifest.xml!",
179181
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, activityInfo.screenOrientation);

0 commit comments

Comments
 (0)