Exemplo n.º 1
0
    def test_doubling_of_frame_rate_should_not_influence_total_length(self):

        rate1 = 1
        rate2 = 2 * rate1

        (times1, length1) = morph.getTimes(self.mockCvfs, rate1, 1)
        (times2, length2) = morph.getTimes(self.mockCvfs, rate2, 1)

        self.assertEqual(length1, length2)
Exemplo n.º 2
0
    def test_doubling_of_frame_rate_should_not_influence_total_length(self):

        rate1 = 1
        rate2 = 2 * rate1

        (times1, length1) = morph.getTimes(self.mockCvfs, rate1, 1)
        (times2, length2) = morph.getTimes(self.mockCvfs, rate2, 1)

        self.assertEqual(length1, length2)
Exemplo n.º 3
0
    def test_doubling_speed_should_halve_times(self):

        speed1 = 1
        speed2 = 2 * speed1

        (times1, length1) = morph.getTimes(self.mockCvfs, 1, speed1)
        (times2, length2) = morph.getTimes(self.mockCvfs, 1, speed2)

        for t1, t2 in zip(times1, times2):
            self.assertEqual(t1, t2 * 2)
Exemplo n.º 4
0
    def test_doubling_of_frame_rate_should_double_times(self):

        rate1 = 1
        rate2 = 2 * rate1

        (times1, length1) = morph.getTimes(self.mockCvfs, rate1, 1)
        (times2, length2) = morph.getTimes(self.mockCvfs, rate2, 1)

        for t1, t2 in zip(times1, times2):
            self.assertEqual(t1 * 2, t2)
Exemplo n.º 5
0
    def test_doubling_speed_should_halve_times(self):

        speed1 = 1
        speed2 = 2 * speed1

        (times1, length1) = morph.getTimes(self.mockCvfs, 1, speed1)
        (times2, length2) = morph.getTimes(self.mockCvfs, 1, speed2)

        for t1, t2 in zip(times1, times2):
            self.assertEqual(t1, t2 * 2)
Exemplo n.º 6
0
    def test_doubling_of_frame_rate_should_double_times(self):

        rate1 = 1
        rate2 = 2 * rate1

        (times1, length1) = morph.getTimes(self.mockCvfs, rate1, 1)
        (times2, length2) = morph.getTimes(self.mockCvfs, rate2, 1)

        for t1, t2 in zip(times1, times2):
            self.assertEqual(t1 * 2, t2)
Exemplo n.º 7
0
    def test_triangularity_should_hold(self):

        newCvfs = [self.mockCvfs[-1], mockCVF(1, 0, 0)]
        (newTimes, newLength) = morph.getTimes(newCvfs, 1, 1)

        (oldTimes, oldLength) = morph.getTimes(self.mockCvfs, 1, 1)

        appendedCvfs = copy.deepcopy(self.mockCvfs)
        appendedCvfs.append(newCvfs[-1])
        (appendedTimes, appendedLength) = morph.getTimes(appendedCvfs, 1, 1)

        self.assertEqual(oldLength + newLength, appendedLength)
        self.assertEqual(appendedTimes[-1] - appendedTimes[-2], newTimes[-1])
Exemplo n.º 8
0
    def test_appending_to_input_should_append_to_time(self):

        newCvfs = copy.deepcopy(self.mockCvfs)
        newCvfs.append(mockCVF(4, 0, 0))

        (oldTimes, oldLength) = morph.getTimes(self.mockCvfs, 1, 1)
        (newTimes, newLength) = morph.getTimes(newCvfs, 1, 1)

        for (old, new) in zip(oldTimes, newTimes):
            self.assertEqual(old, new)

        self.assertGreater(newTimes[-1], oldTimes[-1])
        self.assertEqual(len(oldTimes) + 1, len(newTimes))
Exemplo n.º 9
0
    def test_appending_to_input_should_append_to_time(self):

        newCvfs = copy.deepcopy(self.mockCvfs)
        newCvfs.append(mockCVF(4, 0, 0))

        (oldTimes, oldLength) = morph.getTimes(self.mockCvfs, 1, 1)
        (newTimes, newLength) = morph.getTimes(newCvfs, 1, 1)

        for (old, new) in zip(oldTimes, newTimes):
            self.assertEqual(old, new)

        self.assertGreater(newTimes[-1], oldTimes[-1])
        self.assertEqual(len(oldTimes) + 1, len(newTimes))
Exemplo n.º 10
0
    def test_triangularity_should_hold(self):

        newCvfs = [self.mockCvfs[-1], mockCVF(1, 0, 0)]
        (newTimes, newLength) = morph.getTimes(newCvfs, 1, 1)

        (oldTimes, oldLength) = morph.getTimes(self.mockCvfs, 1, 1)

        appendedCvfs = copy.deepcopy(self.mockCvfs)
        appendedCvfs.append(newCvfs[-1])
        (appendedTimes, appendedLength) = morph.getTimes(appendedCvfs, 1, 1)

        self.assertEqual(oldLength + newLength, appendedLength)
        self.assertEqual(appendedTimes[-1] - appendedTimes[-2],
                         newTimes[-1])
