コード例 #1
0
 def test_get_image(self):
     image = ImageResource("question")
     value_type = ConstantValue(image=image)
     self.assertEqual(
         value_type.get_image(self.model, [0], [0]),
         image
     )
コード例 #2
0
 def test_get_color_rgba_changed(self):
     value_type = ConstantValue(color=Color())
     with self.assertTraitChanges(value_type, 'updated'):
         value_type.color.rgba = (0.4, 0.2, 0.6, 0.8)
     self.assertEqual(
         value_type.get_color(self.model, [0], [0]),
         Color(rgba=(0.4, 0.2, 0.6, 0.8))
     )
コード例 #3
0
 def test_has_image_true(self):
     value_type = ConstantValue(image="question")
     self.assertTrue(value_type.has_image(self.model, [0], [0]))
コード例 #4
0
 def test_has_image(self):
     value_type = ConstantValue()
     self.assertFalse(value_type.has_image(self.model, [0], [0]))
コード例 #5
0
 def test_get_color(self):
     value_type = ConstantValue(color='rebeccapurple')
     self.assertEqual(
         value_type.get_color(self.model, [0], [0]),
         Color(rgba=(0.4, 0.2, 0.6, 1.0))
     )
コード例 #6
0
 def test_get_color_default(self):
     value_type = ConstantValue()
     self.assertIsNone(value_type.get_color(self.model, [0], [0]))
コード例 #7
0
 def test_has_color(self):
     value_type = ConstantValue(color=Color(rgba=(0.4, 0.2, 0.6, 0.8)))
     self.assertTrue(value_type.has_color(self.model, [0], [0]))
コード例 #8
0
 def test_has_color_default(self):
     value_type = ConstantValue()
     self.assertFalse(value_type.has_color(self.model, [0], [0]))
コード例 #9
0
 def test_text_changed(self):
     value_type = ConstantValue()
     with self.assertTraitChanges(value_type, 'updated'):
         value_type.text = 'something'
     self.assertEqual(value_type.text, 'something')
コード例 #10
0
 def test_get_text(self):
     value_type = ConstantValue(text="something")
     self.assertEqual(
         value_type.get_text(self.model, [0], [0]),
         "something"
     )
コード例 #11
0
 def test_has_text_true(self):
     value_type = ConstantValue(text="something")
     self.assertTrue(value_type.has_text(self.model, [0], [0]))
コード例 #12
0
 def test_defaults(self):
     value_type = ConstantValue()
     self.assertEqual(value_type.text, "")
     self.assertEqual(value_type.tooltip, "")
コード例 #13
0
 def test_has_tooltip_true(self):
     value_type = ConstantValue(tooltip="something")
     self.assertTrue(value_type.has_tooltip(self.model, [0], [0]))
コード例 #14
0
 def test_image_changed(self):
     value_type = ConstantValue()
     image = ImageResource("question")
     with self.assertTraitChanges(value_type, 'updated'):
         value_type.image = image
     self.assertEqual(value_type.image, image)
コード例 #15
0
 def test_get_image_none(self):
     value_type = ConstantValue()
     image = value_type.get_image(self.model, [0], [0])
     self.assertEqual(image.name, "image_not_found")