示例#1
0
    def test_hexa_simple(self):
        str = '#abc'
        color = get_color(str)
        self.assertEqual(color.hexval(), '0xaabbcc')

        str = '#aabbcc'
        color = get_color(str)
        self.assertEqual(color.hexval(), '0xaabbcc')
示例#2
0
    def test_hexa_simple(self):
        str = '#abc'
        color = get_color(str)
        self.assertEqual(color.hexval(), '0xaabbcc')

        str = '#aabbcc'
        color = get_color(str)
        self.assertEqual(color.hexval(), '0xaabbcc')
示例#3
0
    def test_wrong_color(self):
        str = ''
        color = get_color(str)
        self.assertEqual(color.hexval(), '0x000000')

        str = '#abt'
        color = get_color(str)
        self.assertEqual(color.hexval(), '0x000000')

        str = '#aabbtt'
        color = get_color(str)
        self.assertEqual(color.hexval(), '0x000000')

        str = 'cian'
        color = get_color(str)
        self.assertEqual(color.hexval(), '0x000000')
示例#4
0
 def test_name(self):
     for data in (('green', '0x008000'),
                  ('purple', '0x800080'),
                  ('cyan', '0x00ffff')):
         name, expected = data
         color = get_color(name)
         self.assertEqual(color.hexval(), expected)
示例#5
0
    def test_wrong_color(self):
        str = ''
        color = get_color(str)
        self.assertEqual(color.hexval(), '0x000000')

        str = '#abt'
        color = get_color(str)
        self.assertEqual(color.hexval(), '0x000000')

        str = '#aabbtt'
        color = get_color(str)
        self.assertEqual(color.hexval(), '0x000000')

        str = 'cian'
        color = get_color(str)
        self.assertEqual(color.hexval(), '0x000000')
示例#6
0
 def test_rgb(self):
     str = 'rgb(230, 100, 180)'
     color = get_color(str)
     self.assertEqual(color.hexval(), '0xe664b4')
示例#7
0
 def test_rgb(self):
     str = 'rgb(230, 100, 180)'
     color = get_color(str)
     self.assertEqual(color.hexval(), '0xe664b4')
示例#8
0
 def test_name(self):
     for data in (('green', '0x008000'), ('purple', '0x800080'),
                  ('cyan', '0x00ffff')):
         name, expected = data
         color = get_color(name)
         self.assertEqual(color.hexval(), expected)