예제 #1
0
def health_check(validate=True, scope=""):
    stbt.press("KEY_TV")
    dismissPopupIfPresent()
    stbt.press("KEY_INFO")
    if stbt.wait_until(lambda: infobanner.Infobanner()):
        print "Box is Up and responds to key presses"
        try:
            stbt.wait_for_motion()
            print "Video playback is present in Live TV"
            return {"status": True}
        except stbt.MotionTimeout:
            print "up key pressed"
            stbt.press("KEY_CHANNELUP")
            try:
                stbt.wait_for_motion()
                print "Video playback is present in Live TV"
                return {"status": True}
            except stbt.MotionTimeout:
                assert False, "Could not detect Video playback in Live TV"
    else:
        # TO DO else: <do one more IR event check>
        # if stbt.is_screen_black():
        stbt.press("KEY_MENU")
        if stbt.wait_until(lambda: not stbt.is_screen_black()):
            if stbt.wait_until(lambda: mainhub_page.MainHubPage()):
                sleep(1)
                print "Box is Up and responds to key presses"
                stbt.press("KEY_OK")
                if stbt.wait_until(lambda: not mainhub_page.MainHubPage()):
                    print "Dismissed Main Hub and tuned to live TV"
                else:
                    assert False, "Failed to tune to Live TV by OK press on Televisie from Main Hub"
                try:
                    stbt.wait_for_motion()
                    print "Video playback is present in Live TV"
                    return {"status": True}
                except stbt.MotionTimeout:
                    assert False, "Could not detect Video playback in Live TV"
            else:
                assert False, "Main_hub did not load. Health check failed"
        else:
            stbt.press("KEY_POWER")
            if stbt.wait_until(lambda: not stbt.is_screen_black(),
                               timeout_secs=30):
                if stbt.wait_until(lambda: mainhub_page.MainHubPage()):
                    sleep(1)
                    print "Box is Up and responds to key presses"
                    stbt.press("KEY_OK")
                    if stbt.wait_until(lambda: not mainhub_page.MainHubPage()):
                        print "Dismissed Main Hub and tuned to live TV"
                    else:
                        assert False, "Failed to tune to Live TV by OK press on Televisie from Main Hub"
                    try:
                        stbt.wait_for_motion()
                        print "Video playback is present in Live TV"
                        return {"status": True}
                    except stbt.MotionTimeout:
                        assert False, "Could not detect Video playback in Live TV"
            else:
                assert False, "TV frozen with black screen"
예제 #2
0
def test_is_screen_black_with_numpy_mask_and_region():
    frame = stbt.load_image("videotestsrc-full-frame.png")
    region = stbt.Region(x=160, y=180, right=320, bottom=240)
    mask = numpy.zeros((60, 160), dtype=numpy.uint8)
    mask[:, :80] = 255
    assert stbt.is_screen_black(frame, mask, 20, region)

    mask[:, :] = 255
    assert not stbt.is_screen_black(frame, mask, 20, region)
예제 #3
0
def test_is_screen_black_with_numpy_mask_and_region():
    frame = stbt.load_image("videotestsrc-full-frame.png")
    region = stbt.Region(x=160, y=180, right=320, bottom=240)
    mask = numpy.zeros((60, 160), dtype=numpy.uint8)
    mask[:, :80] = 255
    assert stbt.is_screen_black(frame, mask, 20, region)

    mask[:, :] = 255
    assert not stbt.is_screen_black(frame, mask, 20, region)
예제 #4
0
 def stbySwitchDetection(maxAttempts=10, sleepTime=1):
     counter = 0
     result = stbt.is_screen_black()
     while result.black == False and counter <= maxAttempts:
         time.sleep(sleepTime)
         result = stbt.is_screen_black()
         counter += 1
     if counter > maxAttempts:
         return False
     return True
