Added custom control test for Builder 52/199452/1
authorPaul Wisbey <p.wisbey@samsung.com>
Mon, 11 Feb 2019 12:02:07 +0000 (12:02 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Mon, 11 Feb 2019 12:02:07 +0000 (12:02 +0000)
Change-Id: I13e841780547cb9ae98b65ee40c79bcd14a27570

automated-tests/src/dali-toolkit/utc-Dali-Builder.cpp

index 77439d4..4d8bfe0 100644 (file)
@@ -28,6 +28,7 @@
 #include <dali-toolkit/dali-toolkit.h>
 #include <test-button.h>
 #include <test-animation-data.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <test-button.h>
 #include <test-animation-data.h>
+#include <dummy-control.h>
 
 
 #define STRINGIFY(A)#A
 
 
 #define STRINGIFY(A)#A
@@ -1791,6 +1792,43 @@ int UtcDaliBuilderBuilderControl(void)
   END_TEST;
 }
 
   END_TEST;
 }
 
+int UtcDaliBuilderCustomControl(void)
+{
+  ToolkitTestApplication application;
+
+  std::string json(
+    "{"
+       "\"stage\":"
+       "[{"
+         "\"type\": \"DummyControl\","
+         "\"name\": \"I can haz custom Control\""
+      "}]"
+    "}"
+  );
+
+  Actor rootActor = Actor::New();
+  Stage::GetCurrent().Add( rootActor );
+
+  Builder builder = Builder::New();
+  builder.LoadFromString( json );
+  builder.AddActors( rootActor );
+
+  application.SendNotification();
+  application.Render();
+
+  Actor customControl = rootActor.FindChildByName( "I can haz custom Control" );
+
+  // Test that we have the correct type of custom control
+  DummyControl dummyControl = DummyControl::DownCast( customControl );
+  DALI_TEST_CHECK( dummyControl );
+  if( dummyControl )
+  {
+    DALI_TEST_CHECK( typeid(dummyControl.GetImplementation()) == typeid(DummyControlImpl) );
+  }
+
+  END_TEST;
+}
+
 int UtcDaliBuilderActionsWithParams(void)
 {
   ToolkitTestApplication application;
 int UtcDaliBuilderActionsWithParams(void)
 {
   ToolkitTestApplication application;