ya2 · news · projects · code · about

some fixes for windows testing
[pmachines.git] / lib / tools / functional_test.py
index 09dc608327a43f5c33f26481845ba0870cb14998..e8fd5f7b6da864d22530979fd13e466aa92cee2d 100644 (file)
@@ -31,9 +31,10 @@ class FunctionalTest(GameObject):
     drag_time = 1.0
     start_time = 2
 
-    def __init__(self, idx):
+    def __init__(self, idx, offset):
         super().__init__()
         info('test idx: %s' % idx)
+        self._offset = offset
         sleep(5)
         address = ('localhost', 6000)
         self._conn = Client(address)
@@ -58,7 +59,7 @@ class FunctionalTest(GameObject):
 
     def __mouse_click(self, pos, btn):
         offset_x = int((1920 - 1360) / 2) + 1  # xfce decorations
-        offset_y = int((1080 - 768) / 2) + 24  # xfce decorations
+        offset_y = int((1080 - 768) / 2) + 24 + self._offset  # xfce decorations
         btn = 3 if btn == 'right' else 1
         system('xdotool mousemove %s %s' % (offset_x + pos[0], offset_y + pos[1]))
         def click(task):
@@ -67,7 +68,7 @@ class FunctionalTest(GameObject):
 
     def __mouse_drag(self, start, end, btn):
         offset_x = int((1920 - 1360) / 2) + 1  # xfce decorations
-        offset_y = int((1080 - 768) / 2) + 24  # xfce decorations
+        offset_y = int((1080 - 768) / 2) + 24 + self._offset  # xfce decorations
         btn = 3 if btn == 'right' else 1
         system('xdotool mousemove %s %s' % (offset_x + start[0], offset_y + start[1]))
         def mousedown(task):
@@ -360,7 +361,8 @@ class TestApp(ShowBase):
 
     def __init__(self):
         ShowBase.__init__(self)
-        fun_test = FunctionalTest(int(argv[1]))
+        offset = int(argv[2]) if len(argv) >= 3 else 0
+        fun_test = FunctionalTest(int(argv[1]), offset)
 
 
 TestApp().run()