ya2 · news · projects · code · about

functional tests: versions
authorFlavio Calva <f.calva@gmail.com>
Fri, 15 Apr 2022 18:29:37 +0000 (20:29 +0200)
committerFlavio Calva <f.calva@gmail.com>
Fri, 15 Apr 2022 18:29:37 +0000 (20:29 +0200)
assets/locale/po/it_IT.po
game/app.py
lib/build/build.py
lib/engine/functional.py
lib/engine/log.py
lib/lib/p3d/gfx.py
prj.org
tests/lib/build/test_lang.py
tests/test_functional.py

index 1018f25c1aec212d1b46668e538b6355f4e816f1..d70369e25bc708656c6f78f02a530f6e9a382649 100644 (file)
@@ -17,61 +17,73 @@ msgstr ""
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: pmachines/menu.py:71
+#: lib/engine/gui/page.py:188
+msgid "Quit"
+msgstr "Esci"
+
+#: lib/engine/gui/page.py:188 game/menu.py:147 game/menu.py:169
+#: game/menu.py:197
+msgid "Back"
+msgstr "Indietro"
+
+#: lib/engine/gui/mainpage.py:34
+msgid "version: "
+msgstr "versione: "
+
+#: lib/engine/gui/mainpage.py:41
+msgid "made with heart with panda3d, panda3d-simplepbr, panda3d-gltf"
+msgstr "fatto col cuore con panda3d, panda3d-simplepbr, panda3d-gltf"
+
+#: game/menu.py:72
 msgid "Play"
 msgstr "Gioca"
 
 msgid "Play"
 msgstr "Gioca"
 
-#: pmachines/menu.py:74
+#: game/menu.py:75
 msgid "Options"
 msgstr "Opzioni"
 
 msgid "Options"
 msgstr "Opzioni"
 
-#: pmachines/menu.py:77
+#: game/menu.py:78
 msgid "Credits"
 msgstr "Riconoscimenti"
 
 msgid "Credits"
 msgstr "Riconoscimenti"
 
-#: pmachines/menu.py:80
+#: game/menu.py:81
 msgid "Exit"
 msgstr "Esci"
 
 msgid "Exit"
 msgstr "Esci"
 
-#: pmachines/menu.py:86 pmachines/menu.py:89 pmachines/menu.py:237
+#: game/menu.py:87 game/menu.py:90 game/menu.py:230
 msgid "English"
 msgstr "Inglese"
 
 msgid "English"
 msgstr "Inglese"
 
-#: pmachines/menu.py:86 pmachines/menu.py:90 pmachines/menu.py:238
+#: game/menu.py:87 game/menu.py:91 game/menu.py:231
 msgid "Italian"
 msgstr "Italiano"
 
 msgid "Italian"
 msgstr "Italiano"
 
-#: pmachines/menu.py:93
+#: game/menu.py:94
 msgid "Language"
 msgstr "Linguaggio"
 
 msgid "Language"
 msgstr "Linguaggio"
 
-#: pmachines/menu.py:99
+#: game/menu.py:100
 msgid "Volume"
 msgstr ""
 
 msgid "Volume"
 msgstr ""
 
-#: pmachines/menu.py:109
+#: game/menu.py:110
 msgid "Fullscreen"
 msgstr ""
 
 msgid "Fullscreen"
 msgstr ""
 
-#: pmachines/menu.py:128
+#: game/menu.py:129
 msgid "Resolution"
 msgstr ""
 
 msgid "Resolution"
 msgstr ""
 
-#: pmachines/menu.py:134
+#: game/menu.py:135
 #, fuzzy
 msgid "Antialiasing"
 msgstr "Italiano"
 
 #, fuzzy
 msgid "Antialiasing"
 msgstr "Italiano"
 
-#: pmachines/menu.py:140
+#: game/menu.py:141
 msgid "Shadows"
 msgstr ""
 
 msgid "Shadows"
 msgstr ""
 
-#: pmachines/menu.py:146 pmachines/menu.py:168 pmachines/menu.py:204
-#: lib/engine/gui/page.py:188
-msgid "Back"
-msgstr "Indietro"
-
-#: pmachines/menu.py:155
+#: game/menu.py:156
 msgid ""
 "Code and gfx\n"
 "  \ 1scale\ 1Flavio Calva\ 2\n"
 msgid ""
 "Code and gfx\n"
 "  \ 1scale\ 1Flavio Calva\ 2\n"
@@ -81,11 +93,11 @@ msgid ""
 "  \ 1scale\ 1Stefan Grossmann\ 2"
 msgstr ""
 
 "  \ 1scale\ 1Stefan Grossmann\ 2"
 msgstr ""
 
-#: pmachines/menu.py:160
+#: game/menu.py:161
 msgid "Website"
 msgstr ""
 
 msgid "Website"
 msgstr ""
 
-#: pmachines/menu.py:163
+#: game/menu.py:164
 msgid ""
 "Special thanks to:\n"
 "  \ 1scale\ 1rdb\ 2\n"
 msgid ""
 "Special thanks to:\n"
 "  \ 1scale\ 1rdb\ 2\n"
@@ -93,39 +105,37 @@ msgid ""
 "  \ 1scale\ 1Damiana Ercolani\ 2"
 msgstr ""
 
 "  \ 1scale\ 1Damiana Ercolani\ 2"
 msgstr ""
 
-#: pmachines/scene.py:429
+#: game/scene.py:433
 msgid "You win!"
 msgstr ""
 
 msgid "You win!"
 msgstr ""
 
