summaryrefslogtreecommitdiff
path: root/test-cli/test/tests/qscreen.py
blob: aaee628cb17f96dd8297501d44e36bb625e5f9f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from test.helpers.syscmd import SysCommand
import unittest
from test.helpers.cv_display_test import pattern_detect


class Qscreen(unittest.TestCase):
    params = None

    #varlist: display
    def __init__(self, testname, testfunc, varlist):
        self.params = varlist
        super(Qscreen, self).__init__(testfunc)
        if "display" in varlist:
            self.__display = varlist["display"]
        else:
            raise Exception('display param inside Qscreen have been be defined')
        self._testMethodDoc = testname

    def execute(self):
        str_cmd = "fbi -T 1 --noverbose -d /dev/{} test/files/test_pattern.png".format(self.__display)
        display_image = SysCommand("display_image", str_cmd)
        if display_image.execute() == -1:
            test_screen = pattern_detect(1)
            if not test_screen=="0":
                self.fail("failed: {}".format(test_screen))
        else:
            self.fail("failed: could not display the image")