예제 #5
0
def test_DVR_on_reboot():
    count = 0
    while True:
        if stbt.is_screen_black(): break
        count += 1
        sleep(3)
        assert count < 10, \
        "STB did not reboot within 30 seconds with osdiag RebootNow"
    count = 0
    while True:
        stbt.press('KEY_POWER')
        sleep(5)
        if stbt.match('images/menu/stick_around.png') or stbt.match(
                'images/menu/reboot_logo.png'):
            break
        sleep(5)
        count += 1
        assert count < 18, \
        "Stick Around screen is not shown after reboot within 3 minutes"
    stbt.wait_for_motion(timeout_secs=300)
    stbt.press('KEY_RECORD')
    assert stbt.wait_until(lambda: stbt.match("images/dvr/edit_ep_rec.png") or stbt.match("images/dvr/ch_bar_rec.png")), \
    "RECORD press on live TV did not set recording, or prompt for edit recording"
    mydvr_launch()
    count = 0
    while True:
        stbt.press('KEY_ENTER')
        if stbt.match('images/cta/watch.png'): break
        count += 1
        assert count < 16, \
        "Could not find recording to play in DVR page"
    stbt.press('KEY_ENTER')
    assert stbt.wait_for_motion(timeout_secs=20)
예제 #6
0
def measure_channel_change_time(key, mask):
    import google

    # start timer after key press
    stbt.press(key)
    start_time = time.time()

    assert stbt.wait_until(lambda: stbt.is_screen_black(mask=mask)), \
        "Screen never went black"

    for frame, _ in stbt.frames(timeout_secs=30):
        if not stbt.is_screen_black(mask=mask, frame=frame):
            end_time = frame.time
            break
    else:
        assert False, "Channel change didn't complete after 30s"

    google.GoogleSheet().record_measurement(
        start_time, "channel_change", {"duration": end_time - start_time})
    def check_black_screen(self):
        """
         Checks for a black screen.
         Asserts if blackscreen is still seen after <timeout>
        """
        stbt.draw_text(
            'Action                           : Wait until black screen is dismissed'
        )

        if not stbt.wait_until(
                lambda: stbt.is_screen_black(mask=tests.core.bitmap.get_bitmap(
                    self, "BlackScreenMaskCropped.png")),
                timeout_secs=float(profile["MOTION_IMAGE_TIMEOUT"])):
            assert True, stbt.draw_text(
                'Black Screen                    : Visible after timeout %s seconds',
                timeout=float(profile["MOTION_IMAGE_TIMEOUT"]))
예제 #8
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")
예제 #9
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)
        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")
예제 #10
0
def test_is_screen_black_with_numpy_mask():
    frame = stbt.load_image("videotestsrc-full-frame.png")
    mask = numpy.zeros((240, 320), dtype=numpy.uint8)
    mask[180:240, 160:213] = 255
    assert stbt.is_screen_black(frame, mask)
예제 #11
0
def test_is_screen_black_result():
    frame = stbt.load_image("almost-black.png")
    result = stbt.is_screen_black(frame)
    assert result
    assert numpy.all(result.frame == frame)
    assert result.black is True
예제 #12
0
def test_is_screen_black(frame, mask, threshold, region, expected):
    frame = stbt.load_image(frame)
    assert expected == bool(
        stbt.is_screen_black(frame, mask, threshold, region))