-#: pmachines/scene.py:506
+#: game/scene.py:502
 msgid "You have failed!"
 msgstr ""
 
 msgid "You have failed!"
 msgstr ""
 
-#: pmachines/scenes/scene_domino.py:15
+#: game/scenes/scene_domino.py:13
 msgid "Domino"
 msgstr ""
 
 msgid "Domino"
 msgstr ""
 
-#: pmachines/scenes/scene_domino.py:38 pmachines/scenes/scene_box.py:38
-#: pmachines/scenes/scene_domino_box.py:51
-#: pmachines/scenes/scene_basketball.py:54
-#: pmachines/scenes/scene_domino_box_basketball.py:40
-#: pmachines/scenes/scene_teeter_tooter.py:41
-#: pmachines/scenes/scene_teeter_domino_box_basketball.py:50
+#: game/scenes/scene_domino.py:36 game/scenes/scene_box.py:36
+#: game/scenes/scene_domino_box.py:49 game/scenes/scene_basketball.py:52
+#: game/scenes/scene_domino_box_basketball.py:38
+#: game/scenes/scene_teeter_tooter.py:39
+#: game/scenes/scene_teeter_domino_box_basketball.py:48
 msgid "Scene: "
 msgstr ""
 
 msgid "Scene: "
 msgstr ""
 
-#: pmachines/scenes/scene_domino.py:39
+#: game/scenes/scene_domino.py:37
 msgid ""
 "Goal: every domino piece must fall\n"
 "\n"
 msgstr ""
 
 msgid ""
 "Goal: every domino piece must fall\n"
 "\n"
 msgstr ""
 
-#: pmachines/scenes/scene_domino.py:40 pmachines/scenes/scene_box.py:40
-#: pmachines/scenes/scene_domino_box.py:53
-#: pmachines/scenes/scene_basketball.py:56
-#: pmachines/scenes/scene_domino_box_basketball.py:42
-#: pmachines/scenes/scene_teeter_tooter.py:43
-#: pmachines/scenes/scene_teeter_domino_box_basketball.py:52
+#: game/scenes/scene_domino.py:38 game/scenes/scene_box.py:38
+#: game/scenes/scene_domino_box.py:51 game/scenes/scene_basketball.py:54
+#: game/scenes/scene_domino_box_basketball.py:40
+#: game/scenes/scene_teeter_tooter.py:41
+#: game/scenes/scene_teeter_domino_box_basketball.py:50
 msgid ""
 "keep \ 5mouse_l\ 5 pressed to drag an item\n"
 "\n"
 msgid ""
 "keep \ 5mouse_l\ 5 pressed to drag an item\n"
 "\n"
@@ -135,67 +145,54 @@ msgstr ""
 "\n"
 "tieni premuto \ 5mouse_r\ 5 per ruotare un oggetto"
 
 "\n"
 "tieni premuto \ 5mouse_r\ 5 per ruotare un oggetto"
 
-#: pmachines/scenes/scene_box.py:15
+#: game/scenes/scene_box.py:13
 msgid "Box"
 msgstr ""
 
 msgid "Box"
 msgstr ""
 
-#: pmachines/scenes/scene_box.py:39
+#: game/scenes/scene_box.py:37
 msgid ""
 "Goal: the left box must hit the right box\n"
 "\n"
 msgstr ""
 
 msgid ""
 "Goal: the left box must hit the right box\n"
 "\n"
 msgstr ""
 
-#: pmachines/scenes/scene_domino_box.py:15
+#: game/scenes/scene_domino_box.py:13
 msgid "Domino and box"
 msgstr ""
 
 msgid "Domino and box"
 msgstr ""
 
-#: pmachines/scenes/scene_domino_box.py:52
+#: game/scenes/scene_domino_box.py:50
 msgid ""
 "Goal: only the last piece of each row must be up\n"
 "\n"
 msgstr ""
 
 msgid ""
 "Goal: only the last piece of each row must be up\n"
 "\n"
 msgstr ""
 
-#: pmachines/scenes/scene_basketball.py:15
+#: game/scenes/scene_basketball.py:13
 msgid "Basket ball"
 msgstr ""
 
 msgid "Basket ball"
 msgstr ""
 
-#: pmachines/scenes/scene_basketball.py:55
-#: pmachines/scenes/scene_teeter_tooter.py:42
+#: game/scenes/scene_basketball.py:53 game/scenes/scene_teeter_tooter.py:40
 msgid ""
 "Goal: you must hit every domino piece\n"
 "\n"
 msgstr ""
 
 msgid ""
 "Goal: you must hit every domino piece\n"
 "\n"
 msgstr ""
 
-#: pmachines/scenes/scene_domino_box_basketball.py:15
+#: game/scenes/scene_domino_box_basketball.py:13
 msgid "Domino, box and basket ball"
 msgstr ""
 
 msgid "Domino, box and basket ball"
 msgstr ""
 
-#: pmachines/scenes/scene_domino_box_basketball.py:41
-#: pmachines/scenes/scene_teeter_domino_box_basketball.py:51
+#: game/scenes/scene_domino_box_basketball.py:39
+#: game/scenes/scene_teeter_domino_box_basketball.py:49
 msgid ""
 "Goal: every domino piece must be hit\n"
 "\n"
 msgstr ""
 
 msgid ""
 "Goal: every domino piece must be hit\n"
 "\n"
 msgstr ""
 
-#: pmachines/scenes/scene_teeter_tooter.py:15
+#: game/scenes/scene_teeter_tooter.py:13
 msgid "Teeter tooter"
 msgstr ""
 
 msgid "Teeter tooter"
 msgstr ""
 