Exemplo n.º 11
0
    def test_fixed_length_should_also_apply_to_zero_distance_points(self):
        mockCvfs = [mockCVF(0, 0, 0), mockCVF(0, 0, 0), mockCVF(0, 0, 0)]

        (times, length) = morph.getTimes(mockCvfs, 1, 1, 100)
        self.assertEqual(times[0], 0)
        self.assertEqual(times[1], 50)
        self.assertEqual(times[2], 100)
Exemplo n.º 12
0
    def test_one_length_cvf_should_have_one_length_times(self):

        mockCvfs = [mockCVF(0, 0, 0)]

        (times, length) = morph.getTimes(mockCvfs, 1, 1)

        self.assertEqual(len(times), 1)
        self.assertEqual(times[0], 0)
Exemplo n.º 13
0
    def test_one_length_cvf_should_have_one_length_times(self):

        mockCvfs = [mockCVF(0, 0, 0)]

        (times, length) = morph.getTimes(mockCvfs, 1, 1)

        self.assertEqual(len(times), 1)
        self.assertEqual(times[0], 0)
Exemplo n.º 14
0
    def test_two_length_cvf_should_have_two_length_times(self):
        mockCvfs = [
            mockCVF(0, 0, 0),
            mockCVF(1, 0, 0)
        ]

        (times, length) = morph.getTimes(mockCvfs, 1, 1)
        self.assertEqual(len(times), 2)
        self.assertNotEqual(times[0], times[1])
Exemplo n.º 15
0
 def test_last_element_of_times_should_be_fixed_if_fixed_length(self):
     mockCvfs = [
         mockCVF(0, 0, 0),
         mockCVF(1, 0, 0),
         mockCVF(1, 1, 0),
         mockCVF(1, 1, 1)
     ]
     (times, length) = morph.getTimes(mockCvfs, 1, 1, 10)
     self.assertEqual(times[-1], 10)
Exemplo n.º 16
0
 def test_last_element_of_times_should_be_fixed_if_fixed_length(self):
     mockCvfs = [
         mockCVF(0, 0, 0),
         mockCVF(1, 0, 0),
         mockCVF(1, 1, 0),
         mockCVF(1, 1, 1)
     ]
     (times, length) = morph.getTimes(mockCvfs, 1, 1, 10)
     self.assertEqual(times[-1], 10)
Exemplo n.º 17
0
    def test_fixed_length_times_should_only_differ_in_a_scalar(self):
        mockCvfs = [
            mockCVF(0, 0, 0),
            mockCVF(1, 0, 0),
            mockCVF(1, 1, 0),
            mockCVF(1, 1, 1)
        ]
        (times, length) = morph.getTimes(mockCvfs, 1, 1)
        (fixedTimes, fixedLength) = morph.getTimes(mockCvfs, 1, 1, 10)

        self.assertEqual(length, fixedLength)
        self.assertEqual(len(times), len(fixedTimes))

        scalar = fixedTimes[-1] / times[-1]

        for time, fixedTime in zip(times, fixedTimes):
            if time * fixedTime == 0:
                continue
            self.assertEqual(fixedTime / time, scalar)
Exemplo n.º 18
0
    def test_fixed_length_times_should_only_differ_in_a_scalar(self):
        mockCvfs = [
            mockCVF(0, 0, 0),
            mockCVF(1, 0, 0),
            mockCVF(1, 1, 0),
            mockCVF(1, 1, 1)
        ]
        (times, length) = morph.getTimes(mockCvfs, 1, 1)
        (fixedTimes, fixedLength) = morph.getTimes(mockCvfs, 1, 1, 10)

        self.assertEqual(length, fixedLength)
        self.assertEqual(len(times), len(fixedTimes))

        scalar = fixedTimes[-1] / times[-1]

        for time, fixedTime in zip(times, fixedTimes):
            if time * fixedTime == 0:
                continue
            self.assertEqual(fixedTime / time, scalar)
Exemplo n.º 19
0
    def test_fixed_length_should_also_apply_to_zero_distance_points(self):
        mockCvfs = [
            mockCVF(0, 0, 0),
            mockCVF(0, 0, 0),
            mockCVF(0, 0, 0)
        ]

        (times, length) = morph.getTimes(mockCvfs, 1, 1, 100)
        self.assertEqual(times[0], 0)
        self.assertEqual(times[1], 50)
        self.assertEqual(times[2], 100)
Exemplo n.º 20
0
    def test_two_length_cvf_should_have_two_length_times(self):
        mockCvfs = [mockCVF(0, 0, 0), mockCVF(1, 0, 0)]

        (times, length) = morph.getTimes(mockCvfs, 1, 1)
        self.assertEqual(len(times), 2)
        self.assertNotEqual(times[0], times[1])