Пример #1
0
def getProgram_Title(scope={}):
    print "Looking for title"
    stbt.press("KEY_INFO")
    stbt.wait_until(lambda: infobanner.Infobanner())
    sleep(2)
    current_selection_text = stbt.ocr(
        region=stbt.Region(x=317, y=633, right=838, bottom=683),
        mode=stbt.OcrMode.SINGLE_LINE,
        lang='nld',
        # tesseract_config={'load_system_dawg':False, 'load_freq_dawg':False},
    )
    return {"programTitle": current_selection_text}
Пример #2
0
def check_for_recording_icon(icon, scope={}, validate=True):
    status = False
    dismissPopupIfPresent()
    coordinates = getCoordinatesOfIcon(icon)
    image = coordinates['image']
    x = coordinates['x']
    y = coordinates['y']
    right = coordinates['right']
    bottom = coordinates['bottom']
    imageRegion = stbt.Region(x, y, right, bottom)
    try:
        if (stbt.wait_for_match(image, region=stbt.Region(x, y, right,
                                                          bottom))):
            print "Icon present on screen"
            status = True
        else:
            print "Icon not present on screen"
            status = False
    except Exception, e:
        print e
        print "Exception thrown"
Пример #3
0
def test_match_all_with_an_image_that_matches_everywhere(match_method):
    matches = sorted(m.region for m in stbt.match_all(
        "repeating-pattern.png",
        frame=stbt.load_image("repeating-pattern-full-frame.png"),
        match_parameters=mp(match_method=match_method)))

    expected_matches = sorted([
        stbt.Region(x, y, width=16, height=16) for x in range(0, 320, 16)
        for y in range(0, 240, 16)
    ])

    print(matches)
    assert matches == expected_matches
Пример #4
0
def test_transparent_reference_image_with_hard_edge():
    # This is a regression test for a bug in the pyramid optimisation when
    # the reference image has a very small number of pixels, or the only non-
    # transparent pixels are near the edges of reference image:
    # At the smaller pyramid levels, the pixels near the edge of the reference
    # image won't match exactly because the corresponding pixels in the
    # down-scaled frame have been blurred. We also blur the reference image
    # before down-scaling, but since it doesn't know what's outside its edges,
    # it won't have the  blurring near the edge.
    frame = stbt.load_image("images/regression/roku-tile-frame.png")
    m = stbt.match("images/regression/roku-tile-selection.png", frame=frame)
    assert m
    assert stbt.Region(x=325, y=145, right=545, bottom=325).contains(m.region)
Пример #5
0
def test_that_results_dont_overlap(match_method):
    # This is a regression test for a bug seen in an earlier implementation of
    # `match_all`.
    frame = stbt.load_image("action-panel.png")
    all_matches = set()
    for m in stbt.match_all("action-panel-template.png",
                            frame=frame,
                            match_parameters=mp(match_method=match_method)):
        print(m)
        assert m.region not in all_matches, "Match %s already seen:\n    %s" % (
            m, "\n    ".join(str(x) for x in all_matches))
        assert all(
            stbt.Region.intersect(m.region, x) is None for x in all_matches)
        all_matches.add(m.region)

    assert all_matches == set([
        stbt.Region(x=135, y=433, width=222, height=40),
        stbt.Region(x=135, y=477, width=222, height=40),
        stbt.Region(x=135, y=521, width=222, height=40),
        stbt.Region(x=135, y=565, width=222, height=40),
        stbt.Region(x=135, y=609, width=222, height=40)
    ])
