+
+ DummyControl dummy = DummyControl::New();
+ DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
+
+ Property::Index TEST_PROPERTY1 = 1;
+ Property::Index TEST_PROPERTY2 = 2;
+
+ Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get();
+ Toolkit::Visual::Base visual1;
+ Toolkit::Visual::Base visual2;
+
+ Property::Map map;
+ map[Visual::Property::TYPE] = Visual::COLOR;
+ map[ColorVisual::Property::MIX_COLOR] = Color::RED;
+
+ Property::Map map2;
+ map[Visual::Property::TYPE] = Visual::COLOR;
+ map[ColorVisual::Property::MIX_COLOR] = Color::BLUE;
+
+ visual1 = visualFactory.CreateVisual(map);
+ DALI_TEST_CHECK(visual1);
+
+ visual2 = visualFactory.CreateVisual(map);
+ DALI_TEST_CHECK(visual2);
+
+ // Register index with a color visual
+ dummyImpl.RegisterVisual(TEST_PROPERTY1, visual1);
+ // Register second index with a color visual
+ dummyImpl.RegisterVisual(TEST_PROPERTY2, visual2);
+
+ application.GetScene().Add(dummy);
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_CHECK(dummy.GetRendererCount() == 2u);
+ DALI_TEST_CHECK(dummyImpl.IsVisualEnabled(TEST_PROPERTY1) == true);
+ DALI_TEST_CHECK(dummyImpl.IsVisualEnabled(TEST_PROPERTY1) == true);
+ DALI_TEST_CHECK(dummy.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE) == true);
+ dummyImpl.EnableVisual(TEST_PROPERTY2, false);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK(dummy.GetRendererCount() == 1u);
+
+ // Remove control from stage, visual should be removed from stage too
+ application.GetScene().Remove(dummy);
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK(dummy.GetRendererCount() == 0u);
+
+ application.GetScene().Add(dummy);
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK(dummy.GetRendererCount() == 1u);
+
+ DALI_TEST_CHECK(dummyImpl.IsVisualEnabled(TEST_PROPERTY1) == true);
+ DALI_TEST_CHECK(dummyImpl.IsVisualEnabled(TEST_PROPERTY2) == false);