Device rotation

815 views
Skip to first unread message

Claire Reynaud

unread,
Mar 13, 2012, 11:15:39 AM3/13/12
to calabash-android
Hello,

I am trying to trigger a device rotation during my test. I get the
following error:

[exec] Then I rotate the device to
landscape # features/step_definitions/
rotation_steps.rb:1
[exec] undefined method `rotate_phone' for #<Object:
0x101493ca0> (NoMethodError)
[exec] ./features/step_definitions/rotation_steps.rb:2:in `/
^I rotate the device to landscape$/'
[exec] features/login_dummy.feature:28:in `Then I rotate
the device to landscape'

So I wonder whether device rotation is implemented or not.

Thanks again,
Claire

Jonas Maturana Larsen

unread,
Mar 13, 2012, 11:30:58 AM3/13/12
to calabash...@googlegroups.com
Hi Claire,

Rotation on Calabash-Android does only work on the LessPainful service right now. (Actually it is disabled because of some servo problems but will be running soon)

Unlike iOS simulating the rotation on Android gives really bad results :(

Are you running the test on an emulator? Then maybe we can make a hack that makes it work. However, we can't do the same thing for physical devices.

You're on a Mac, right?

Claire Reynaud

unread,
Mar 13, 2012, 12:43:19 PM3/13/12
to calabash-android
On Mar 13, 4:30 pm, Jonas Maturana Larsen <jo...@lesspainful.com>
wrote:
> Hi Claire,
>
> Rotation on Calabash-Android does only work on the LessPainful service right now. (Actually it is disabled because of some servo problems but will be running soon)
>
> Unlike iOS simulating the rotation on Android gives really bad results :(
>
> Are you running the test on an emulator? Then maybe we can make a hack that makes it work. However, we can't do the same thing for physical devices.
>

I am running the tests on my device and on an emulator. Making the
rotation work on the emulator would be really awesome.
What would be the hack? To send the "Switch to previous layout
orientation" key to the emulator window? (cf
http://developer.android.com/guide/developing/tools/emulator.html#controlling)
I googled for a better way to trigger the emulator rotation with a
command line but could not find anything else that works :(.

> You're on a Mac, right?
>

Yes I am running on a Mac.

Jonas Maturana Larsen

unread,
Mar 13, 2012, 12:47:12 PM3/13/12
to calabash...@googlegroups.com
That was the idea I wanted to explore.

If you find a way to send the keys to the emulator it would be cool.

I wont have time to work on a solution for some days so any input would be great!

maddy

unread,
Oct 3, 2012, 1:01:55 AM10/3/12
to calabash...@googlegroups.com
Has anyone tried successfully switching the orientation of device while running test cases on emulator or real device? 

Thanks,
maddy

bootstraponline

unread,
Nov 16, 2012, 2:12:32 AM11/16/12
to calabash...@googlegroups.com
I have a pull request that adds changing orientation. I verified it works on a real device.

Jonas Maturana Larsen

unread,
Nov 18, 2012, 3:48:00 PM11/18/12
to calabash...@googlegroups.com
Hi

I just rejected the pull request but really want to thank you for your contribution: Thank you!

Here is the arguments:

The problem with this approach is that it works on activity level and not on a device level and therefore the behavior is pretty far from the user experience.

The consequence is that:

  • The event sequence is not the same as when you rotate the device.
  • When you go to another activity the app orientation returns to portrait.

Currently I don't think this belongs in the official project because of all the confusion it will cause.

I think a better solution would be to make the emulator rotate like when when you use 7 and 9.

- Jonas

Reply all
Reply to author
Forward
0 new messages