Exemple #1
0
    def test_RGBListHasBlankInFront(self):
        mock_pressureHistory = mock.create_autospec(PressureHistory)
        mock_pressureHistory.normalized.return_value = (
            0, ) * PressureHistory.MAXLEN

        ledAdapter = LEDMatrixAdapter(mock_pressureHistory)
        self.assertEqual(ledAdapter.asHatRGBList()[0], (0, 0, 0))
Exemple #2
0
    def test_RGBListIs64ElementsLong(self):
        mock_pressureHistory = mock.create_autospec(PressureHistory)
        mock_pressureHistory.normalized.return_value = (
            0, ) * PressureHistory.MAXLEN

        ledAdapter = LEDMatrixAdapter(mock_pressureHistory)
        self.assertEqual(len(ledAdapter.asHatRGBList()), 64)
Exemple #3
0
    def testHueListMapsNoneToNone(self):
        mock_pressureHistory = mock.create_autospec(PressureHistory)
        mock_pressureHistory.normalized.return_value = (None, )

        ledAdapter = LEDMatrixAdapter(mock_pressureHistory)
        hueList = ledAdapter.asHueList()
        self.assertEqual(hueList, (None, ))
Exemple #4
0
    def test_hueListIsInRedBlueRange(self):
        mock_pressureHistory = mock.create_autospec(PressureHistory)
        mock_pressureHistory.normalized.return_value = (0, 1)

        ledAdapter = LEDMatrixAdapter(mock_pressureHistory)
        hueList = ledAdapter.asHueList()
        self.assertEqual(hueList, (ledAdapter.MINHUE, ledAdapter.MAXHUE))
Exemple #5
0
    def test_extermeNormalizedPressuresResultInRedToBlueWithBlankInFront(self):
        mock_pressureHistory = mock.create_autospec(PressureHistory)
        mock_pressureHistory.normalized.return_value = (0, 1)

        ledAdapter = LEDMatrixAdapter(mock_pressureHistory)

        self.assertEqual(ledAdapter.asHatRGBList(),
                         ((0, 0, 0), (255, 0, 0), (0, 0, 255)))
Exemple #6
0
 def test_normalRangeTo255Range(self):
     self.assertEqual(LEDMatrixAdapter.to255Range((0, 0.5, 1)),
                      (int(0), int(0.5 * 255), int(255)))
Exemple #7
0
 def test_hueListretrievesNormalizedHistory(self):
     mock_pressureHistory = mock.create_autospec(PressureHistory)
     ledAdapter = LEDMatrixAdapter(mock_pressureHistory)
     ledAdapter.asHueList()
     self.assertTrue(mock_pressureHistory.normalized.called,
                     "Didn't get the normalized pressure history")