static void UtcDaliPageNew() { ToolkitTestApplication application; tet_infoline("UtcDaliPageNew"); Page naviItem; // Check that this handle is uninitialized DALI_TEST_CHECK( !naviItem ); naviItem = Page::New(); // Check that the Dali resource is successfully created DALI_TEST_CHECK( naviItem ); Page naviItem2( naviItem ); DALI_TEST_CHECK( naviItem2 == naviItem ); // Additional check to ensure the object is created by checking whether it is registered ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); DALI_TEST_CHECK( registry ); gObjectCreatedCallBackCalled = false; registry.ObjectCreatedSignal().Connect( TestCallback ); { Page naviItem = Page::New(); } DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); }
int UtcDaliObjectRegistrySignalImageActorCreated(void) { TestApplication application; ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); static const char* TestImageFilename = "icon_wrt.png"; Image image = ResourceImage::New(TestImageFilename); bool verified = false; TestImageActorCallback test(verified); Dali::RefObject* objectPointer = NULL; TestObjectDestroyedCallback test2(verified, objectPointer); registry.ObjectCreatedSignal().Connect(&application, test); registry.ObjectDestroyedSignal().Connect(&application, test2); { ImageActor actor = ImageActor::New(image); DALI_TEST_CHECK( test.mSignalVerified ); verified = false; objectPointer = actor.GetObjectPtr(); } DALI_TEST_CHECK( test.mSignalVerified ); END_TEST; }
int UtcDaliObjectRegistrySignalCameraCreated(void) { TestApplication application; ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); bool verified = false; TestCameraActorCallback test(verified); Dali::RefObject* objectPointer = NULL; TestObjectDestroyedCallback test2(verified, objectPointer); registry.ObjectCreatedSignal().Connect(&application, test); registry.ObjectDestroyedSignal().Connect(&application, test2); { CameraActor actor = CameraActor::New(); DALI_TEST_CHECK( test.mSignalVerified ); verified = false; objectPointer = actor.GetObjectPtr(); } DALI_TEST_CHECK( test.mSignalVerified ); END_TEST; }
int UtcDaliConfirmationPopupNewP( void ) { ToolkitTestApplication application; tet_infoline( " UtcDaliConfirmationPopupNewP" ); // Create the ConfirmationPopup. ConfirmationPopup popup; DALI_TEST_CHECK( !popup ); popup = ConfirmationPopup::New(); DALI_TEST_CHECK( popup ); ConfirmationPopup popup2( popup ); DALI_TEST_CHECK( popup2 == popup ); // Additional check to ensure object is created by checking if it's registered. ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); DALI_TEST_CHECK( registry ); gObjectCreatedCallBackCalled = false; registry.ObjectCreatedSignal().Connect( &TestCallback ); { ConfirmationPopup popup = ConfirmationPopup::New(); } DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); END_TEST; }
int UtcDaliFocusManagerGet(void) { ToolkitTestApplication application; tet_infoline(" UtcDaliFocusManagerGet"); FocusManager manager; //Ensure object is created by checking if it's registered ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); DALI_TEST_CHECK(registry); gObjectCreatedCallBackCalled = false; registry.ObjectCreatedSignal().Connect( &TestCallback ); { manager = FocusManager::Get(); DALI_TEST_CHECK(manager); } DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); FocusManager newManager = FocusManager::Get(); DALI_TEST_CHECK(newManager); // Check that focus manager is a singleton DALI_TEST_CHECK(manager == newManager); END_TEST; }
int UtcDaliStageGetObjectRegistryP(void) { TestApplication app; Stage stage = Stage::GetCurrent(); ObjectRegistry objectRegistry = stage.GetObjectRegistry(); // Object registry tests are covered in their own module. // However we want a basic test to confirm the returned registry is valid and works. bool verified = false; ActorCreatedFunctor test( verified ); objectRegistry.ObjectCreatedSignal().Connect( &app, test ); Actor actor = Actor::New(); DALI_TEST_CHECK( test.mSignalVerified ); END_TEST; }
// Positive test case for a method int UtcDaliTextInputConstruction(void) { ToolkitTestApplication application; tet_infoline("Testing New constructor"); TextInput textInput = TextInput::New(); DALI_TEST_CHECK(textInput); //Additional check to ensure object is created by checking if it's registered ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); DALI_TEST_CHECK( registry ); gObjectCreatedCallBackCalled = false; registry.ObjectCreatedSignal().Connect(&TestCallback); { TextInput textInput = TextInput::New(); } DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); END_TEST; }
int UtcDaliObjectRegistrySignalShaderEffectCreated(void) { TestApplication application; ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); static const char* VertexSource = "void main()\n" "{\n" " gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\n" " vTexCoord = aTexCoord;\n" "}\n"; static const char* FragmentSource = "void main()\n" "{\n" " gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n" "}\n"; bool verified = false; TestShaderEffectCallback test(verified); Dali::RefObject* objectPointer = NULL; TestObjectDestroyedCallback test2(verified, objectPointer); registry.ObjectCreatedSignal().Connect(&application, test); registry.ObjectDestroyedSignal().Connect(&application, test2); { ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource ); DALI_TEST_CHECK( test.mSignalVerified ); verified = false; objectPointer = effect.GetObjectPtr(); } DALI_TEST_CHECK( test.mSignalVerified ); END_TEST; }
int UtcDaliBubbleEmitterNew(void) { ToolkitTestApplication application; tet_infoline(" UtcDaliBubbleEmitterNew "); // Test default constructor BubbleEmitter emitter; DALI_TEST_CHECK( !emitter ); // Test object creation Image shapeImage = CreateSolidColorImage( application, Color::GREEN, 5, 5 ); emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 200, Vector2( 5.f, 10.f )); DALI_TEST_CHECK( emitter ); // Additional check to ensure object is created by checking if it's registered ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); DALI_TEST_CHECK( registry ); gObjectCreatedCallBackCalled = false; registry.ObjectCreatedSignal().Connect( &TestCallback ); { BubbleEmitter emitter = BubbleEmitter::New( Vector2(50.f,50.f),shapeImage, 200, Vector2( 5.f, 10.f )); } DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); // Test copy constructor BubbleEmitter emitterCopy( emitter ); DALI_TEST_CHECK( emitterCopy ); // Test down cast Handle handleEmitter; handleEmitter = emitter; BubbleEmitter downCastEmitter = BubbleEmitter::DownCast( handleEmitter ); DALI_TEST_CHECK( downCastEmitter ); END_TEST; }