Пример #6
0
 def testTvNaziemnej(self):
     self.testsResults["terrestrial_siganl_level"] = []
     self.testsResults["terrestrial_siganl_quality"] = []
     stbt.press("KEY_DOWN", Test.timeBeforePress)
     stbt.press("KEY_DOWN", Test.timeBeforePress)
     stbt.press("KEY_OK", Test.timeBeforePress)
     stbt.press("KEY_RIGHT", Test.timeBeforePress)
     channel_numbers = ["25", "55", "58"]
     for number in channel_numbers:
         Test.myPressUntilMatchText(
             number, "KEY_DOWN", stbt.Region(624, 399, width=37, height=26),
             30)
         signalLevel = stbt.ocr(None,
                                stbt.Region(514, 434, width=56, height=30),
                                stbt.OcrMode.PAGE_SEGMENTATION_WITHOUT_OSD)
         sl = signalLevel[:-1]
         i = int(sl)
         print("Odczytana sila sygnalu: ", i)
         if i < self.minSignalLevel:
             self.testsResults["terrestrial_siganl_level"][
                 channel_numbers.index(number)] = False
         else:
             self.testsResults["terrestrial_siganl_level"][
                 channel_numbers.index(number)] = True
         signalQuality = stbt.ocr(
             None, stbt.Region(514, 601, width=56, height=30),
             stbt.OcrMode.PAGE_SEGMENTATION_WITHOUT_OSD)
         sq = signalQuality[:-1]
         j = int(sq)
         print("Odczytana jakosc sygnalu: ", j)
         if j < self.minSignalQuality:
             self.testsResults["terrestrial_siganl_quality"][
                 channel_numbers.index(number)] = False
         else:
             self.testsResults["terrestrial_siganl_quality"][
                 channel_numbers.index(number)] = True
     stbt.press("KEY_BACK", Test.timeBeforePress)
     stbt.press("KEY_BACK", Test.timeBeforePress)
Пример #7
0
def analyse_colours_video(number=None):
    """RGB!"""
    errors_in_a_row = 0
    n = 0
    for frame, _ in stbt.frames():
        if number is not None and n >= number:
            return
        colour_hex = ''
        n = n + 1

        def read_hex(region, frame_=frame):
            return stbt.ocr(
                frame_, region, stbt.OcrMode.SINGLE_LINE, tesseract_config={
                    'tessedit_char_whitelist': '#0123456789abcdef'},
                tesseract_user_patterns=['#\n\n\n\n\n\n']).replace(' ', '')

        # The colour is written above and below the rectangle because we want
        # to be sure that the top of the colour box is from the same frame as
        # the bottom.
        colour_hex = read_hex(stbt.Region(490, 100, 300, 70))
        colour_hex_bottom = read_hex(stbt.Region(490, 550, 300, 70))

        if (len(colour_hex) >= 7 and colour_hex[0] == '#' and
                all(c in string.hexdigits for c in colour_hex[1:7]) and
                colour_hex == colour_hex_bottom):
            desired = numpy.array((
                int(colour_hex[1:3], 16),
                int(colour_hex[3:5], 16),
                int(colour_hex[5:7], 16)))
            colour = cv2.mean(frame[240:480, 520:760])
            colour = (colour[2], colour[1], colour[0])
            yield (n, desired, colour)
            errors_in_a_row = 0
        else:
            errors_in_a_row += 1
            if errors_in_a_row > 50:
                raise RuntimeError(
                    "Failed to find hexidecimal colour description")
Пример #8
0
    def selection(self):
        settings_options = self.settings_options
        current_selection_text = stbt.ocr(
            frame=self._frame,
            region=stbt.Region(x=360, y=383, right=885, bottom=420),
            mode=stbt.OcrMode.SINGLE_LINE,
            lang='nld',
            # tesseract_config={'load_system_dawg':False, 'load_freq_dawg':False},
            tesseract_user_words=settings_options)

        for item in settings_options:
            print "settings option read as '%s'" % current_selection_text
            if ocr_utils.fuzzy_match(current_selection_text, item, 0.78):
                return item
Пример #9
0
 def sprawdzSileIJakosSygnalu(self):
     signalLevel = stbt.ocr(None, stbt.Region(1119,
                                              436,
                                              width=53,
                                              height=36),
                            stbt.OcrMode.PAGE_SEGMENTATION_WITHOUT_OSD)
     sl = signalLevel[:-1]
     i = int(sl)
     print("Odczytana sila sygnalu: ", i)
     if i < self.minSignalLevel:
         self.testsResults["siganl_level"] = False
         return
     signalQuality = stbt.ocr(None,
                              stbt.Region(1116, 488, width=54, height=28),
                              stbt.OcrMode.PAGE_SEGMENTATION_WITHOUT_OSD)
     sq = signalQuality[:-1]
     j = int(sq)
     print("Odczytana jakosc sygnalu: ", j)
     if j < self.minSignalQuality:
         self.testsResults["signal_quality"] = False
         return
     self.testsResults["signal_level"] = True
     self.testsResults["singal_quality"] = True
