X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-ControlImpl.cpp;h=6965f358da2206eba0a5b865ec6f440726ca25c7;hb=92c67ea7a5d7218acb4e59d6dd3d9065788bda04;hp=4bc5808f7121f4e49e786bfe6e62ae61686d0246;hpb=a881757839b7abb008873a68c67e17b3ba39669b;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp index 4bc5808..6965f35 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp @@ -21,6 +21,7 @@ // Need to override adaptor classes for toolkit test harness, so include // test harness headers before dali headers. #include +#include "toolkit-style-monitor.h" #include #include @@ -55,7 +56,7 @@ int UtcDaliControlImplNew(void) DALI_TEST_CHECK( !Control::DownCast(control) ); - control = ControlImpl::New(); + control = Toolkit::Internal::Control::New(); DALI_TEST_CHECK( Control::DownCast(control) ); END_TEST; @@ -653,13 +654,13 @@ int UtcDaliControlImplStyleChange(void) Actor actor = Actor::New(); dummy.Add(actor); - DALI_TEST_EQUALS( dummyImpl.styleChangeCalled, false, TEST_LOCATION ); + DALI_TEST_EQUALS( dummyImpl.fontChangeCalled, false, TEST_LOCATION ); StyleChange styleChange; styleChange.defaultFontChange = true; - Dali::StyleMonitor styleMonitor = application.GetAdaptor().GetToolkitStyleMonitor(); + Dali::StyleMonitor styleMonitor = StyleMonitor::Get(); styleMonitor.EmitStyleChangeSignal(styleChange); - DALI_TEST_EQUALS( dummyImpl.styleChangeCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS( dummyImpl.fontChangeCalled, true, TEST_LOCATION ); Stage::GetCurrent().Remove(dummy); END_TEST; @@ -733,3 +734,84 @@ int UtcDaliControlImplKeyInputFocusLost(void) } END_TEST; } + +int UtcDaliControlImplTypeRegistry(void) +{ + ToolkitTestApplication application; + + // Register Type + TypeInfo type; + type = TypeRegistry::Get().GetTypeInfo( "Control" ); + DALI_TEST_CHECK( type ); + BaseHandle handle = type.CreateInstance(); + DALI_TEST_CHECK( handle ); + + // Check if it's a control + DALI_TEST_CHECK( Control::DownCast(handle) ); + END_TEST; +} + + +/////////////////////////////////////////////////////////////////////////////////////////////////// +namespace +{ +static bool MouseWheelEventCallback(Actor actor, const MouseWheelEvent& event) +{ + return false; +} +} + +int UtcDaliControlImplMouseWheelEvent(void) +{ + ToolkitTestApplication application; + + { + DummyControl dummy = DummyControl::New( true ); + DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); + + dummy.SetSize(100.0f, 100.0f); + dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); + Stage::GetCurrent().Add(dummy); + + dummy.MouseWheelEventSignal().Connect(&MouseWheelEventCallback); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + DALI_TEST_EQUALS( dummyImpl.mouseWheelEventCalled, false, TEST_LOCATION ); + + // simulate a mouse wheel event + Vector2 screenCoordinates( 10.0f, 10.0f ); + Integration::MouseWheelEvent event(0, 0u, screenCoordinates, 1, 1000u); + application.ProcessEvent(event); + DALI_TEST_EQUALS( dummyImpl.mouseWheelEventCalled, true, TEST_LOCATION ); + + Stage::GetCurrent().Remove(dummy); + } + + // Ensure full code coverage + { + DummyControl dummy = DummyControl::New(); + + dummy.SetSize(100.0f, 100.0f); + dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); + Stage::GetCurrent().Add(dummy); + + dummy.MouseWheelEventSignal().Connect(&MouseWheelEventCallback); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); + + // simulate a mouse wheel event + Vector2 screenCoordinates( 20.0f, 20.0f ); + Integration::MouseWheelEvent event(0, 0u, screenCoordinates, 1, 1000u); + application.ProcessEvent(event); + + Stage::GetCurrent().Remove(dummy); + } + END_TEST; +}