-#: pmachines/scenes/scene_teeter_domino_box_basketball.py:15
+#: game/scenes/scene_teeter_domino_box_basketball.py:13
 msgid "Teeter tooter, domino, box and basket ball"
 msgstr ""
 
 msgid "Teeter tooter, domino, box and basket ball"
 msgstr ""
 
-#: lib/engine/gui/page.py:188
-msgid "Quit"
-msgstr "Esci"
-
-#: lib/engine/gui/mainpage.py:34
-msgid "version: "
-msgstr "versione: "
-
-#: lib/engine/gui/mainpage.py:41
-msgid "made with heart with panda3d, panda3d-simplepbr, panda3d-gltf"
-msgstr "fatto col cuore con panda3d, panda3d-simplepbr, panda3d-gltf"
-
 #~ msgid "Support us"
 #~ msgstr "Supportaci"
 #~ msgid "Support us"
 #~ msgstr "Supportaci"
index 0875be4bdac52d9fd8c9f9e7205605a20b05fbae..5015b8c3ffb47e30f82f28257b80f165fbeec5e0 100755 (executable)
@@ -28,6 +28,7 @@ from game.scenes.scene_teeter_tooter import SceneTeeterTooter
 from lib.dictfile import DctFile
 from lib.lib.p3d.p3d import LibP3d
 from lib.engine.lang import LangMgr
 from lib.dictfile import DctFile
 from lib.lib.p3d.p3d import LibP3d
 from lib.engine.lang import LangMgr
+from lib.engine.log import LogMgr
 from lib.engine.functional import FunctionalTest
 
 
 from lib.engine.functional import FunctionalTest
 
 
@@ -67,9 +68,11 @@ class PmachinesApp:
         args = self._parse_args()
         self._configure(args)
         self.base = ShowBase()
         args = self._parse_args()
         self._configure(args)
         self.base = ShowBase()
-        self._prepare_window(args)
+        self._pipeline = None
         self.updating = args.update
         self.version = args.version
         self.updating = args.update
         self.version = args.version
+        self.log_mgr = LogMgr.init_cls()(self)
+        self._prepare_window(args)
         if args.update:
             return
         if args.functional_test and int(args.functional_test) == 1:
         if args.update:
             return
         if args.functional_test and int(args.functional_test) == 1:
@@ -210,10 +213,10 @@ class PmachinesApp:
             props.set_size(res)
         props.set_fullscreen(fullscreen)
         props.set_icon_filename('assets/images/icon/pmachines.ico')
             props.set_size(res)
         props.set_fullscreen(fullscreen)
         props.set_icon_filename('assets/images/icon/pmachines.ico')
-        if not args.screenshot:
+        if not args.screenshot and not self.version:
             base.win.request_properties(props)
         #gltf.patch_loader(base.loader)
             base.win.request_properties(props)
         #gltf.patch_loader(base.loader)
-        if self._options['development']['simplepbr']:
+        if self._options['development']['simplepbr'] and not self.version:
             self._pipeline = simplepbr.init(
                 use_normal_maps=True,
                 use_emission_maps=False,
             self._pipeline = simplepbr.init(
                 use_normal_maps=True,
                 use_emission_maps=False,
index 6170b4f50a696e77f12bcc37e9e0051ae76bf507..d424c792cab8575cab785793b4f9364982b088f2 100644 (file)
@@ -27,7 +27,7 @@ def _branch():
     root = str(Path(dirname(dirname(__file__))).parent) + '/'
     if 'itch' in __file__.split(sep):
         root = str(Path(dirname(__file__))) + '/'
     root = str(Path(dirname(dirname(__file__))).parent) + '/'
     if 'itch' in __file__.split(sep):
         root = str(Path(dirname(__file__))) + '/'
-    if __file__ == '/app/bin/yocto':  # flatpak
+    if __file__ == '/app/bin/pmachines':  # flatpak
         root = '/app/bin/'
     for branch in branches:
         try:
         root = '/app/bin/'
     for branch in branches:
         try:
@@ -43,7 +43,7 @@ def _version():
     '''Computes the version of the current build.'''
     day = strftime('%y%m%d')
     root = str(Path(dirname(dirname(__file__))).parent) + '/'
     '''Computes the version of the current build.'''
     day = strftime('%y%m%d')
     root = str(Path(dirname(dirname(__file__))).parent) + '/'
-    if __file__ == '/app/bin/yocto':  # flatpak
+    if __file__ == '/app/bin/pmachines':  # flatpak
         root = '/app/bin/'
     if _branch() == 'stable':
         pref, _ver = '', ''
         root = '/app/bin/'
     if _branch() == 'stable':
         pref, _ver = '', ''
index 9089689deee87288bf5a4ecb47461335b016b875..ee6653abcb4f4f520d183c8dcc1fb8991c093ad2 100644 (file)
@@ -321,7 +321,7 @@ class FunctionalTest(GameObject):
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 50), (525, 350), 'left'])  # drag a piece
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 510), (670, 350), 'left'])  # drag a piece
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 50), (525, 350), 'left'])  # drag a piece
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 510), (670, 350), 'left'])  # drag a piece
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-        self._screenshot(10 + FunctionalTest.screenshot_time, 'fail_domino')
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino')
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(590, 420), 'left'])  # home
         self._screenshot(FunctionalTest.screenshot_time, 'home_back_from_fail')
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 130), 'left'])  # play
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(590, 420), 'left'])  # home
         self._screenshot(FunctionalTest.screenshot_time, 'home_back_from_fail')
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 130), 'left'])  # play
@@ -330,13 +330,13 @@ class FunctionalTest(GameObject):
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 50), (525, 350), 'left'])  # drag a piece
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 50), (670, 350), 'left'])  # drag a piece
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 50), (525, 350), 'left'])  # drag a piece
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 50), (670, 350), 'left'])  # drag a piece
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-        self._screenshot(10 + FunctionalTest.screenshot_time, 'fail_domino_2')
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino_2')
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left'])  # replay
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 50), (540, 140), 'left'])  # drag a piece
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(540, 130), (600, 130), 'right'])  # rotate the piece
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 50), (665, 355), 'left'])  # drag a piece
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left'])  # replay
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 50), (540, 140), 'left'])  # drag a piece
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(540, 130), (600, 130), 'right'])  # rotate the piece
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 50), (665, 355), 'left'])  # drag a piece
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-        self._screenshot(10 + FunctionalTest.screenshot_time, 'win_domino')
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'win_domino')
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(690, 420), 'left'])  # next
         self._screenshot(FunctionalTest.screenshot_time, 'scene_box')
         # scene 2
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(690, 420), 'left'])  # next
         self._screenshot(FunctionalTest.screenshot_time, 'scene_box')
         # scene 2
