Tests: force bigger fonts and flat theme in GTK to make OCR more reliable. wxPython4
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Sun, 20 Nov 2022 18:36:13 +0100
branchwxPython4
changeset 3679 b6bca75bf3fa
parent 3678 6c496a8ed2a9
child 3688 c2992796a859
Tests: force bigger fonts and flat theme in GTK to make OCR more reliable.
tests/ide_tests/debug_project.sikuli/1646062660770.png
tests/ide_tests/debug_project.sikuli/debug_project.py
tests/ide_tests/edit_project.sikuli/1646062660770.png
tests/ide_tests/edit_project.sikuli/edit_project.py
tests/ide_tests/opcua_browse.sikuli/opcua_browse.py
tests/ide_tests/opcua_browse.sikuli/opcua_node.png
tests/ide_tests/opcua_browse_encrypted.sikuli/opcua_browse_encrypted.py
tests/ide_tests/opcua_browse_encrypted.sikuli/opcua_node.png
tests/ide_tests/sikuliberemiz.py
tests/tools/Docker/beremiz-sikuli/Dockerfile
Binary file tests/ide_tests/debug_project.sikuli/1646062660770.png has changed
--- a/tests/ide_tests/debug_project.sikuli/debug_project.py	Fri Nov 18 07:34:29 2022 +0100
+++ b/tests/ide_tests/debug_project.sikuli/debug_project.py	Sun Nov 20 18:36:13 2022 +0100
@@ -29,7 +29,7 @@
     
     app.waitForChangeAndIdleStdout()
     
-    app.click("1646062660770.png")
+    app.click("main")
 
     app.WaitIdleUI()
     
Binary file tests/ide_tests/edit_project.sikuli/1646062660770.png has changed
--- a/tests/ide_tests/edit_project.sikuli/edit_project.py	Fri Nov 18 07:34:29 2022 +0100
+++ b/tests/ide_tests/edit_project.sikuli/edit_project.py	Sun Nov 20 18:36:13 2022 +0100
@@ -13,7 +13,7 @@
 
 def test(app):
 
-    app.doubleClick("1646062660770.png")
+    app.doubleClick("main")
 
     app.WaitIdleUI()
 
--- a/tests/ide_tests/opcua_browse.sikuli/opcua_browse.py	Fri Nov 18 07:34:29 2022 +0100
+++ b/tests/ide_tests/opcua_browse.sikuli/opcua_browse.py	Sun Nov 20 18:36:13 2022 +0100
@@ -14,14 +14,12 @@
 def test(app):
 
     server = AuxiliaryProcess(app, ["/bin/bash",os.path.join(getBundlePath(),"opcua_service.bash")])
-    #server = AuxiliaryProcess(app, ["/bin/bash","-c","echo $PWD"])
 
-    app.doubleClick("opcua_node.png")
+    app.doubleClick("opcua_0")
 
     app.WaitIdleUI()
 
-    # app.click("Browse Server") # OCR didn't work because of gradient in button...
-    app.click("opcua_browse_server.png")
+    app.click("Server")
 
     app.WaitIdleUI()
 
Binary file tests/ide_tests/opcua_browse.sikuli/opcua_node.png has changed
--- a/tests/ide_tests/opcua_browse_encrypted.sikuli/opcua_browse_encrypted.py	Fri Nov 18 07:34:29 2022 +0100
+++ b/tests/ide_tests/opcua_browse_encrypted.sikuli/opcua_browse_encrypted.py	Sun Nov 20 18:36:13 2022 +0100
@@ -14,16 +14,14 @@
 def test(app):
 
     server = AuxiliaryProcess(app, ["/bin/bash",os.path.join(getBundlePath(),"opcua_service.bash")])
-    #server = AuxiliaryProcess(app, ["/bin/bash","-c","echo $PWD"])
 
     server.waitPatternInStdout("CERTS READY", 5)
 
-    app.doubleClick("opcua_node.png")
+    app.doubleClick("opcua_0")
 
     app.WaitIdleUI()
 
-    # app.click("Browse Server") # OCR didn't work because of gradient in button...
-    app.click("opcua_browse_server.png")
+    app.click("Server")
 
     app.WaitIdleUI()
 
Binary file tests/ide_tests/opcua_browse_encrypted.sikuli/opcua_node.png has changed
--- a/tests/ide_tests/sikuliberemiz.py	Fri Nov 18 07:34:29 2022 +0100
+++ b/tests/ide_tests/sikuliberemiz.py	Sun Nov 20 18:36:13 2022 +0100
@@ -200,8 +200,6 @@
                 Sikuli App class instance
         """
 
-        sikuli.OCR.Options().smallFont()
-
         self.screenshotnum = 0
         self.starttime = timesec()
         self.screen = sikuli.Screen()
--- a/tests/tools/Docker/beremiz-sikuli/Dockerfile	Fri Nov 18 07:34:29 2022 +0100
+++ b/tests/tools/Docker/beremiz-sikuli/Dockerfile	Sun Nov 20 18:36:13 2022 +0100
@@ -22,15 +22,16 @@
     && TZ="America/Paris" \
        DEBIAN_FRONTEND="noninteractive" \
        apt-get install -y --no-install-recommends \
-               `# run sikuli` \
+               `# to run sikuli` \
                wget \
                libopencv4.2-java \
                openjdk-11-jre \
                \
-               `# run X based tests` \
+               `# to run X based tests` \
                fluxbox \
                wmctrl xdotool xvfb \
                x11vnc xterm xnest \
+               materia-gtk-theme \
                \
                `# to build tested apps` \
                build-essential automake flex bison mercurial \
@@ -38,6 +39,11 @@
                libpython2.7-dev libssl-dev \
                python2 virtualenv cmake
 
+
+# force bigger font and flat theme for GTK in order to make OCR more reliable
+RUN mkdir -p /etc/gtk-3.0
+RUN env echo -e '[Settings]\ngtk-font-name=FreeSans,12\ngtk-theme-name=Materia\n' > /etc/gtk-3.0/settings.ini
+
 # link obtained from https://raiman.github.io/SikuliX1/downloads.html
 RUN set -xe && \
     wget -qP /usr/local/bin \