예제 #13
0
파일: test_hds.py 프로젝트: MichalK157/stbt
    def testAutodiag(self):
        scanedSN #zeskanowany SN dekodera
        self.sprawdzSN(scannedSN)
        stbt.press("KEY_OK", Test.timeBeforePress)
        for i in range(10):
            result = stbt.match_text("OK", None, stbt.Region(x=665, y=293 + 16 * i, width=30, height=16))
            if result == False:
                self.testsResults["hds_autodiag_hardware_test"] = False
                return
        stbt.prsss("KEY_DOWN", Test.timeBeforePress)
        for i in range(3):
            result = stbt.match_text("OK", None, stbt.Region(x=665, y=293 + 16 * i, width=30, height=16))
            if result == False:
                self.testsResults["hds_autodiag_hardware_test"] = False
                return
        stbt.press("KEY_MENU",  Test.timeBeforePress)
        stbt.press_until_match("KEY_DOWN", "./images/t1/hds_hard_disk.png", self.timeBeforePress, 5, region = stbt.Region(x=464, y=357, width=117, height=13))
        stbt.press("KEY_OK", Test.timeBeforePress)
        stbt.press("KEY_OK", Test.timeBeforePress)
        result = stbt.match_text("PASS")
        if result == False:
            self.testsResults["hdd"] = False
            return
        stbt.press("KEY_MENU",  Test.timeBeforePress)
        stbt.press("KEY_DOWN", Test.timeBeforePress)
        stbt.press("KEY_OK", Test.timeBeforePress)
        stbt.press("KEY_OK", Test.timeBeforePress)
        while True:
            time.sleep(2)
            if stbt.match_text("PASS", region = stbt.Region(x=663, y=290, width=70, height=20)):
                self.testsResults["hdd"] = True
                break
            elif stbt.match_text("FAIL", region = stbt.Region(x=663, y=290, width=70, height=20)):
                self.testsResults["hdd"] = False
                return
        stbt.press("KEY_MENU", Test.timeBeforePress)
        stbt.press("KEY_DOWN", Test.timeBeforePress)
        stbt.press("KEY_DOWN", Test.timeBeforePress)
        stbt.press("KEY_OK", Test.timeBeforePress)
        self.typeAutodiagPassword()
        while True:
            time.sleep(2)
            if stbt.match_text("PASS", region = stbt.Region(x=663, y=290, width=70, height=20)):
                self.testsResults["hdd"] = True
                break
            elif stbt.match_text("FAIL", region = stbt.Region(x=663, y=290, width=70, height=20)):
                self.testsResults["hdd"] = False
                return
        stbt.press("KEY_MENU", Test.timeBeforePress)
        stbt.press("KEY_MENU", Test.timeBeforePress)
        stbt.press_until_match("KEY_DOWN", "./images/t1/hds_autodiag_factory_settings.png", Test.timeBeforePress, 5, region = stbt.Region(x=464, y=371, width=212, height=21))
        stbt.press("KEY_OK", Test.timeBeforePress)
        self.typeAutodiagPassword()
        stbt.press("KEY_OK", Test.timeBeforePress)
        stbt.press("KEY_DOWN", Test.timeBeforePress)
        stbt.press("KEY_DOWN", Test.timeBeforePress)
        stbt.press("KEY_OK", Test.timeBeforePress)
        while True:
            time.sleep(2)
            if stbt.match_text("DONE", region = stbt.Region(x=637, y=292, width=78, height=14))):
                while True:
                    time.sleep(1)
                    if stbt.match_text("DONE", region = stbt.Region(x=636, y=309, width=70, height=14):
                        self.testsResults["hds_factory_settings"] = True
                        break
                    elif stbt.match_text("FAIL", region = stbt.Region(x=636, y=309, width=70, height=14):
                        self.testsResults["hds_factory_settings"] = False
                        return
                break
            elif stbt.match_text("FAIL", region = stbt.Region(x=637, y=292, width=78, height=14)):
                self.testsResults["hds_factory_settings"] = False
                return
        stbt.press("KEY_MENU", Test.timeBeforePress)
        stbt.press("KEY_MENU", Test.timeBeforePress)

    def wejdzWUstawienia(self):
        stbt.press("KEY_MENU", self.timeBeforePress)
        self.myPressUntilMatchText("USTAWIENIA", "KEY_RIGHT", stbt.Region(x=550, y=605, width=180, height=41), 10)
        stbt.press("KEY_OK", self.timeBeforePress)

    def typeAutodiagPassword(self):
        stbt.press("KEY_5", Test.timeBeforePress)
        stbt.press("KEY_5", Test.timeBeforePress)
        stbt.press("KEY_5", Test.timeBeforePress)

    def sprawdzRachunki(self):
        result = stbt.match_text("BRAK", None, stbt.Region(x=845, y=235, width=72, height=26))
        if result:
            self.testsResults["bills"] = True
        else:
            self.testsResults["bills"] = False

    def sprawdzWiadomosci(self):
        result = stbt.ocr(region = stbt.Region(x=101, y=135, width=1075, height=32))
        if result == "":
            self.testsResults["messages"] = True
        else:
            self.testsResults["messages"] = False

    def sprawdzHDD(self):
        today = stbt.ocr(region = stbt.Region(x=1026, y=35, width=86, height=33))
        recordingDate = ocr(region = stbt.Region(x=673, y=543, width=62, height=22))
        if recordingDate == today:
            stbt.press("KEY_PLAY", Test.timeBeforePress)
            time.sleep(10)
            stbt.press("KEY_PAUSE", Test.timeBeforePress)
            try:
                stbt.wait_for_motion(timeout_sec = 3, region = stbt.Region(x=10, y=11, width=1260, height=540))
            except MotionTimeout:
                stbt.press("KEY_REV", Test.timeBeforePress)
                if stbt.match_text("x4", region = stbt.Region(x=186, y=588, width=30, height=21)):
                    stbt.press("KEY_FWD", Test.timeBeforePress)
                    stbt.press("KEY_FWD", Test.timeBeforePress)
                    if stbt.match_text("x8", region = stbt.Region(x=186, y=588, width=30, height=21)):
                        selft.testsResults["hdd"] = True
                    else:
                        self.testsResults["hdd"] = False
                else:
                    self.testsResults["hdd"] = False
            else:
                self.testsResults["hdd"] = False
            stbt.press("KEY_STOP", Test.timeBeforePress)
            stbt.press("KEY_3", Test.timeBeforePress)
            stbt.press("KEY_OK", Test.timeBeforePress)
        else:
            self.testsResults["hdd"] = False

    def sprawdzSN(self, scannedSN):
        SN = stbt.ocr(region = stbt.Region(x=600, y=251, width=164, height=19))
        print("Odczytany SN: ", SN)  
        if SN != scannedSN:
            self.testsResults["sn"] = False
        else:
            self.testsResults["sn"] = True

    def sprawdzCzytnikKart(self):
        print("Wloz karte do czytnika.")
        result = myWaitWhileMatchText("BRAK KARTY", stbt.Region(x=555, y=127, width=165, height=33))
        if result:
            result = stbt.match("./images/t1/hds_smart_card_error.png", region = stbt.Region(x=555, y=127, width=165, height=33))
            if result:
                self.testsResults["card_reader"] = False
            else:
                self.testsResults["card_reader"] = True
        else:
            self.testsResults["card_reader"] = False

    def sprawdzMaxIndex(self):
        maxIndex = stbt.ocr(region = stbt.Region(x=669, y=418, width=56, height=35)) #stbt.ocr(None, stbt.Region(x=669, y=418, width=56, height=35), stbt.OcrMode.PAGE_SEGMENTATION_WITHOUT_OSD)
        if maxIndex == "0":
            self.testsResults["max_index"] = True
        else:
            self.testsResults["max_index"] = False

    def sprawdzSiec(self):
        ipTestResult = stbt.match_text("172.16", None, stbt.Region(x=655, y=233, width=56, height=24))
        if  ipTestResult == False:
            self.testsResults["ethernet"] = False
        else:
            self.testsResults["ethernet"] = True

    def sprawdzWersjeOprogramowania(self):
        softVersion = stbt.ocr(region = stbt.Region(x=811, y=323, width=47, height=21)) #stbt.ocr(None, stbt.Region(x=811, y=323, width=47, height=21), stbt.OcrMode.PAGE_SEGMENTATION_WITHOUT_OSD)
        if softVersion == currentUpdateVersions[0]uv or softVersion == currentUpdateVersions[1]:
            self.testsResults["soft_version"] = True
        else:
            self.testsResults["soft_version"] = False

    def sprawdzSileIJakosSygnalu(self):
        self.testsResults["signal_level"] = stbt.match("./images/t1/hds_signal_level.png", region = stbt.Region(x=743, y=324, width=111, height=19))

    def sprawdzUSB(self, port):
        print("Wloz Pendrive do gniazda USB umieszczonego z boku.")
        input = input("Czy dioda Pendrive swieci?\n1) Tak\n2) Nie")
        while input != "1" and input  != "2":
            input = input("Czy dioda Pendrive swieci?\n1) Tak\n2) Nie")
        if input == "1":
            self.testsResults[port] = True
        else:
            self.testsResults[port] = False

    def sprawdzTimeshifting(self):
        stbt.press("KEY_PAUSE", Test.timeBeforePress)
        try:
            stbt.wait_for_motion(timeout_sec = 3, region = stbt.Region(x=10, y=70, width=1260, height=480))
        except MotionTimeout:
            stbt.press("KEY_STOP", Test.timeBeforePress)
            try:
                stbt.wait_for_motion()
            except MotionTimeout:
                self.testsResults["timeshifting"] = False
            else:
                self.testsResults["timeshifting"] = True
        else:
            self.testsResults["timeshifting"] = False

    def sprawdzWyswietlacz(self):
        self.runChannel("888")
        input = input("Czy wyswietlacz swieci prawidlowo?\n1) Tak\n2) Nie")
        while input != "1" and input  != "2":
            input = input("Czy wyswietlacz swieci prawidlowo?\n1) Tak\n2) Nie")
        if input == "1":
            self.testsResults["display"] = True
        else
            self.testsResults["dispaly"] = False

    def sprawdzTVNaziemna(self):
        self.runChannel("998")
        input = input("Czy obraz na ekranie wyswietlany jest prawidlowo?\n1) Tak\n2) Nie")
        while input != "1" and input != "2":
            input = input("Czy obraz na ekranie wyswietlany jest prawidlowo?\n1) Tak\n2) Nie")
        if input == "1":
            self.testsResults["terrestrial_siganl_quality"] = True
        else:
            self.runChannel("994")
            input = input("Czy obraz na ekranie wyswietlany jest prawidlowo?\n1) Tak\n2) Nie")
            while input != "1" and input != "2":
                input = input("Czy obraz na ekranie wyswietlany jest prawidlowo?\n1) Tak\n2) Nie")
            if input == "1":
                self.testsResults["terrestrial_siganl_quality"] = True
            else:
                self.testsResults["terrestrial_siganl_quality"] = False
    
    def sprawdzPrzyciski(self, maxAttempts = 5):
        result = {}
        counter = 0
        print("Wcisnij kalwisz P-")
        detection = channelSwitchDetection(self.mainTestChannels[0])
        while detection[0] != 1 and counter < maxAttempts:
            detection = channelSwitchDetection(self.mainTestChannels[0])
            counter += 1
        if counter == maxAttempts:
            result["P-"] = False
        else:
            result["P-"] = True
        time.sleep(5)
        print("Wciśnij klawisz 'P+'")
        counter = 0
        detection = channelSwitchDetection(detection[1])
        while detection[0] != 2 and counter < maxAttempts:
            detection = channelSwitchDetection(detection[1])
            counter += 1
        if counter == maxAttempts:
            result["P+"] = False
        else:
            result["P+"] = True
        
        print("Wcisnij klawisz 'V+'")
        result["V+"] = self.volumeUpSwitchDetection()

        print("Wcisnij klawisz 'V-'")
        result["V-"] = self.volumeDownSwitchDetection()

        time.sleep(5)
        print("Wcisnij klawisz 'St-By'")
        counter = 0
        detection = stbySwitchDetection()
        while detection == False and counter < maxAttempts:
            detection = stbySwitchDetection()
            counter += 1
        if counter == maxAttempts:
            result["St-By"] = False
        else:
            result["St-By"] = True

        self.testsResults["switches"] = result

    def channelSwitchDetection(channelToCompare):
        result = [0, 0]
        try:
            stbt.wait_for_match("./images/t1/hds_up_arrow.png", region = stbt.Region(x=255, y=539, width=39, height=31)) # oczekiwanie na wcisnienie przycisku
        except stbt.MatchTimeout:
            result[0] = -1
            result[1] = channelToCompare
            return result
        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
        return result

    def stbySwitchDetection(maxAttempts = 5, sleepTime = 1):
        counter = 0
        result = stbt.is_screen_black()
        while result.black == False and counter <= maxAttempts:
            time.sleep(sleepTime)
            result = stbt.is_screen_black()
            counter += 1
        if counter > maxAttempts:
            return False
        return True

    def volumeUpSwitchDetection(self):
        try:
            stbt.wait_for_match("./images/t1/hds_max_volume_belt.png", region = stbt.Region(x=178, y=94, width=118, height=16))
        except stbt.MatchTimeout: 
            return False
        return True

    def volumeDownSwitchDetection(self):
        try:
            stbt.wait_for_match("./hds_part_volume_belt.png", region = stbt.Region(x=178, y=94, width=64, height=16))
        except stbt.MatchTimeout:
            return False
        else
            if stbt.match("./images/t1/hds_max_volume_belt.png", region = stbt.Region(x=178, y=94, width=118, height=16)):
                return False
            return True

    def lodeConfiguration(self, path):
        domeTree = minidom.parse(path)
        parameters = domeTree.firstChild # <parameters>
        paramChilds = parameters.childNodes

        soft = paramChilds[1] # <soft>
        softChilds = soft.getElementsByTagName("version")
        self.currentUpdateVersions.append(int(soft.childNodes[1].firstChild.data)) # <version>
        self.currentUpdateVersions.append(int(soft.childNodes[3].firstChild.data)) # <version>

        testChannels = paramChilds[7] # <test_channels>
        channels = testChannels.childNodes
        self.mainTestChannels.append(int(testChannels.childNodes[1].firstChild.data)) # <channel>
        self.mainTestChannels.append(int(testChannels.childNodes[3].firstChild.data)) # <channel>
        self.mainTestChannels.append(int(testChannels.childNodes[5].firstChild.data)) # <channel>
        self.mainTestChannels.append(int(testChannels.childNodes[7].firstChild.data)) # <channel>
        self.alternativeTestChannels.append(int(testChannels.childNodes[9].firstChild.data)) # <channel>
        self.alternativeTestChannels.append(int(testChannels.childNodes[11].firstChild.data)) # <channel>
        self.alternativeTestChannels.append(int(testChannels.childNodes[13].firstChild.data)) # <channel>
        self.alternativeTestChannels.append(int(testChannels.childNodes[15].firstChild.data)) # <channel>
        self.mainTerrestrialTestChannel = testChannels.childNodes[17].firstChild.data # <channel>
        self.alternativeTerrestrialTestChannel = testChannels.childNodes[19].firstChild.data # <channel>
예제 #14
0
def test_is_screen_black(frame, mask, threshold, region, expected):
    frame = stbt.load_image(frame)
    assert expected == bool(
        stbt.is_screen_black(frame, mask, threshold, region))
예제 #15
0
def test_is_screen_black_with_numpy_mask():
    frame = stbt.load_image("videotestsrc-full-frame.png")
    mask = numpy.zeros((240, 320), dtype=numpy.uint8)
    mask[180:240, 160:213] = 255
    assert stbt.is_screen_black(frame, mask)
예제 #16
0
def test_is_screen_black_result():
    frame = stbt.load_image("almost-black.png")
    result = stbt.is_screen_black(frame)
    assert result
    assert numpy.all(result.frame == frame)
    assert result.black is True