@@ -344,13 +344,13 @@ class FunctionalTest(GameObject):
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (660, 585), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (660, 515), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (660, 585), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (660, 515), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-        self._screenshot(10 + FunctionalTest.screenshot_time, 'fail_box')
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_box')
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left'])  # replay
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (660, 585), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (660, 515), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (660, 430), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left'])  # replay
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (660, 585), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (660, 515), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (660, 430), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-        self._screenshot(10 + FunctionalTest.screenshot_time, 'win_box')
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'win_box')
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(690, 420), 'left'])  # next
         self._screenshot(FunctionalTest.screenshot_time, 'scene_box_domino')
         # scene 3
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(690, 420), 'left'])  # next
         self._screenshot(FunctionalTest.screenshot_time, 'scene_box_domino')
         # scene 3
@@ -358,23 +358,23 @@ class FunctionalTest(GameObject):
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (865, 415), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (865, 330), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (865, 415), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (865, 330), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-        self._screenshot(10 + FunctionalTest.screenshot_time, 'fail_box_domino')
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_box_domino')
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left'])  # replay
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (860, 415), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (775, 235), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left'])  # replay
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (860, 415), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (775, 235), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-        self._screenshot(10 + FunctionalTest.screenshot_time, 'win_box_domino')
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'win_box_domino')
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(690, 420), 'left'])  # next
         self._screenshot(FunctionalTest.screenshot_time, 'scene_basketball')
         # scene 4
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(820, 455), 'left'])  # close instructions
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (630, 300), 'left'])  # drag a ball
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(690, 420), 'left'])  # next
         self._screenshot(FunctionalTest.screenshot_time, 'scene_basketball')
         # scene 4
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(820, 455), 'left'])  # close instructions
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (630, 300), 'left'])  # drag a ball
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-        self._screenshot(10 + FunctionalTest.screenshot_time, 'fail_basketball')
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_basketball')
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left'])  # replay
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (360, 150), 'left'])  # drag a ball
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left'])  # replay
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (360, 150), 'left'])  # drag a ball
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-        self._screenshot(10 + FunctionalTest.screenshot_time, 'win_basketball')
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'win_basketball')
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(690, 420), 'left'])  # next
         self._screenshot(FunctionalTest.screenshot_time, 'scene_domino_box_basketball')
         # scene 5
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(690, 420), 'left'])  # next
         self._screenshot(FunctionalTest.screenshot_time, 'scene_domino_box_basketball')
         # scene 5
@@ -382,38 +382,38 @@ class FunctionalTest(GameObject):
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (550, 415), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 50), (560, 340), 'left'])  # drag a piece
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (550, 415), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 50), (560, 340), 'left'])  # drag a piece
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-        self._screenshot(10 + FunctionalTest.screenshot_time, 'fail_domino_box_basketball')
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_domino_box_basketball')
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left'])  # replay
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (550, 415), 'left'])  # drag a box
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left'])  # replay
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (550, 415), 'left'])  # drag a box
-        self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 50), (620, 410), 'left'])  # drag a piece
-        self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(620, 430), (665, 425), 'right'])  # rotate a piece
+        self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(30, 50), (618, 412), 'left'])  # drag a piece
+        self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(620, 430), (660, 425), 'right'])  # rotate a piece
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(615, 415), (615, 420), 'left'])  # drag a piece
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
         self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(615, 415), (615, 420), 'left'])  # drag a piece
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-        self._screenshot(10 + FunctionalTest.screenshot_time, 'win_domino_box_basketball')
+        self._screenshot(16 + FunctionalTest.screenshot_time, 'win_domino_box_basketball')
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(690, 420), 'left'])  # next
         # self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_tooter')
         # # scene 6
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(820, 455), 'left'])  # close instructions
         # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (490, 300), 'left'])  # drag a box
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(690, 420), 'left'])  # next
         # self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_tooter')
         # # scene 6
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(820, 455), 'left'])  # close instructions
         # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (490, 300), 'left'])  # drag a box
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-        # self._screenshot(10 + FunctionalTest.screenshot_time, 'fail_teeter_tooter')
+        # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_tooter')
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left'])  # replay
         # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (490, 150), 'left'])  # drag a box
         # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(515, 115), (515, 122), 'right'])  # rotate a box
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left'])  # replay
         # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (490, 150), 'left'])  # drag a box
         # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(515, 115), (515, 122), 'right'])  # rotate a box
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-        # self._screenshot(10 + FunctionalTest.screenshot_time, 'win_teeter_tooter')
+        # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_tooter')
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(690, 420), 'left'])  # next
         # self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_domino_box_basketball')
         # scene 7
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(880, 455), 'left'])  # close instructions
         # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (155, 180), 'left'])  # drag a box
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(690, 420), 'left'])  # next
         # self._screenshot(FunctionalTest.screenshot_time, 'scene_teeter_domino_box_basketball')
         # scene 7
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(880, 455), 'left'])  # close instructions
         # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (155, 180), 'left'])  # drag a box
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-        # self._screenshot(10 + FunctionalTest.screenshot_time, 'fail_teeter_domino_box_basketball')
+        # self._screenshot(16 + FunctionalTest.screenshot_time, 'fail_teeter_domino_box_basketball')
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left'])  # replay
         # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (170, 80), 'left'])  # drag a box
         # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(195, 50), (195, 80), 'right'])  # rotate a box
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(640, 420), 'left'])  # replay
         # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(60, 60), (170, 80), 'left'])  # drag a box
         # self._event(FunctionalTest.evt_time, 'mousedrag', False, False, [(195, 50), (195, 80), 'right'])  # rotate a box
         # self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(1260, 695), 'left'])  # play
