def test_as_rgb(self): space = mock.MagicMock(spec_set=minecart.color.ColorSpace) value = object() color = minecart.color.Color(space, value) space.as_rgb.return_value = rgb = object() self.assertIs(rgb, color.as_rgb()) space.as_rgb.assert_called_once_with(value)
def test_as_rgb(self): space = mock.MagicMock(spec_set=minecart.color.ColorSpace) value = object() color = minecart.color.Color(space, value) space.as_rgb.return_value = rgb = object() self.assertIs(rgb, color.as_rgb()) space.as_rgb.assert_called_once_with(value)
def test_no_alternate_n4(self): family = minecart.color.ColorSpaceFamily('ICCBased', minecart.color.ICCSpace) attrs = {'N': 4} stream = pdfminer.pdftypes.PDFStream(attrs, b'') space = family.make_space([stream]) self.assertIs(space.alternate, minecart.color.DEVICE_CMYK) color = space.make_color((.25, .25, .25, 0)) self.assertEqual(color.as_rgb(), (.75, .75, .75))
def test_no_alternate_n4(self): family = minecart.color.ColorSpaceFamily( 'ICCBased', minecart.color.ICCSpace ) attrs = {'N': 4} stream = pdfminer.pdftypes.PDFStream(attrs, b'') space = family.make_space([stream]) self.assertIs(space.alternate, minecart.color.DEVICE_CMYK) color = space.make_color((.25, .25, .25, 0)) self.assertEqual(color.as_rgb(), (.75, .75, .75))