コード例 #1
0
ファイル: test_Clock.py プロジェクト: bbc/pydvbcss
    def test_setCorrelationAndSpeed(self):
        a = self.newSysClock(tickRate=1000000)
        b = CorrelatedClock(a, 1000, correlation=Correlation(0, 0))
        b.speed = 1.0

        db = MockDependent()
        b.bind(db)

        b.setCorrelationAndSpeed(Correlation(5, 0), 2)
        db.assertNotificationsEqual([b])
        self.assertEqual(b.toParentTicks(10), 5005)
コード例 #2
0
ファイル: test_Clock.py プロジェクト: bbc/pydvbcss
    def test_changeCorrelationToTuple(self):
        mockTime = self.mockTime

        b = self.newSysClock()
        mockTime.timeNow = 5020.8
        c = CorrelatedClock(b, 1000, correlation=(0, 300))
        self.assertAlmostEqual(c.ticks, 5020.8 * 1000 + 300, places=5)

        c.correlation = (50000, 320)
        self.assertEqual(c.correlation, Correlation(50000, 320))
        self.assertAlmostEqual(c.ticks,
                               (int(5020.8 * 1000000) - 50000) / 1000 + 320,
                               places=5)

        c.setCorrelationAndSpeed((50000, 400), 1.0)
        self.assertEqual(c.correlation, Correlation(50000, 400))
        self.assertAlmostEqual(c.ticks,
                               (int(5020.8 * 1000000) - 50000) / 1000 + 400,
                               places=5)