Bug 1348145 - Remove getWindowPosition/setWindowPosition. r?whimboo draft
authorVenkatesh Pitta <venkateshpitta@gmail.com>
Fri, 13 Apr 2018 11:38:48 +1000
changeset 781511 4b796aba9000f16cb4fc79e9dfb12647dd751a48
parent 780902 ac49f2b3137a0d1703f4725d56c41fba9d57d799
child 781512 180ff9c1634cb933bd80b3834faf54122912f709
push id106323
push userbmo:venkateshpitta@gmail.com
push dateFri, 13 Apr 2018 02:04:11 +0000
reviewerswhimboo
bugs1348145
milestone61.0a1
Bug 1348145 - Remove getWindowPosition/setWindowPosition. r?whimboo MozReview-Commit-ID: 4DZr9Ey44dW
testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py
@@ -27,19 +27,22 @@ class TestPosition(MarionetteTestCase):
         self.assertIn("height", position)
         self.assertIn("width", position)
         self.assertIsInstance(position["x"], int)
         self.assertIsInstance(position["y"], int)
         self.assertIsInstance(position["height"], int)
         self.assertIsInstance(position["width"], int)
 
     def test_set_types(self):
-        for x, y, h, w in (["a", "b", "h", "w"], [1.2, 3.4, 4.5, 5.6],
-                           [True, False, True, False], [[], [], [], []],
-                           [{}, {}, {}, {}]):
+        illegal_rects = (["a", "b", "h", "w"], 
+                         [1.2, 3.4, 4.5, 5.6],
+                         [True, False, True, False],
+                         [[], [], [], []],
+                         [{}, {}, {}, {}])
+        for x, y, h, w in illegal_rects:
             print("testing invalid type position ({},{})".format(x, y))
             with self.assertRaises(InvalidArgumentException):
                 self.marionette.set_window_rect(x, y, h, w)
 
     def test_setting_window_rect_with_nulls_errors(self):
         with self.assertRaises(InvalidArgumentException):
             self.marionette.set_window_rect(height=None, width=None,
                                             x=None, y=None)
@@ -54,35 +57,37 @@ class TestPosition(MarionetteTestCase):
         self.assertNotEqual(old_position["y"], new_position["y"])
 
     def test_move_to_new_position(self):
         old_position = self.marionette.window_rect
         new_position = {"x": old_position["x"] + 10, "y": old_position["y"] + 10}
         self.marionette.set_window_rect(new_position["x"], new_position["y"])
         self.assertNotEqual(old_position["x"], new_position["x"])
         self.assertNotEqual(old_position["y"], new_position["y"])
+        self.assertEqual(old_position["height"], new_position["height"])
+        self.assertEqual(old_position["width"], new_position["width"])
 
     def test_move_to_existing_position(self):
         old_position = self.marionette.window_rect
         self.marionette.set_window_rect(old_position["x"], old_position["y"],
                                         old_position["height"], old_position["width"])
         new_position = self.marionette.window_rect
         self.assertEqual(old_position["x"], new_position["x"])
         self.assertEqual(old_position["y"], new_position["y"])
         self.assertEqual(old_position["height"], new_position["height"])
         self.assertEqual(old_position["width"], new_position["width"])
 
     def test_move_to_negative_coordinates(self):
-        dims = self.marionette.window_rect
+        old_position = self.marionette.window_rect
         print("Current position: {}".format(
-            dims["x"], dims["y"]))
+            old_position["x"], old_position["y"]))
         self.marionette.set_window_rect(-8, -8)
         position = self.marionette.window_rect
         print("Position after requesting move to negative coordinates: {}, {}"
-              .format(position))
+              .format(old_position["x"], old_position["y"]))
 
         # Different systems will report more or less than (-8,-8)
         # depending on the characteristics of the window manager, since
         # the screenX/screenY position measures the chrome boundaries,
         # including any WM decorations.
         #
         # This makes this hard to reliably test across different
         # environments.  Generally we are happy when calling