Пример #10
0
 def message(self):
     """
     This property demonstrates an advantage of Frame Objects over
     stand-alone helper functions. We are using the position of the "info"
     icon to find this message. Because the private ``_info`` property is
     shared between this property and ``is_visible`` we don't need to
     compute it twice -- the ``FrameObject`` base class will remember the
     value from the first time it was computed.
     """
     right_of_info = stbt.Region(
         x=self._info.region.right, y=self._info.region.y,
         width=390, height=self._info.region.height)
     return stbt.ocr(region=right_of_info, frame=self._frame) \
                .replace('\n', ' ')
Пример #11
0
def test_match_error_message_for_too_small_frame_and_region():
    stbt.match("videotestsrc-redblue.png", frame=black(width=92, height=160))
    stbt.match("videotestsrc-redblue.png",
               frame=black(),
               region=stbt.Region(x=1188, y=560, width=92, height=160))

    with pytest.raises(ValueError) as excinfo:
        stbt.match("videotestsrc-redblue.png",
                   frame=black(width=91, height=160))
    assert (
        "Frame (160, 91, 3) must be larger than reference image (160, 92, 3)"
        in str(excinfo.value))

    with pytest.raises(ValueError) as excinfo:
        stbt.match("videotestsrc-redblue.png",
                   frame=black(width=92, height=159))
    assert (
        "Frame (159, 92, 3) must be larger than reference image (160, 92, 3)"
        in str(excinfo.value))

    with pytest.raises(ValueError) as excinfo:
        # Region seems large enough but actually it extends beyond the frame
        stbt.match("videotestsrc-redblue.png",
                   frame=black(),
                   region=stbt.Region(x=1189, y=560, width=92, height=160))
    assert (
        "Region(x=1189, y=560, right=1280, bottom=720) must be larger than "
        "reference image (160, 92, 3)" in str(excinfo.value))

    with pytest.raises(ValueError) as excinfo:
        # Region seems large enough but actually it extends beyond the frame
        stbt.match("videotestsrc-redblue.png",
                   frame=black(),
                   region=stbt.Region(x=1188, y=561, width=92, height=160))
    assert (
        "Region(x=1188, y=561, right=1280, bottom=720) must be larger than "
        "reference image (160, 92, 3)" in str(excinfo.value))
Пример #12
0
def ustawieniaFabryczne():
    wejdzWUstawienia()
    myPressUntilMatchText(
        "FABRYCZNE", "KEY_DOWN", stbt.Region(507, 339, width=182, height=36),
        maxPressesInDiagnosticsMenu
    )  # sztuczka polegajaca na tym, ze slowo "FABRYCZNE" zmienia swoja pozcje na ekranie gdy opcja "USTAWIENIA FABRYCZNE" jest zaznaczona
    stbt.press("KEY_OK", timeBeforePress)
    stbt.press("KEY_OK", timeBeforePress)
    stbt.press("KEY_1", timeBeforePress)
    stbt.press("KEY_2", timeBeforePress)
    stbt.press("KEY_5", timeBeforePress)
    stbt.press("KEY_7", timeBeforePress)
    stbt.press("KEY_INFO", timeBeforePress)
    stbt.press("KEY_OK", timeBeforePress)
    stbt.press("KEY_OK", timeBeforePress)
Пример #13
0
def channelSwitchDetection(channelToCompare, maxAttempts=10):
    result = [0, 0]
    stbt.wait_for_match(
        "images/t1/up_arrow_image.png")  # oczekiwanie na wcisnienie przycisku
    channelNumber = stbt.ocr(None, stbt.Region(90, 592, width=45, height=41),
                             stbt.OcrMode.PAGE_SEGMENTATION_WITHOUT_OSD)
    cn = int(channelNumber)
    result[1] = cn
    if cn < channelToCompare:
        result[0] = 1
    elif cn > channelToCompare:
        result[0] = 2
    else:
        result[0] = -1
    return result