-        # self._screenshot(10 + FunctionalTest.screenshot_time, 'win_teeter_domino_box_basketball')
+        # self._screenshot(16 + FunctionalTest.screenshot_time, 'win_teeter_domino_box_basketball')
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(590, 420), 'left'])  # home
         self._screenshot(FunctionalTest.screenshot_time, 'home_from_play')
 
         self._event(FunctionalTest.evt_time, 'mouseclick', False, False, [(590, 420), 'left'])  # home
         self._screenshot(FunctionalTest.screenshot_time, 'home_from_play')
 
index 515d2f5a2ec7f506d115eee1aae10d55a7101266..a5d7ea66f9770f19d1c1992e9df54eee327b7335 100755 (executable)
@@ -1,26 +1,31 @@
 from logging import basicConfig, info, INFO, DEBUG, getLogger
 from configparser import ConfigParser
 from sys import platform, argv
 from logging import basicConfig, info, INFO, DEBUG, getLogger
 from configparser import ConfigParser
 from sys import platform, argv
+from platform import system
+from pathlib import Path
+from glob import glob
 from json import load, dumps
 #from datetime import datetime
 from pprint import pprint
 from os import getcwd, environ
 from json import load, dumps
 #from datetime import datetime
 from pprint import pprint
 from os import getcwd, environ
-from os.path import exists
+from os.path import exists, dirname
 from traceback import print_stack
 from sys import version_info
 # from platform import system, release, architecture, platform, processor, \
 #     version, machine
 # from multiprocessing import cpu_count
 from traceback import print_stack
 from sys import version_info
 # from platform import system, release, architecture, platform, processor, \
 #     version, machine
 # from multiprocessing import cpu_count
-from panda3d.core import Filename, GraphicsWindow
+from panda3d.core import Filename, GraphicsWindow, PandaSystem
+from panda3d.bullet import get_bullet_version
 from lib.gameobject import Colleague
 from lib.lib.builder import LibP3d
 from lib.gameobject import Colleague
 from lib.lib.builder import LibP3d
+import sys
 
 
 lev = INFO
 opt_path = ''
 if platform in ['win32', 'linux'] and not exists('main.py'):
     # it is the deployed version for windows
 
 
 lev = INFO
 opt_path = ''
 if platform in ['win32', 'linux'] and not exists('main.py'):
     # it is the deployed version for windows
-    opt_path = str(Filename.get_user_appdata_directory()) + '/yocto_racer'
+    opt_path = str(Filename.get_user_appdata_directory()) + '/pmachines'
 opath = LibP3d.fixpath(opt_path + '/options.ini') if opt_path else \
         'options.ini'
 if exists(opath):
 opath = LibP3d.fixpath(opt_path + '/options.ini') if opt_path else \
         'options.ini'
 if exists(opath):
@@ -50,22 +55,62 @@ class LogMgrBase(Colleague):  # headless log manager
         if verbose and not self.eng.cfg.dev_cfg.verbose_log: return
         info(msg)
 
         if verbose and not self.eng.cfg.dev_cfg.verbose_log: return
         info(msg)
 
+    @property
+    def is_appimage(self):
+        par_path = str(Path(__file__).parent.absolute())
+        is_appimage = par_path.startswith('/tmp/.mount_Pmachi')
+        return is_appimage and par_path.endswith('/usr/bin')
+
+    @property
+    def curr_path(self):
+        # this is different from the music's one since it does not work
+        # with the version in windows
+        if sys.platform == 'darwin':
+            return dirname(__file__) + '/../Resources/'
+        # return dirname(__file__)
+        par_path = str(Path(__file__).parent.absolute())
+        if self.is_appimage:
+            return str(Path(par_path).absolute())
+        is_snap = par_path.startswith('/snap/')
+        is_snap = is_snap and par_path.endswith('/x1')
+        if is_snap:
+            return str(Path(par_path).absolute())
+        #return getcwd()
+        curr_path = dirname(__file__)
+        info('current path: %s' % curr_path)
+        return curr_path
+
+    @property
+    def build_version(self):
+        appimg_mnt = glob('/tmp/.mount_Pmachi*')
+        if appimg_mnt:
+            #with open(appimg_mnt[0] + '/usr/bin/appimage_version.txt') as fver:
+            with open(self.curr_path + '/assets/bld_version.txt') as fver:
+                return fver.read().strip()
+        try:
+            with open(self.curr_path + '/assets/bld_version.txt') as fver:
+                return fver.read().strip()
+        except FileNotFoundError:
+            info('not found ' + self.curr_path + '/assets/bld_version.txt')
+            return 'notfound'
+
     def log_cfg(self):
         if '--version' in argv:
             path = str(Filename.get_user_appdata_directory())
             home = '/home/flavio'  # we must force this for wine
             if path.startswith('/c/users/') and exists(home + '/.wine/'):
                 path = home + '/.wine/drive_' + path[1:]
     def log_cfg(self):
         if '--version' in argv:
             path = str(Filename.get_user_appdata_directory())
             home = '/home/flavio'  # we must force this for wine
             if path.startswith('/c/users/') and exists(home + '/.wine/'):
                 path = home + '/.wine/drive_' + path[1:]
