ya2 · news · projects · code · about

functional tests: options
authorFlavio Calva <f.calva@gmail.com>
Tue, 22 Mar 2022 17:49:03 +0000 (18:49 +0100)
committerFlavio Calva <f.calva@gmail.com>
Tue, 22 Mar 2022 17:49:03 +0000 (18:49 +0100)
game/app.py
lib/engine/functional.py
prj.org

index f3fa8737343941d2858d9690432a2c35b0cf2ad5..6ca298fee0a52d2ced7046b20c58630ec4295683 100755 (executable)
@@ -129,6 +129,9 @@ class PmachinesApp:
         load_prc_file_data('', 'window-title pmachines')
         load_prc_file_data('', 'framebuffer-srgb true')
         load_prc_file_data('', 'sync-video true')
+        if args.functional_test or args.functional_ref:
+            load_prc_file_data('', 'win-size 1280 720')
+            # otherwise it is not centered in exwm
         # load_prc_file_data('', 'threading-model Cull/Draw')
         # it freezes when you go to the next scene
         if args.screenshot:
@@ -198,11 +201,11 @@ class PmachinesApp:
                 _res(idx) for idx in range(d_i.get_total_display_modes())]
             res = sorted(resolutions)[-1]
         fullscreen = self._options['settings']['fullscreen']
+        props = WindowProperties()
         if args.functional_test or args.functional_ref:
-            res = 1280, 720
             fullscreen = False
-        props = WindowProperties()
-        props.set_size(res)
+        else:
+            props.set_size(res)
         props.set_fullscreen(fullscreen)
         props.set_icon_filename('assets/images/icon/pmachines.ico')
         if not args.screenshot:
index 8c1f01916d8a82a181cd48146c8eb33be60014ce..87211b8011124c9aadf09f9bb07a12f8f87b6a5e 100644 (file)
@@ -23,7 +23,7 @@ class FunctionalTest(GameObject):
 
     screenshot_time = 1.2
     evt_time = 1.0
-    start_time = 5
+    start_time = 2
 
     def __init__(self, idx, ref):
         super().__init__()
@@ -176,7 +176,7 @@ class FunctionalTest(GameObject):
         info('_do_screenshots_1')
         self._screenshot(FunctionalTest.start_time, 'main_menu')
         self._do_screenshots_credits()
-        self._do_screenshots_options()
+        self._do_screenshots_options()
         self._do_screenshots_exit()
 
     def _do_screenshots_credits(self):
@@ -203,7 +203,55 @@ class FunctionalTest(GameObject):
         # self._event(FunctionalTest.evt_time, 'arrow_up')
         # self._event(FunctionalTest.evt_time, 'arrow_up')
 
-    # def _do_screenshots_options(self):
+    def _do_screenshots_options(self):
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, -80), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'options_menu')
+        # languages
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, -300), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'open_languages_1')
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(280, -324), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'options_menu_english')
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, -300), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'open_languages_2')
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(280, -240), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'options_menu_italian')
+        # volume
+        self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(44, -207), (67, -207), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'options_menu_drag_1')
+        self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(67, -207), (44, -207), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'options_menu_drag_2')
+        # fullscreen
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, -120), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
+        self._event(8 + FunctionalTest.evt_time, 'mouseclick', False, False, [(-320, -300), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'back_from_fullscreen')
+        # resolution
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, -24), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'resolutions')
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(314, 116), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, '1440x900')
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(98, 47), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'resolutions_2')
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(478, 59), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, '1280x720')
+        # antialiasing
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(12, 62), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'antialiasing_no')
+        # shadows
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(12, 145), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'shadows_no')
+        # test aa and shadows
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, 270), 'left'])  # back
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, -230), 'left'])  # play
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(-430, -210), 'left'])  # domino
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(200, 100), 'left'])  # close instructions
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(-620, 336), 'left'])  # home
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, -80), 'left'])  # options
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(12, 62), 'left'])  # aa
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(12, 145), 'left'])  # shadows
+        self._screenshot(FunctionalTest.screenshot_time, 'aa_no_shadows_no')
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(0, 270), 'left'])  # back
+
     #     # go to options
     #     self._event(FunctionalTest.evt_time, 'arrow_down')
     #     self._event(FunctionalTest.evt_time, 'arrow_down')
diff --git a/prj.org b/prj.org
index 03b8cf01fa66af9772ad2366b7224005398f20c2..9b7924c0a17fbf18c1bbfcfcdf9de798e249d6f8 100644 (file)
--- a/prj.org
+++ b/prj.org
@@ -4,7 +4,7 @@
 ** build pipeline
 *** functional tests
     - [X] credits
-    - [ ] options
+    - [X] options
     - [ ] play
     - [ ] code
     - [ ] appimage