Пример #14
0
    def selection(self):
        hub_items = self.hub_items
        current_selection_text = stbt.ocr(
            frame=self._frame,
            region=stbt.Region(x=360, y=520, right=640, bottom=570),
            mode=stbt.OcrMode.SINGLE_LINE,
            lang='nld',
            # tesseract_config={'load_system_dawg':False, 'load_freq_dawg':False},
            tesseract_user_words=hub_items)

        for item in hub_items:
            print "Main hub item read as '%s'" % current_selection_text
            if tests.steps.ocr_utils.fuzzy_match(current_selection_text, item,
                                                 0.78):
                return item
    def program_title(self):
        """Gets the program title property"""

        text = stbt.ocr(
            frame=self._frame,
            region=stbt.Region(x=120, y=540, right=880, bottom=590),
            text_color=(255, 255, 255))

        # OCR is a little unreliable at reading " S01 E23" at the end of a
        # title.  It sometimes mistakes an "S" for a "5" and vice-versa.  We
        # fix this up here:
        def fix_series_episode(m):
            s, e = m.groups()
            return " S%s E%s" % (s.replace("S", "5"), e.replace("S", "5"))

        return re.sub(r"\s[S5]([0-9S]+)\sE([0-9S]+)$", fix_series_episode, text)
Пример #16
0
    def get_text(self, region):
        try:
            txt_region = stbt.Region(region["x"],
                                     region["y"],
                                     width=region["width"],
                                     height=region["height"])
            ocr_txt = stbt.ocr(region=txt_region)
            ocr_txt = ocr_txt.strip()
            self.LogResults.info("Captured Text : {}".format(
                ocr_txt.encode("utf-8")))
        except:
            self.LogResults.error("Text {} - Found".format(
                traceback.format_exc()))
            ocr_txt = None

        return ocr_txt.encode("utf-8")
Пример #17
0
def test_merge_regions_performance(n):
    random.seed(1)
    regions = []
    for _ in range(n):
        x = random.randint(0, 1280)
        y = random.randint(0, 720)
        right = random.randint(0, 1280)
        bottom = random.randint(0, 720)
        x, w = min(x, right), max(x, right) - min(x, right) + 1
        y, h = min(y, bottom), max(y, bottom) - min(y, bottom) + 1
        regions.append(stbt.Region(x, y, w, h))

    times = timeit.repeat(lambda: _merge_regions(regions[:]),
                          number=1, repeat=10)
    print(times)
    print(min(times))
    assert min(times) < (0.001 * n / 20)
Пример #18
0
 def pierwszaInstalacja(self):
     try:
         stbt.wait_for_match("sciezka do obrazka lista kanalow", 60)
     except stbt.MatchTimeout:
         self.testsResults["power"] = False
         return
     self.testsResults["power"] = True
     try:
         stbt.wait_for_match(
             "sciezka do obrazka aktualizacja oprogramowania", 60)
     except stbt.MatchTimeout:
         self.testsResults["signal_level_1"] = False
         self.testsResults["signal_quality_1"] = False
         return
     try:
         stbt.wait_for_match(
             "sciezka do obrazka przycisku aktualizacja oprogramowania", 30,
             stbt.Region(260, 200, width=690, height=340))
     except stbt.MatchTimeout:
         try:
             stbt.wait_for_match(
                 "obrazek ptaszek(zaznaczenie - ethernet)", 20,
                 stbt.Region(260, 200, width=690, height=340))
         except:
             stbt.press("KEY_UP", Test.timeBeforePress)
         stbt.press("KEY_OK", Test.timeBeforePress)
         stbt.press("KEY_OK", Test.timeBeforePress)
         try:
             stbt.wait_for_match("sciezka do obrazka odbierasz(aktywacja)",
                                 30,
                                 stbt.Region(905, 450, width=35, height=30))
         except MatchTimeout:
             self.sprawdzSileIJakosSygnalu(
                 1, stbt.Region(730, 365, width=65, height=25),
                 stbt.Region(730, 405, width=65, height=25))
             if self.model == "3740SX":
                 self.sprawdzSileIJakosSygnalu(
                     2, stbt.Region(730, 495, width=65, height=25),
                     stbt.Region(730, 535, width=65, height=25))
             return
         try:
             stbt.wait_for_motion(30)
         except MotionTimeout:
             self.activationCode()
     else:
         stbt.press("KEY_OK", Test.timeBeforePress)
         self.uruchomienieDekodera()
Пример #19
0
def check_icon_on_screen(icon, scope={}, validate=True):
    coordinates = getCoordinatesOfIcon(icon)
    status = False
    try:
        if (stbt.wait_for_match(coordinates['image'],
                                region=stbt.Region(
                                    x=coordinates['x'],
                                    y=coordinates['y'],
                                    right=coordinates['right'],
                                    bottom=coordinates['bottom']))):
            print "Icon present on screen"
            status = True
        else:
            print "Icon not present on screen"
            status = False
    except Exception, e:
        print e
        print "Exception thrown"