-            info('writing %s' % path + '/yocto_racer/obs_version.txt')
-            with open(path + '/yocto_racer/obs_version.txt', 'w') as f:
-                f.write(self.eng.logic.version)
+            info('writing %s' % path + '/pmachines/obs_version.txt')
+            with open(path + '/pmachines/obs_version.txt', 'w') as f:
+                #f.write(self.eng.logic.version)
+                f.write(self.build_version)
             if not platform.startswith('win'):
                 from os import ttyname  # here because it doesn't work on windows
                 import sys
                 with open(ttyname(0), 'w') as fout:
                     sys.stdout = fout
             if not platform.startswith('win'):
                 from os import ttyname  # here because it doesn't work on windows
                 import sys
                 with open(ttyname(0), 'w') as fout:
                     sys.stdout = fout
-                    print('version: ' + self.eng.logic.version)
-        messages = ['version: ' + self.eng.logic.version]
+                    print('version: ' + self.build_version)  # self.eng.logic.version)
+        messages = ['version: ' + self.build_version]  # self.eng.logic.version]
         messages += ['argv[0]: %s' % argv[0]]
         messages += ['getcwd: %s' % getcwd()]
         messages += ['__file__: %s' % __file__]
         messages += ['argv[0]: %s' % argv[0]]
         messages += ['getcwd: %s' % getcwd()]
         messages += ['__file__: %s' % __file__]
@@ -81,18 +126,18 @@ class LogMgrBase(Colleague):  # headless log manager
         #     messages += ['cores: ' + str(cpu_count())]
         # except NotImplementedError:  # on Windows
         #     messages += ['cores: not implemented']
         #     messages += ['cores: ' + str(cpu_count())]
         # except NotImplementedError:  # on Windows
         #     messages += ['cores: not implemented']
-        lib_ver = self.eng.lib.version
+        lib_ver = PandaSystem.get_version_string()
         try:
             import psutil
             mem = psutil.virtual_memory().total / 1000000000.0
             messages += ['memory: %s GB' % round(mem, 2)]
         except ImportError: info("can't import psutil")  # windows
         try:
             import psutil
             mem = psutil.virtual_memory().total / 1000000000.0
             messages += ['memory: %s GB' % round(mem, 2)]
         except ImportError: info("can't import psutil")  # windows
-        lib_commit = self.eng.lib.lib_commit
+        lib_commit = PandaSystem.get_git_commit()
         py_ver = [str(elm) for elm in version_info[:3]]
         messages += ['python version: %s' % '.'.join(py_ver)]
         messages += ['panda version: %s %s' % (lib_ver, lib_commit)]
         py_ver = [str(elm) for elm in version_info[:3]]
         messages += ['python version: %s' % '.'.join(py_ver)]
         messages += ['panda version: %s %s' % (lib_ver, lib_commit)]
-        messages += ['bullet version: ' + str(self.eng.lib.phys_version)]
-        messages += ['appdata: ' + str(self.eng.lib.user_appdata_dir)]
+        messages += ['bullet version: ' + str(get_bullet_version())]
+        messages += ['appdata: ' + str(Filename.get_user_appdata_directory())]
         if base.win and isinstance(base.win, GraphicsWindow):  # not headless
             print(base.win.get_keyboard_map())
         list(map(self.log, messages))
         if base.win and isinstance(base.win, GraphicsWindow):  # not headless
             print(base.win.get_keyboard_map())
         list(map(self.log, messages))
@@ -114,18 +159,26 @@ class LogMgr(LogMgrBase):
 
     def log_cfg(self):
         LogMgrBase.log_cfg(self)
 
     def log_cfg(self):
         LogMgrBase.log_cfg(self)
-        messages = [self.eng.lib.driver_vendor]
-        messages += [self.eng.lib.driver_renderer]
-        shad_maj = self.eng.lib.driver_shader_version_major
-        shad_min = self.eng.lib.driver_shader_version_minor
+        messages = [base.win.get_gsg().get_driver_vendor()]
+        messages += [base.win.get_gsg().get_driver_renderer()]
+        shad_maj = base.win.get_gsg().get_driver_shader_version_major()
+        shad_min = base.win.get_gsg().get_driver_shader_version_minor()
         messages += ['shader: {maj}.{min}'.format(maj=shad_maj, min=shad_min)]
         messages += ['shader: {maj}.{min}'.format(maj=shad_maj, min=shad_min)]
-        messages += [self.eng.lib.driver_version]
-        drv_maj = self.eng.lib.driver_version_major
-        drv_min = self.eng.lib.driver_version_minor
+        messages += [base.win.get_gsg().get_driver_version()]
+        drv_maj = base.win.get_gsg().get_driver_version_major()
+        drv_min = base.win.get_gsg().get_driver_version_minor()
         drv = 'driver version: {maj}.{min}'
         messages += [drv.format(maj=drv_maj, min=drv_min)]
         drv = 'driver version: {maj}.{min}'
         messages += [drv.format(maj=drv_maj, min=drv_min)]
