def make_matrix(self, width, height, **kwds): driver = DriverBase(num=width * height) return Matrix(driver, width=width, height=height, maker=self.maker, **kwds)
def test_trivial(self): driver = DriverBase(num=4) for i in range(len(driver._buf)): driver._buf[i] = 23 # randomize self.assertTrue(all(driver._buf)) driver.set_colors([(0, 0, 0)] * 4, 0) driver._render() self.assertFalse(any(driver._buf)) # It wrote zeroes!
def matrix_test(self, width=16, height=16): d = DriverBase(num=width * height) self.matrix = Matrix(d, width=width, height=height, maker=self.maker) yield # Perform your operation here. self.dump() expected = getattr(matrix_results, self.name_of_test()) actual = self.to_strings() if expected != actual: log.printer('Expected:', *(repr(s) for s in expected), sep='\n') log.printer('Actual:', *(repr(s) for s in actual), sep='\n') self.assertTrue(False)
def test_gamma1(self): driver = DriverBase(num=4, gamma=gamma.LPD8806) expected = [128, 128, 128, 128, 128, 132, 128, 128, 151, 128, 128, 190] self.do_test(driver, expected)
def test_permute2(self): driver = DriverBase(num=4, c_order=ChannelOrder.BRG) expected = [0, 0, 0, 64, 1, 8, 128, 2, 16, 192, 3, 24] self.do_test(driver, expected)
def test_permute(self): driver = DriverBase(num=4, c_order=ChannelOrder.GRB) expected = [0, 0, 0, 8, 1, 64, 16, 2, 128, 24, 3, 192] self.do_test(driver, expected)
def test_simple(self): driver = DriverBase(num=4) expected = [0, 0, 0, 1, 8, 64, 2, 16, 128, 3, 24, 192] self.do_test(driver, expected)
def led(): driver = DriverBase(num=PIXEL_COUNT) return Strip(driver)