Пример #20
0
 def remote_control_press_until_image_match(self,
                                            key,
                                            image_to_find,
                                            region=None,
                                            maximum_key_press=5):
     if region is not None:
         img_region = stbt.Region(region["x"],
                                  region["y"],
                                  width=region["width"],
                                  height=region["height"])
         return stbt.press_until_match(key,
                                       image_to_find,
                                       max_presses=maximum_key_press,
                                       region=img_region)
     else:
         return stbt.press_until_match(key,
                                       image_to_find,
                                       max_presses=maximum_key_press)
Пример #21
0
 def sprawdzTimeshifting(self):
     stbt.press("KEY_PAUSE", Test.timeBeforePress)
     try:
         stbt.wait_for_motion(timeout_sec=3,
                              region=stbt.Region(10,
                                                 100,
                                                 width=1200,
                                                 height=400))
     except MotionTimeout:
         stbt.press("KEY_PLAY", Test.timeBeforePress)
         try:
             stbt.wait_for_motion()
         except MotionTimeout:
             self.testsResults["timeshifting"] = False
         else:
             self.testsResults["timeshifting"] = True
     else:
         self.testsResults["timeshifting"] = False
     stbt.press("KEY_STOP", Test.timeBeforePress)
Пример #22
0
def test_is_screen_black_debug():
    # So that the output directory name doesn't depend on how many tests
    # were run before this one.
    ImageLogger._frame_number = itertools.count(1)  # pylint:disable=protected-access

    f = stbt.load_image("videotestsrc-full-frame.png")

    with scoped_curdir(), scoped_debug_level(2):

        stbt.is_screen_black(f)
        stbt.is_screen_black(f, mask="videotestsrc-mask-non-black.png")
        stbt.is_screen_black(f, mask="videotestsrc-mask-no-video.png")
        stbt.is_screen_black(f, region=stbt.Region(0, 0, 160, 120))

        files = subprocess.check_output("find stbt-debug | sort", shell=True) \
                          .decode("utf-8")
        assert files == dedent("""\
            stbt-debug
            stbt-debug/00001
            stbt-debug/00001/grey.png
            stbt-debug/00001/index.html
            stbt-debug/00001/non_black.png
            stbt-debug/00001/source.png
            stbt-debug/00002
            stbt-debug/00002/grey.png
            stbt-debug/00002/index.html
            stbt-debug/00002/mask.png
            stbt-debug/00002/non_black.png
            stbt-debug/00002/source.png
            stbt-debug/00003
            stbt-debug/00003/grey.png
            stbt-debug/00003/index.html
            stbt-debug/00003/mask.png
            stbt-debug/00003/non_black.png
            stbt-debug/00003/source.png
            stbt-debug/00004
            stbt-debug/00004/grey.png
            stbt-debug/00004/index.html
            stbt-debug/00004/non_black.png
            stbt-debug/00004/source.png
            """)

        assert_expected("stbt-debug-expected-output/is_screen_black")
Пример #23
0
def navigate_to_stoprecordingconfirmationoption(optionName):

    optionName = _(optionName)
    print "Looking for stop recording confirmation option '%s'" % optionName

    for _ in range(2):
        current_selection_text = stbt.ocr(
            region=stbt.Region(x=392, y=550, right=610, bottom=595),
            mode=stbt.OcrMode.SINGLE_LINE,
            lang='nld',
            # tesseract_config={'load_system_dawg':False, 'load_freq_dawg':False},
        )
        print "stop recording confirmation option read as '%s'" % current_selection_text
        if ocr_utils.fuzzy_match(current_selection_text, optionName, 0.78):
            sleep(2)
            return {"status": True}
        stbt.press("KEY_DOWN")
        sleep(4)
    else:
        assert False, "Failed to find '%s' after pressing DOWN 2 times" % optionName
    def check_motion(self):
        """
        Detects if there is any motion in full screen
        Asserts if blackscreen is still seen after <timeout>
        :return:
        """

        #  import tests.core.bitmap
        #  for motionresult in stbt.detect_motion(timeout_secs=float(profile['MOTION_IMAGE_TIMEOUT']),
        #                                         mask=tests.core.bitmap.get_bitmap(self, "VideoMovementMaskCropped.png"),
        #                                         region=stbt.Region(x=127, y=71, width=1024, height=576)):
        #      if motionresult.motion:
        #          stbt.draw_text('Action                          : Fullscreen TV motion detected')
        #          break

        #  assert False, stbt.draw_text('Action                          : Motion TIMEOUT reached, %s seconds',
        #                               timeout=profile["MOTION_IMAGE_TIMEOUT"])

        return bool(stbt.detect_motion(timeout_secs=float(profile['MOTION_IMAGE_TIMEOUT']),
                                       mask=tests.core.bitmap.get_bitmap(self, "VideoMovementMaskCropped.png"),
                                       region=stbt.Region(x=127, y=71, width=1024, height=576)))