-        messages += ['fullscreen: ' + str(self.eng.lib.fullscreen)]
-        res_x, res_y = self.eng.lib.resolution
+        fullscreen = None
+        if isinstance(base.win, GraphicsWindow):
+            fullscreen = base.win.get_properties().get_fullscreen()
+        messages += ['fullscreen: ' + str(fullscreen)]
+        def resolution():
+            if not isinstance(base.win, GraphicsWindow):
+                return 800, 600
+            win_prop = base.win.get_properties()
+            return win_prop.get_x_size(), win_prop.get_y_size()
+        res_x, res_y = resolution()
         res_tmpl = 'resolution: {res_x}x{res_y}'
         messages += [res_tmpl.format(res_x=res_x, res_y=res_y)]
         list(map(self.log, messages))
         res_tmpl = 'resolution: {res_x}x{res_y}'
         messages += [res_tmpl.format(res_x=res_x, res_y=res_y)]
         list(map(self.log, messages))
index 073740cea38e406432521287c791b6bc62a22f42..919af89a8cf5da0cdbaeee04de5979c22e1f559c 100755 (executable)
@@ -155,8 +155,8 @@ class P3dGfxMgr:
         time = datetime.datetime.now().strftime('%y%m%d%H%M%S')
         #res = base.win.save_screenshot(Filename(path or ("yocto%s.png" % time)))
         #debug('screenshot %s (%s)' % (path or ("yocto%s.png" % time), res))
         time = datetime.datetime.now().strftime('%y%m%d%H%M%S')
         #res = base.win.save_screenshot(Filename(path or ("yocto%s.png" % time)))
         #debug('screenshot %s (%s)' % (path or ("yocto%s.png" % time), res))
-        res = base.screenshot(path or ("yocto%s.png" % time), False)
-        info('screenshot %s (%s; %s)' % (path or ("yocto%s.png" % time), res, getcwd()))
+        res = base.screenshot(path or ("pmachines%s.png" % time), False)
+        info('screenshot %s (%s; %s)' % (path or ("pmachines%s.png" % time), res, getcwd()))
 
     @staticmethod
     def enable_shader(): render.set_shader_auto()
 
     @staticmethod
     def enable_shader(): render.set_shader_auto()
diff --git a/prj.org b/prj.org
index 29079f0c3f8b9d298d9b82d01109ca682b0b7159..02549aeea4d09c48cbc9faa53528c5c577f56baf 100644 (file)
--- a/prj.org
+++ b/prj.org
     - [X] appimage
     - [X] windows
     - [X] flatpak
     - [X] appimage
     - [X] windows
     - [X] flatpak
+    - [X] versions
     - [ ] itchio
     - [ ] itchio
-    - [ ] versions
+** READY messenger.send('force_win') and messenger.send('force_fail')
 ** 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 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 move functional tests in tests from lib.engine
 * READY refactoring
 * BACKLOG version 0.0.yymmdd
 * BACKLOG do intro video with moviepy
 * READY refactoring
 * BACKLOG version 0.0.yymmdd
 * BACKLOG do intro video with moviepy
index f2ecd70b249c01c6582051e6e68a81d877baea83..29902b259230f4ee44c75cb512c5658beece191b 100644 (file)
@@ -22,9 +22,9 @@ class LangTests(TestCase):
             rmtree('./tests/' + dirname, ignore_errors=True)
 
     def test_lang(self):
             rmtree('./tests/' + dirname, ignore_errors=True)
 
     def test_lang(self):
-        LanguageBuilder.pot('test_yocto', './tests/po/')
-        self.assertTrue(exists('./tests/po/test_yocto.pot'))
-        LanguageBuilder.merge('it_IT', './tests/po/', './tests/locale/', 'test_yocto')
-        LanguageBuilder.mo('./tests/locale/it_IT/LC_MESSAGES/test_yocto.mo',
-                           './tests/locale/', 'test_yocto')
-        self.assertTrue(exists('./tests/locale/it_IT/LC_MESSAGES/test_yocto.mo'))
+        LanguageBuilder.pot('test_pmachines', './tests/po/')
+        self.assertTrue(exists('./tests/po/test_pmachines.pot'))
+        LanguageBuilder.merge('it_IT', './tests/po/', './tests/locale/', 'test_pmachines')
+        LanguageBuilder.mo('./tests/locale/it_IT/LC_MESSAGES/test_pmachines.mo',
+                           './tests/locale/', 'test_pmachines')
+        self.assertTrue(exists('./tests/locale/it_IT/LC_MESSAGES/test_pmachines.mo'))
index 1d1c27a82a1dd64756b12a77ae671f16304399d0..4b9f8b97b41cb8eb33b7216d720ff344d2941277 100644 (file)
@@ -1,11 +1,12 @@
 from pathlib import Path
 from pathlib import Path
+from datetime import datetime
 from itertools import product
 from logging import info
 import sys
 if '' in sys.path: sys.path.remove('')
 sys.path.append(str(Path(__file__).parent.parent.parent))
 from unittest import TestCase
 from itertools import product
 from logging import info
 import sys
 if '' in sys.path: sys.path.remove('')
 sys.path.append(str(Path(__file__).parent.parent.parent))
 from unittest import TestCase
-from shutil import rmtree
+from shutil import rmtree, copy
 from time import sleep
 from os import system, remove, environ
 from os.path import exists, basename, join
 from time import sleep
 from os import system, remove, environ
 from os.path import exists, basename, join
