don't unfreezerotation, it actually cancels the rotation (fix #1280)

This commit is contained in:
Jonathan Lipps
2013-10-08 16:21:43 -07:00
parent dbbef1578f
commit ed093faa57
2 changed files with 7 additions and 8 deletions

View File

@@ -16,17 +16,17 @@ import com.android.uiautomator.core.UiDevice;
/**
* This handler is used to get or set the orientation of the device.
*
*
*/
public class Orientation extends CommandHandler {
/*
* @param command The {@link AndroidCommand} used for this handler.
*
*
* @return {@link AndroidCommandResult}
*
*
* @throws JSONException
*
*
* @see io.appium.android.bootstrap.CommandHandler#execute(io.appium.android.
* bootstrap.AndroidCommand)
*/
@@ -53,7 +53,7 @@ public class Orientation extends CommandHandler {
/**
* Returns the current rotation
*
*
* @return {@link AndroidCommandResult}
*/
private AndroidCommandResult getRotation() {
@@ -82,7 +82,7 @@ public class Orientation extends CommandHandler {
/**
* Set the desired rotation
*
*
* @param orientation
* The rotation desired (LANDSCAPE or PORTRAIT)
* @return {@link AndroidCommandResult}
@@ -122,8 +122,6 @@ public class Orientation extends CommandHandler {
return getSuccessResult("Already in portrait mode.");
}
}
// Make sure to un-freeze the device rotation
d.unfreezeRotation();
current = OrientationEnum.fromInteger(d.getDisplayRotation());
if (current != desired) {
return getErrorResult("Set the orientation, but app refused to rotate.");

View File

@@ -12,6 +12,7 @@ var path = require('path')
describeWd('orientation', function(h) {
it('should rotate screen to landscape', function(done) {
h.driver.setOrientation("LANDSCAPE", function(err) {
should.not.exist(err);
var next = function() {
h.driver.getOrientation(function(err, orientation) {
orientation.should.equal("LANDSCAPE");