ya2 · news · projects · code · about

some fixes for building
authorFlavio Calva <f.calva@gmail.com>
Mon, 18 Apr 2022 16:35:37 +0000 (18:35 +0200)
committerFlavio Calva <f.calva@gmail.com>
Mon, 18 Apr 2022 16:35:37 +0000 (18:35 +0200)
lib/engine/functional.py
prj.org
tests/test_functional.py

index 88392fdf44a934681bd814a6c87bfc805373af5c..6dce38cc4a1c8d5dc00250b8cbb6ecbd7b2ba800 100644 (file)
@@ -93,8 +93,15 @@ class FunctionalTest(GameObject):
         dev.keystroke(ord(char))
 
     def __mouse_click(self, pos, btn):
-        base.win.move_pointer(0, pos[0], pos[1])
-        self.__keypress('mouse%s' % (3 if btn == 'right' else 1))
+        #base.win.move_pointer(0, pos[0], pos[1])
+        #self.__keypress('mouse%s' % (3 if btn == 'right' else 1))
+        offset_x = int((1920 - 1360) / 2) + 1  # xfce decorations
+        offset_y = int((1080 - 768) / 2) + 24  # 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):
+            system('xdotool click %s' % btn)
+        taskMgr.do_method_later(.01, click, 'click')
 
     def __mouse_move(self, pos):
         center = base.pipe.get_display_width() / 2, \
@@ -103,16 +110,29 @@ class FunctionalTest(GameObject):
         system('xdotool mousemove %s %s' % tgt)
 
     def __mouse_drag(self, start, end, btn):
-        btn = 'mouse%s' % (3 if btn == 'right' else 1)
-        dev = base.win.get_input_device(0)
-        base.win.move_pointer(0, start[0], start[1])
-        dev.buttonDown(btn)
-        def drop(task):
-            base.win.move_pointer(0, end[0], end[1])
-            def drop_up(task):
-                dev.button_up(btn)
-            taskMgr.do_method_later(.01, drop_up, 'drop_up')
-        taskMgr.do_method_later(.01, drop, 'drop')
+        # btn = 'mouse%s' % (3 if btn == 'right' else 1)
+        # dev = base.win.get_input_device(0)
+        # base.win.move_pointer(0, start[0], start[1])
+        # dev.buttonDown(btn)
+        # def drop(task):
+        #     base.win.move_pointer(0, end[0], end[1])
+        #     def drop_up(task):
+        #         dev.button_up(btn)
+        #     taskMgr.do_method_later(.01, drop_up, 'drop_up')
+        # taskMgr.do_method_later(.01, drop, 'drop')
+        offset_x = int((1920 - 1360) / 2) + 1  # xfce decorations
+        offset_y = int((1080 - 768) / 2) + 24  # 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):
+            system('xdotool mousedown %s' % btn)
+            def mousemove(task):
+                system('xdotool mousemove %s %s' % (offset_x + end[0], offset_y + end[1]))
+                def mouseup(task):
+                    system('xdotool mouseup %s' % btn)
+                taskMgr.do_method_later(.01, mouseup, 'mouseup')
+            taskMgr.do_method_later(.01, mousemove, 'mousemove')
+        taskMgr.do_method_later(.01, mousedown, 'mousedown')
 
     def _event(self, time, evt, messenger_evt=False, append_up=True, mouse_args=None):
         def _append_up(evt_name):
diff --git a/prj.org b/prj.org
index fd149f6bae67961ff48cdb08b68fb09716eca2aa..1dbc14c975ed103c52ca51b23a5a296b01898b01 100644 (file)
--- a/prj.org
+++ b/prj.org
@@ -3,8 +3,7 @@
 #+CATEGORY: pmachines
 #+TAGS: bug(b) calendar(c) waiting(w)
 
-* RED manylinux2010 in appimage and flatpak
-* READY messenger.send('force_win') and messenger.send('force_fail')
+* RED messenger.send('force_win') and messenger.send('force_fail')
 * READY restore test resolutions
 * READY restore test fullscreen
 * READY fix actions: rewind, prev, next                                 :bug:
index c4fa328b406a1480392876bfccea2a685f48b840..088b5a97d58622b61d6e894d574fe94a097acd2d 100644 (file)
@@ -89,8 +89,8 @@ class FunctionalTests(TestCase):
     def test_code(self):
         info('test_code')
         self.__test_template(
-            '~/venv/bin/python main.py --functional-test 1 ; '
-            '~/venv/bin/python main.py --functional-test 2',
+            'timeout 720s ~/venv/bin/python main.py --functional-test 1 ; '
+            'timeout 720s ~/venv/bin/python main.py --functional-test 2',
             str(Path.home()) + '/.local/share/pmachines/tests/functional/')
 
     def test_appimage(self):