@@ -47,7 +48,7 @@ class FunctionalTests(TestCase):
         self.__clean()
 
     def tearDown(self):
         self.__clean()
 
     def tearDown(self):
-        self.__clean()
+        pass  # self.__clean()
 
     def test_ref(self):
         info('test_ref')
 
     def test_ref(self):
         info('test_ref')
@@ -60,7 +61,7 @@ class FunctionalTests(TestCase):
         res = exec_cmd(cmd)
         if exists('diff.png'): remove('diff.png')
         print('compare %s %s: %s' % (ref_img, tst_img, res))
         res = exec_cmd(cmd)
         if exists('diff.png'): remove('diff.png')
         print('compare %s %s: %s' % (ref_img, tst_img, res))
-        return float(res) > .64
+        return float(res) > .8
 
     def __test_template(self, cmd, path):
         if environ.get('FUNCTIONAL') != '1':
 
     def __test_template(self, cmd, path):
         if environ.get('FUNCTIONAL') != '1':
@@ -74,13 +75,16 @@ class FunctionalTests(TestCase):
         self.assertGreater(len(files), 1)
         for fname in files:
             self.assertTrue(exists(path + basename(fname)), '%s does not exist' % (path + basename(fname)))
         self.assertGreater(len(files), 1)
         for fname in files:
             self.assertTrue(exists(path + basename(fname)), '%s does not exist' % (path + basename(fname)))
-            self.assertTrue(
-                self.__similar_images(
-                    str(Path.home()) + '/.local/share/pmachines/tests/functional_ref_%s/' % _branch() + basename(fname),
-                    path + basename(fname)),
-                'error while comparing %s and %s' % (
-                    str(Path.home()) + '/.local/share/pmachines/tests/functional_ref_%s/' % _branch() + basename(fname),
-                    path + basename(fname)))
+            similar = self.__similar_images(
+                str(Path.home()) + '/.local/share/pmachines/tests/functional_ref_%s/' % _branch() + basename(fname),
+                path + basename(fname)),
+            'error while comparing %s and %s' % (
+                str(Path.home()) + '/.local/share/pmachines/tests/functional_ref_%s/' % _branch() + basename(fname),
+                path + basename(fname))
+            if not similar:
+                timestamp = datetime.now().strftime('%y%m%d%H%M%S%f')
+                copy(path + basename(fname), '~/Desktop/' + basename(fname)[:-4] + timestamp + '.png')
+            self.assertTrue(similar)
 
     def test_code(self):
         info('test_code')
 
     def test_code(self):
         info('test_code')
@@ -142,37 +146,37 @@ class FunctionalTests(TestCase):
             'timeout 720s wine %s --functional-test 2' % (abspath, abspath),
             str(Path.home()) + '/.wine/drive_c/users/flavio/AppData/Local/pmachines/tests/functional/')
 
             'timeout 720s wine %s --functional-test 2' % (abspath, abspath),
             str(Path.home()) + '/.wine/drive_c/users/flavio/AppData/Local/pmachines/tests/functional/')
 
-    def test_versions(self):
-        info('test_versions')
-        if environ.get('FUNCTIONAL') != '1':
-            self.skipTest('skipped functional tests')
-        bld_branch = {'master': 'alpha', 'rc': 'rc', 'stable': 'stable'}[_branch()]
-    #     with open('/home/flavio/pmachines_builder/last_bld.txt') as f:
-            lines = f.readlines()
-        for line in lines:
-            if line.strip().split()[0] == _branch():
-                commit = line.strip().split()[1][:7]
-        _ver = ver
-        if _branch() == 'stable':
-    #         with open('/home/flavio/pmachines_builder/pmachines/assets/version.txt') as fver:
-                _ver = fver.read().strip() + '-'
-        exp = '%s-%s' % (_ver, commit)
-        cmds = [
-            ('./build/manylinux1_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 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')]
-        system('flatpak update -y it.ya2.Pmachines//%s' % bld_branch)
-        for cmd in cmds:
-            if exists(cmd[1]):
-                remove(cmd[1])
-            info('launching %s' % cmd[0])
-            exec_cmd(cmd[0])
-            with open(cmd[1]) as f:
-                obs = f.read().strip()
-    #         self.assertEqual(obs, exp)
+    def test_versions(self):
+        info('test_versions')
+        if environ.get('FUNCTIONAL') != '1':
+            self.skipTest('skipped functional tests')
+        bld_branch = {'master': 'alpha', 'rc': 'rc', 'stable': 'stable'}[_branch()]
+        with open('/home/flavio/builders/pmachines_builder/last_bld.txt') as f:
+            lines = f.readlines()
+        for line in lines:
+            if line.strip().split()[0] == _branch():
+                commit = line.strip().split()[1][:7]
+        _ver = ver
+        if _branch() == 'stable':
+            with open('/home/flavio/builders/pmachines_builder/pmachines/assets/version.txt') as fver:
+                _ver = fver.read().strip() + '-'
+        exp = '%s-%s' % (_ver, commit)
+        cmds = [
+            ('./build/manylinux1_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 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')]
+        system('flatpak update -y it.ya2.Pmachines//%s' % bld_branch)
+        for cmd in cmds:
+            if exists(cmd[1]):
+                remove(cmd[1])
+            info('launching %s' % cmd[0])
+            exec_cmd(cmd[0])
+            with open(cmd[1]) as f:
+                obs = f.read().strip()
+            self.assertEqual(obs, exp, 'during ' + cmd[0])