class TestBlockModel_comBlock(TestCase): def setUp(self): """Do the test basic setup.""" diagram = Diagram(MainWindow()) block = Block(diagram, None) self.blockmodel = BlockModel(block) # ----------------------------------------------------------------------x def test_get_color(self): self.blockmodel.color = "200:200:25:150" self.assertIsNotNone(self.blockmodel.get_color()) self.blockmodel.color = "#F322123ACBED" self.assertIsNotNone(self.blockmodel.get_color()) self.blockmodel.color = "" self.assertEqual(0, self.blockmodel.get_color()) # ----------------------------------------------------------------------x def test_get_color_as_rgba(self): self.blockmodel.color = "#F322123ACBED" self.assertEqual("#F322123ACBED", self.blockmodel.get_color_as_rgba()) self.blockmodel.color = "200:200:25:150" self.assertEqual("rgba(200,200,25,150)", self.blockmodel.get_color_as_rgba()) self.blockmodel.color = "#F32123" self.assertEqual("#F32123", self.blockmodel.get_color_as_rgba()) self.blockmodel.color = "" self.assertEqual("rgba()", self.blockmodel.get_color_as_rgba()) # ----------------------------------------------------------------------x def test_set_properties(self): data = None self.assertIsNone(self.blockmodel.set_properties(data)) data = { "name": "mosaicode_c_opencv.extensions.opencv.not", "label": "Not", "value": "True" } self.assertIsNone(self.blockmodel.set_properties(data)) # ----------------------------------------------------------------------x def test_get_properties(self): self.assertEqual([], self.blockmodel.get_properties()) self.blockmodel.properties = ["teste1", "teste2", "teste3"] self.assertEqual(["teste1", "teste2", "teste3"], self.blockmodel.get_properties())
class TestBlockModel(TestCase): def setUp(self): """Do the test basic setup.""" self.blockmodel = BlockModel(None) # ----------------------------------------------------------------------x def test_get_color(self): self.blockmodel.color = "200:200:25:150" self.assertIsNotNone(self.blockmodel.get_color()) self.blockmodel.color = "#F322123ACBED" self.assertIsNotNone(self.blockmodel.get_color()) self.blockmodel.color = "" self.assertEqual(0, self.blockmodel.get_color()) # ----------------------------------------------------------------------x def test_get_color_as_rgba(self): self.blockmodel.color = "#F322123ACBED" self.assertEqual("#F322123ACBED", self.blockmodel.get_color_as_rgba()) self.blockmodel.color = "200:200:25:150" self.assertEqual("rgba(200,200,25,150)", self.blockmodel.get_color_as_rgba()) self.blockmodel.color = "#F32123" self.assertEqual("#F32123", self.blockmodel.get_color_as_rgba()) self.blockmodel.color = "" self.assertEqual("rgba()", self.blockmodel.get_color_as_rgba()) # ----------------------------------------------------------------------x def test_set_properties(self): data = None self.assertIsNone(self.blockmodel.set_properties(data)) data = {"label": ("Type"), "name": "type", "value": "True"} self.assertIsNone(self.blockmodel.set_properties(data)) # ----------------------------------------------------------------------x def test_get_properties(self): self.assertEqual([], self.blockmodel.get_properties()) self.blockmodel.properties = ["teste1", "teste2", "teste3"] self.assertEqual(["teste1", "teste2", "teste3"], self.blockmodel.get_properties())
class TestBlockModel(TestCase): def setUp(self): """Do the test basic setup.""" plugin = Plugin() self.block_model = BlockModel(plugin) # ----------------------------------------------------------------------x def test_get_output_port_name(self): self.block_model.get_output_port_name(10) # ----------------------------------------------------------------------x def test_get_input_port_name(self): self.block_model.get_input_port_name(10) # ----------------------------------------------------------------------x def test_get_id(self): self.block_model.set_id(10) id = self.block_model.get_id() assert id == 10 # ----------------------------------------------------------------------x def test_set_id(self): self.block_model.set_id(10) # ----------------------------------------------------------------------x def test_get_type(self): self.block_model.get_type() # ----------------------------------------------------------------------x def test_get_xml(self): self.block_model.get_xml() # ----------------------------------------------------------------------x def test_get_help(self): self.block_model.get_help() # ----------------------------------------------------------------------x def test_get_properties(self): self.block_model.get_properties() # ----------------------------------------------------------------------x def test_set_properties(self): self.block_model.set_properties(10) # ----------------------------------------------------------------------x def test_get_language(self): self.block_model.get_language() # ----------------------------------------------------------------------x def test_get_plugin(self): self.block_model.get_plugin() # ----------------------------------------------------------------------x def test_get_label(self): self.block_model.get_description() print 1 # ----------------------------------------------------------------------x def test_get_icon(self): self.block_model.get_icon() # ----------------------------------------------------------------------x def test_get_color(self): self.block_model.get_color() # ----------------------------------------------------------------------x def test_get_in_types(self): self.block_model.get_in_types() # ----------------------------------------------------------------------x def test_get_out_types(self): self.block_model.get_out_types() # ----------------------------------------------------------------------x def test_generate_dealloc(self): self.block_model.generate_dealloc() # ----------------------------------------------------------------------x def test_generate_out_dealloc(self): self.block_model.generate_out_dealloc()