Пример #25
0
def test_region_replace():
    from nose.tools import raises

    r = stbt.Region(x=10, y=20, width=20, height=30)

    def t(kwargs, expected):
        assert r.replace(**kwargs) == expected

    @raises(ValueError)
    def e(kwargs):
        r.replace(**kwargs)

    # No change
    yield t, dict(x=10), r
    yield t, dict(x=10, width=20), r
    yield t, dict(x=10, right=30), r

    # Not allowed
    yield e, dict(x=1, width=2, right=3)
    yield e, dict(y=1, height=2, bottom=3)

    # Allowed  # pylint:disable=line-too-long
    yield t, dict(x=11), stbt.Region(x=11, y=r.y, width=19, height=r.height)
    yield t, dict(width=19), stbt.Region(x=10,
                                         y=r.y,
                                         width=19,
                                         height=r.height)
    yield t, dict(right=29), stbt.Region(x=10,
                                         y=r.y,
                                         width=19,
                                         height=r.height)
    yield t, dict(x=11, width=20), stbt.Region(x=11,
                                               y=r.y,
                                               width=20,
                                               height=r.height)
    yield t, dict(x=11, right=21), stbt.Region(x=11,
                                               y=r.y,
                                               width=10,
                                               height=r.height)
    yield t, dict(x=11, right=21, y=0, height=5), stbt.Region(x=11,
                                                              y=0,
                                                              width=10,
                                                              height=5)
Пример #26
0
def verify_recording_present(scope={}, validate=True):
    status = False
    programTitle = scope['programTitle']
    recording_program_title = stbt.ocr(
        region=stbt.Region(x=595, y=277, right=938, bottom=312),
        mode=stbt.OcrMode.SINGLE_LINE,
        lang='nld',
        # tesseract_config={'load_system_dawg':False, 'load_freq_dawg':False},
    )
    print("rec title" + str(recording_program_title))
    if ocr_utils.fuzzy_match(recording_program_title, programTitle, 0.78):
        print "Recording Present"
        status = True
    else:
        print "Recording is not available"
        status = False
    if validate:
        if status == False:
            assert "Icon not present on screen"
    else:
        return {"recordingfound": status}
    def progress_bar_progress(self):
        """A percentage (a float between 0.0 and 1.0) of the progress bar
         position.
        """
        r = stbt.Region(x=120, y=615, right=1160, bottom=640)
        m = stbt.match(tests.core.bitmap.get_bitmap(self, "ProgressBarRed.png"), frame=self._frame, region=r)
        if m:
            x = m.region.right
        else:
            # If the program has just started, it won't have matched
            # "progress-bar-red.png". Let's try a reference image with the
            # circle (the position indicator) at the left edge:
            m = stbt.match(tests.core.bitmap.get_bitmap(self, "ProgressBarWhite.png"), frame=self._frame, region=r)
            #  m = stbt.match("ProgressBarWhite.png", frame=self._frame,
            #                 region=r)
            if m:
                x = m.region.x
            else:
                # Progress bar not visible
                return None

        return (x - r.x) / r.width