@@ -98,8 +98,8 @@ class FunctionalTests(TestCase):
         bld_branch = {'master': 'alpha', 'rc': 'rc', 'stable': 'stable'}[_branch()]
         bld_branch = '' if bld_branch == 'stable' else ('-' + bld_branch)
         self.__test_template(
-            './dist/Pmachines%s-x86_64.AppImage --functional-test 1 ;'
-            './dist/Pmachines%s-x86_64.AppImage --functional-test 2' % (bld_branch, bld_branch),
+            'timeout 720s ./dist/Pmachines%s-x86_64.AppImage --functional-test 1 ;'
+            'timeout 720s ./dist/Pmachines%s-x86_64.AppImage --functional-test 2' % (bld_branch, bld_branch),
             str(Path.home()) + '/.local/share/pmachines/tests/functional/')
 
     # def test_flatpak(self):
@@ -112,8 +112,8 @@ class FunctionalTests(TestCase):
     #     system(cmd)
     #     info('executed: %s' % cmd)
     #     self.__test_template(
-    #         'flatpak run it.ya2.Pmachines//%s --functional-test 1 ;'
-    #         'flatpak run it.ya2.Pmachines//%s --functional-test 2' % (bld_branch, bld_branch),
+    #         'timeout 720s flatpak run it.ya2.Pmachines//%s --functional-test 1 ;'
+    #         'timeout 720s flatpak run it.ya2.Pmachines//%s --functional-test 2' % (bld_branch, bld_branch),
     #         str(Path.home()) + '/.var/app/it.ya2.Pmachines/data/pmachines/tests/functional/')
 
     # def __update_itchio(self):
@@ -133,8 +133,8 @@ class FunctionalTests(TestCase):
     #         return
     #     self.__update_itchio()
     #     self.__test_template(
-    #         '/home/flavio/.config/itch/apps/pmachines/pmachines --functional-test 1 ;'
-    #         '/home/flavio/.config/itch/apps/pmachines/pmachines --functional-test 2',
+    #         'timeout 720s /home/flavio/.config/itch/apps/pmachines/pmachines --functional-test 1 ;'
+    #         'timeout 720s /home/flavio/.config/itch/apps/pmachines/pmachines --functional-test 2',
     #         str(Path.home()) + '/.local/share/pmachines/tests/functional/')
 
     # def test_windows(self):
@@ -162,15 +162,15 @@ class FunctionalTests(TestCase):
                 _ver = fver.read().strip() + '-'
         exp = '%s-%s' % (_ver, commit)
         cmds = [
-            ('./build/manylinux2010_x86_64/pmachines --version', str(Filename.get_user_appdata_directory()) + '/pmachines/obs_version.txt'),
-            ('./dist/Pmachines-%s-x86_64.AppImage --version' % bld_branch, str(Filename.get_user_appdata_directory()) + '/pmachines/obs_version.txt'),
+            ('timeout 720s ./build/manylinux2010_x86_64/pmachines --version', str(Filename.get_user_appdata_directory()) + '/pmachines/obs_version.txt'),
+            ('timeout 720s ./dist/Pmachines-%s-x86_64.AppImage --version' % bld_branch, str(Filename.get_user_appdata_directory()) + '/pmachines/obs_version.txt'),
             #('timeout 720s wine ./build/win_amd64/pmachines.exe --version', '/home/flavio/.wine/drive_c/users/flavio/AppData/Local/pmachines/obs_version.txt')
             ]
         #if environ.get('FUNCTIONALPOST') == '1':
         #    if _branch() == 'master':
         #        self.__update_itchio()
-        #        cmds += [('/home/flavio/.config/itch/apps/pmachines/pmachines --version', str(Filename.get_user_appdata_directory()) + '/pmachines/obs_version.txt')]
-        #    cmds += [('flatpak run it.ya2.Pmachines//%s --version' % bld_branch, '/home/flavio/.var/app/it.ya2.Pmachines/data/pmachines/obs_version.txt')]
+        #        cmds += [('timeout 720s /home/flavio/.config/itch/apps/pmachines/pmachines --version', str(Filename.get_user_appdata_directory()) + '/pmachines/obs_version.txt')]
+        #    cmds += [('timeout 720s flatpak run it.ya2.Pmachines//%s --version' % bld_branch, '/home/flavio/.var/app/it.ya2.Pmachines/data/pmachines/obs_version.txt')]
         system('flatpak update -y it.ya2.Pmachines//%s' % bld_branch)
         for cmd in cmds:
             if exists(cmd[1]):