ya2 · news · projects · code · about

functional tests: testing code
authorFlavio Calva <f.calva@gmail.com>
Mon, 11 Apr 2022 18:03:12 +0000 (19:03 +0100)
committerFlavio Calva <f.calva@gmail.com>
Mon, 11 Apr 2022 18:03:12 +0000 (19:03 +0100)
lib/engine/functional.py
prj.org
tests/functional_ref/main_menu.png [deleted file]
tests/functional_ref/single_player_menu.png [deleted file]
tests/test_functional.py

index 76859f277ed313889b3aac6d3ee5117825c6a8da..9089689deee87288bf5a4ecb47461335b016b875 100644 (file)
@@ -245,12 +245,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
         self._screenshot(FunctionalTest.screenshot_time, 'options_menu_drag_2')
         # fullscreen
         # the first one is because of the windowed mode in test
-        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 240), 'left'])
-        self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
-        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 240), 'left'])
-        self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
-        self._event(8 + FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 240), 'left'])
-        self._screenshot(8 + FunctionalTest.screenshot_time, 'back_from_fullscreen')
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 240), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
+        self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 240), 'left'])
+        self._screenshot(FunctionalTest.screenshot_time, 'fullscreen')
+        self._event(8 + FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 240), 'left'])
+        self._screenshot(8 + FunctionalTest.screenshot_time, 'back_from_fullscreen')
         # resolution
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 330), 'left'])
         self._screenshot(FunctionalTest.screenshot_time, 'resolutions')
         # resolution
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 330), 'left'])
         self._screenshot(FunctionalTest.screenshot_time, 'resolutions')
diff --git a/prj.org b/prj.org
index 1311413357f4d945b65a26fdcf4d5dd6ca1ad16c..c77b7b455b203da51b422dd007acfdf76af0583f 100644 (file)
--- a/prj.org
+++ b/prj.org
@@ -1,42 +1,52 @@
-* issues
-* todo
-** refactoring
-** build pipeline
-*** functional tests
+#+STARTUP: indent
+#+TODO: INBOX BACKLOG READY RED CODE L10N REFACTOR LINT GREEN CHANGELOG BLOG | DONE
+#+CATEGORY: pmachines
+#+TAGS: bug(b) calendar(c) waiting(w)
+
+* build pipeline
+** RED functional tests
     - [X] credits
     - [X] options
     - [X] play
     - [X] save-restore options
     - [X] credits
     - [X] options
     - [X] play
     - [X] save-restore options
-    - [ ] code
+    - [X] code
     - [ ] appimage
     - [ ] flatpak
     - [ ] windows
     - [ ] itchio
     - [ ] versions
     - [ ] appimage
     - [ ] flatpak
     - [ ] windows
     - [ ] itchio
     - [ ] versions
-*** management of error and success (upload builds, itch.io)
-*** crontab
-** fix level 6 to something that can be systematically tested
-** fix level 7 to something that can be systematically tested
-** fix level domino box basketball: it can be solved trivially
-** fix actions: rewind, prev, next
-** version 0.0.yymmdd
-** do intro video with moviepy
-** android build (test with the emulator of android studio)
-** intro animation (from target item to start position)
-** buttons of the scenes enabled sequentially
-*** each scene has a version
-*** when you win save the id + version
-*** put an "update" if id is saved and versions are different
-** teeter-tooter with constraints (real teeter tooter), magnet, road cone, bucket
-** functional tests for performance (frame rate)
-** functional tests for "cleaning" i.e. at the end of the states verify:
-*** active threads
-*** active tasks
-*** current nodepaths (render3d)
-*** current nodepaths (render2d)
-*** current nodepaths (render3d)
-*** current accepting events
-*** current buffers
-*  waiting
-** itch.io's client works with wine: functional tests for windows-itch.io
-* maybe/someday
+** READY management of error and success (upload builds, itch.io)
+** READY crontab
+* READY fix level 6 to something that can be systematically tested      :bug:
+* READY fix level 7 to something that can be systematically tested      :bug:
+* READY fix level domino box basketball: it can be solved trivially     :bug:
+* READY fix actions: rewind, prev, next                                 :bug:
+* READY refactoring
+* BACKLOG version 0.0.yymmdd
+* BACKLOG do intro video with moviepy
+* BACKLOG android build (test with the emulator of android studio)
+* BACKLOG intro animation (from target item to start position)
+* BACKLOG buttons of the scenes enabled sequentially
+- [ ] each scene has a version
+- [ ] when you win save the id + version
+- [ ] put an "update" if id is saved and versions are different
+* BACKLOG teeter-tooter with constraints (real teeter tooter), magnet, road cone, bucket
+* BACKLOG functional tests for performance (frame rate)
+* BACKLOG functional tests for "cleaning" i.e. at the end of the states verify:
+- [ ] active threads
+- [ ] active tasks
+- [ ] current nodepaths (render3d)
+- [ ] current nodepaths (render2d)
+- [ ] current nodepaths (render3d)
+- [ ] current accepting events
+- [ ] current buffers
+* BACKLOG (when itch.io's client waiting works with wine) functional tests for windows-itch.io
+* calendar                                                         :calendar:
+** publish post q1; reschedule
+SCHEDULED: <2024-03-18 Mon +1y>
+** publish post q2; reschedule
+SCHEDULED: <2022-06-18 Sat +1y>
+** publish post q3; reschedule
+SCHEDULED: <2022-09-16 Fri +1y>
+** publish post q4; reschedule
+SCHEDULED: <2022-12-16 Fri +1y>
diff --git a/tests/functional_ref/main_menu.png b/tests/functional_ref/main_menu.png
deleted file mode 100644 (file)
index 204ab77..0000000
Binary files a/tests/functional_ref/main_menu.png and /dev/null differ
diff --git a/tests/functional_ref/single_player_menu.png b/tests/functional_ref/single_player_menu.png
deleted file mode 100644 (file)
index 0b9512d..0000000
Binary files a/tests/functional_ref/single_player_menu.png and /dev/null differ
index 09742cf4b4592c23b9a70e239890e65d49a4376b..00ff6cee3c025606b09263d766784737529084c6 100644 (file)
@@ -70,19 +70,21 @@ class FunctionalTests(TestCase):
         system('amixer sset Master 0%')
         ret = system(cmd)
         self.assertEqual(ret, 0)
         system('amixer sset Master 0%')
         ret = system(cmd)
         self.assertEqual(ret, 0)
-        files = glob('tests/functional_ref/*.png')
+        files = glob(str(Path.home()) + '/.local/share/pmachines/tests/functional_ref_%s/*.png' % _branch())
+        self.assertGreater(len(files), 1)
         for fname in files:
         for fname in files:
-            self.assertTrue(exists(path + basename(fname)))
+            self.assertTrue(exists(path + basename(fname)), '%s does not exist' % (path + basename(fname)))
             self.assertTrue(
                 self.__similar_images(
             self.assertTrue(
                 self.__similar_images(
-                    fname, path + basename(fname)))
-
-    # 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',
-    #         str(Path.home()) + '/.local/share/pmachines/tests/functional/')
+                    str(Path.home()) + '/.local/share/pmachines/tests/functional_ref_%s/' % _branch() + basename(fname),
+                    path + basename(fname)))
+
+    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',
+            str(Path.home()) + '/.local/share/pmachines/tests/functional/')
 
     # def test_appimage(self):
     #     info('test_appimage')
 
     # def test_appimage(self):
     #     info('test_appimage')