ya2 · news · projects · code · about

fullscreen test
authorFlavio Calva <f.calva@gmail.com>
Mon, 16 May 2022 18:21:15 +0000 (19:21 +0100)
committerFlavio Calva <f.calva@gmail.com>
Mon, 16 May 2022 18:21:15 +0000 (19:21 +0100)
game/app.py
game/menu.py
lib/tools/functional_test.py

index 03ca82451abbbc2f5c892e7e45319eb6303860a5..88c9216359916195b82ddd0ec841b876d9fac9e7 100755 (executable)
@@ -65,7 +65,7 @@ class PmachinesApp:
     def __init__(self):
         info('platform: %s' % platform)
         info('exists main.py: %s' % exists('main.py'))
-        args = self._parse_args()
+        self._args = args = self._parse_args()
         self._configure(args)
         self.base = ShowBase()
         self._pipeline = None
@@ -104,7 +104,7 @@ class PmachinesApp:
         self._menu_bg = Background()
         self._menu = Menu(
             self._fsm, self.lang_mgr, self._options, self._music,
-            self._pipeline, self.scenes)
+            self._pipeline, self.scenes, self._args.functional_test or self._args.functional_ref)
 
     def on_home(self):
         self._fsm.demand('Menu')
index 4c64272bc9dbc855d57c6b7b0d142599f75ca98b..919bcc5246aa3c97935a899d42d7f33dc50b8823 100644 (file)
@@ -18,13 +18,14 @@ from panda3d.bullet import BulletWorld
 
 class Menu:
 
-    def __init__(self, fsm, lang_mgr, opt_file, music, pipeline, scenes):
+    def __init__(self, fsm, lang_mgr, opt_file, music, pipeline, scenes, fun_test):
         self._fsm = fsm
         self._lang_mgr = lang_mgr
         self._opt_file = opt_file
         self._music = music
         self._pipeline = pipeline
         self._scenes = scenes
+        self._fun_test = fun_test
         self._cursor = MouseCursor(
             'assets/images/buttons/arrowUpLeft.dds', (.04, 1, .04), (.5, .5, .5, 1),
             (.01, .01))
@@ -241,7 +242,12 @@ class Menu:
     def on_fullscreen(self, arg):
         props = WindowProperties()
         props.set_fullscreen(arg)
-        base.win.request_properties(props)
+        if not self._fun_test:
+            base.win.request_properties(props)
+            # if we actually switch to fullscreen during the tests then
+            # exwm inside qemu can't restore the correct resolution
+            # i may re-enable this if/when i run the tests onto a
+            # physical machine
         self._opt_file['settings']['fullscreen'] = int(arg)
         self._opt_file.store()
 
index 0e2cefeeb8db8793386e0bc4a1e1e632449a923b..50323a5cf592b9a4a51fa3ba477cfd633b87c823 100644 (file)
@@ -182,13 +182,12 @@ class FunctionalTest(GameObject):
         self._screenshot(FunctionalTest.screenshot_time, 'options_menu_drag_2')
         # fullscreen
         # the first one is because of the windowed mode in test
-        # it does not work with ffmpeg recording
-        # self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left'])
-        # self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
-        # self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left'])
-        # self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
-        # self._event(8 + FunctionalTest.evt_time, 'mouseclick', [(440, 120), 'left'])
-        # self._screenshot(8 + FunctionalTest.screenshot_time, 'back_from_fullscreen')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
+        self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 250), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
+        self._event(8 + FunctionalTest.evt_time, 'mouseclick', [(440, 120), 'left'])
+        self._screenshot(8 + FunctionalTest.screenshot_time, 'back_from_fullscreen')
         # resolution
         self._event(FunctionalTest.evt_time, 'mouseclick', [(680, 340), 'left'])
         self._screenshot(FunctionalTest.screenshot_time, 'resolutions')