Пример #28
0
 def testFunkcjonalny(self):
     self.testCzytnikaKarty()
     self.sprawdzUSB()
     if testsResults["usb"]:
         stbt.press("KEY_BACK", self.timeBeforePress)
         time.sleep(self.sleepTimeAfterUSBCheck)
     wejdzWUstawienia()
     stbt.press("KEY_DOWN", self.timeBeforePress)
     stbt.press("KEY_OK", self.timeBeforePress)
     time.sleep(self.sleepTimeBeforeOCR)
     self.sprawdzSN(input("Podaj SN dekodera: "))
     self.sprawdzWersjeOprogramowania()
     self.sprawdzSileIJakosSygnalu()
     stbt.press("KEY_BACK", self.timeBeforePress)
     stbt.press("KEY_DOWN", self.timeBeforePress)
     stbt.press("KEY_DOWN", self.timeBeforePress)
     stbt.press("KEY_OK", self.timeBeforePress)
     time.sleep(self.sleepTimeBeforeOCR)
     self.sprawdzSiec()
     if testsResults["ethernet"]:
         stbt.press("KEY_BACK", self.timeBeforePress)
         stbt.press("KEY_BACK", self.timeBeforePress)
     stbt.press("KEY_BACK", self.timeBeforePress)
     stbt.press("KEY_BACK", self.timeBeforePress)
     stbt.press("KEY_LEFT", self.timeBeforePress)
     stbt.press("KEY_OK", self.timeBeforePress)
     sprawdzWiadomosci()
     stbt.press("KEY_BACK", self.timeBeforePress)
     myPressUntilMatchText("TV RACHUNEK", "KEY_RIGHT",
                           stbt.Region(515, 599, width=242, height=54))
     stbt.press("KEY_OK", self.timeBeforePress)
     self.sprawdzRachunki()
     stbt.press("KEY_BACK", self.timeBeforePress)
     stbt.press("KEY_BACK", self.timeBeforePress)
     self.testWyswietlacza()
     time.sleep(sleepTimeAfterDisplayCheck)
     self.testKanalow()
     self.testKlawiszy()
Пример #29
0
 def testWygrzewanie(self):
     self.uruchomienieDekodera()
     #stbt.wait_for_match("obrazek po przejsciu aktywacji")
     self.ustawieniaFabryczne()
     stbt.mach_text("ANTENA TELEWIZJI NAZIEMNEJ", None,
                    stbt.Region(410, 162, width=460, height=30))
     stbt.press("KEY_RIGHT", Test.timeBeforePress)
     stbt.press("KEY_OK", Test.timeBeforePress)
     stbt.press("KEY_SETUP", Test.timeBeforePress)
     stbt.press("KEY_RIGHT", Test.timeBeforePress)
     self.TestADB.sprawdzRachunki()
     stbt.press("KEY_BACK", Test.timeBeforePress)
     stbt.press("KEY_LEFT", Test.timeBeforePress)
     stbt.press("KEY_LEFT", Test.timeBeforePress)
     self.TestADB.sprawdzWiadomosci()
     stbt.press("KEY_BACK", Test.timeBeforePress)
     stbt.press("KEY_LEFT", Test.timeBeforePress)
     stbt.press("KEY_LEFT", Test.timeBeforePress)
     stbt.press("KEY_DOWN", Test.timeBeforePress)
     stbt.press("KEY_OK", Test.timeBeforePress)
     self.TestADB.testParowaniaKarty()
     stbt.press("KEY_BACK", Test.timeBeforePress)
     stbt.press("KEY_BACK", Test.timeBeforePress)
Пример #30
0
def test_that_match_converts_greyscale_reference_image(filename):
    stbt.match(filename, frame=black())  # Doesn't raise
    stbt.match(stbt.load_image(filename), frame=black())


@pytest.mark.parametrize("match_method", [
    stbt.MatchMethod.SQDIFF,
    stbt.MatchMethod.SQDIFF_NORMED,
])
def test_that_if_image_doesnt_match_match_all_returns_empty_array(match_method):
    assert [] == list(stbt.match_all(
        'button.png', frame=stbt.load_image('black-full-frame.png'),
        match_parameters=mp(match_method=match_method)))


plain_buttons = [stbt.Region(_x, _y, width=135, height=44) for _x, _y in [
    (28, 1), (163, 1), (177, 75), (177, 119), (177, 163), (298, 1)]]
labelled_buttons = [stbt.Region(_x, _y, width=135, height=44) for _x, _y in [
    (1, 65), (6, 137)]]
overlapping_button = stbt.Region(123, 223, width=135, height=44)
overlapped_button = stbt.Region(3, 223, width=135, height=44)


@pytest.mark.parametrize("match_method", [
    stbt.MatchMethod.SQDIFF,
    stbt.MatchMethod.SQDIFF_NORMED,
    stbt.MatchMethod.CCORR_NORMED,
    stbt.MatchMethod.CCOEFF_NORMED,
])
def test_that_match_all_finds_all_matches(match_method):
    matches = list(m.region for m in stbt.match_all(