jxs1211 / android-test-kit

Automatically exported from code.google.com/p/android-test-kit
0 stars 0 forks source link

Support for screen rotation (orientation) #56

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a test which depends on landscape screen rotation
2. Set screenOrientation to landscape in your AndroidManifest
3. Run the test
4. Watch it fails

The problem is when the screen is off, every Activity is started in portrait 
mode (orientation returned from 
mActivity.getResources().getConfiguration().orientation is always 
Configuration.ORIENTATION_PORTRAIT).
In the case the screen is turned on, the orientation is returned properly. 

Reproduced on:
Galaxy S4 4.4.2
Galaxy S3 4.3
Galaxy Nexus 4.3

I have a simple test which fails when the screen is off:
    public void testSupportsOnlyLandscapeMode() throws Exception {
        int expectedOrientation = Configuration.ORIENTATION_LANDSCAPE;

        int orientation = mActivity.getResources().getConfiguration().orientation;

        assertThat(orientation, is(expectedOrientation));
    }

Is there any possibility to test such case? I want to assert that screen 
orientation is correct.

Original issue reported on code.google.com by TomR...@gmail.com on 20 Feb 2014 at 9:36

GoogleCodeExporter commented 9 years ago
Obviously it can be closed. To perform such test the screen must be turned on.

Original comment by TomR...@gmail.com on 5 Apr 2014 at 9:00

GoogleCodeExporter commented 9 years ago
Closing per reporter's comment.

Original comment by vale...@google.com on 6 May 2014 at 9:33