1from PyObjCTools.TestSupport import * 2from AppKit import * 3import array 4import sys 5 6class TestRegressions (TestCase): 7 def testQualifiersInSignature(self): 8 NSColor.redColor().getRed_green_blue_alpha_(None, None, None, None) 9 10 def testMethods(self): 11 self.assertResultIsBOOL(NSColor.ignoresAlpha) 12 self.assertArgIsBOOL(NSColor.setIgnoresAlpha_, 0) 13 14 space = NSColorSpace.adobeRGB1998ColorSpace() 15 color = NSColor.colorWithColorSpace_components_count_(space, (0.1, 0.2, 0.3, 0.4), 4) 16 self.assertIsInstance(color, NSColor) 17 18 color = NSColor.colorWithCalibratedRed_green_blue_alpha_(0, 0, 0, 0) 19 r, g, b, a = color.getRed_green_blue_alpha_(None, None, None, None) 20 self.assertIsInstance(r, float) 21 self.assertIsInstance(g, float) 22 self.assertIsInstance(b, float) 23 self.assertIsInstance(a, float) 24 25 color = NSColor.colorWithCalibratedHue_saturation_brightness_alpha_(0.1, 0.2, 0.3, 0.4) 26 h, s, b, a = color.getHue_saturation_brightness_alpha_(None, None, None, None) 27 self.assertIsInstance(h, float) 28 self.assertIsInstance(s, float) 29 self.assertIsInstance(b, float) 30 self.assertIsInstance(a, float) 31 32 color = NSColor.colorWithCalibratedWhite_alpha_(0.1, 0.2) 33 w, a = color.getWhite_alpha_(None, None) 34 self.assertIsInstance(w, float) 35 self.assertIsInstance(a, float) 36 37 color = NSColor.colorWithDeviceCyan_magenta_yellow_black_alpha_(1, 1, 1, 1, 1) 38 c, m, y, b, a = color.getCyan_magenta_yellow_black_alpha_(None, None, None, None, None) 39 self.assertIsInstance(c, float) 40 self.assertIsInstance(m, float) 41 self.assertIsInstance(y, float) 42 self.assertIsInstance(b, float) 43 self.assertIsInstance(a, float) 44 45 if sys.maxint > 2**32: 46 a = array.array('d', [0] * 6) 47 else: 48 a = array.array('f', [0] * 6) 49 v = color.getComponents_(a) 50 self.assertEqual(a[0], 1.0) 51 52 def testConstants(self): 53 self.assertIsInstance(NSSystemColorsDidChangeNotification, unicode) 54 55if __name__ == "__main__": 56 main() 57