X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-ControlImpl.cpp;h=43e362ec01b4144f45835d6d7be0be3bca0c4167;hb=ca85044443ecab7375b63c0a1c946c99a8bb77a4;hp=75a2d85fb664986dfbc20bb228342c3923157bcd;hpb=b6ed3548dda72ec79dda14612880f1fc06bed2df;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 75a2d85..43e362e 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ #include #include #include +#include #include "dummy-control.h" @@ -437,7 +438,7 @@ int UtcDaliControlImplStageConnection(void) END_TEST; } -int UtcDaliControlImplSizeSet(void) +int UtcDaliControlImplSizeSetP(void) { ToolkitTestApplication application; @@ -449,22 +450,28 @@ int UtcDaliControlImplSizeSet(void) application.Render(); application.SendNotification(); - DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, true, TEST_LOCATION ); // Called from size negotiation + DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, false, TEST_LOCATION ); // Size not set, no onSizeSet called Vector2 size(100.0f, 200.0f); - dummy.SetSize(size); + dummy.SetSize( size ); + + DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, false, TEST_LOCATION ); // Size is going to get negotiated, no onSizeSet called - application.Render(); application.SendNotification(); application.Render(); - application.SendNotification(); - DALI_TEST_EQUALS(size, dummy.GetCurrentSize().GetVectorXY(), TEST_LOCATION); + DALI_TEST_EQUALS( size, dummy.GetCurrentSize().GetVectorXY(), TEST_LOCATION ); DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, true, TEST_LOCATION ); Stage::GetCurrent().Remove(dummy); } - // Ensure full code coverage + END_TEST; +} + +int UtcDaliControlImplSizeSet2P(void) +{ + ToolkitTestApplication application; + { DummyControl dummy = DummyControl::New(); Stage::GetCurrent().Add(dummy); @@ -472,15 +479,13 @@ int UtcDaliControlImplSizeSet(void) Vector2 size(100.0f, 200.0f); DALI_TEST_CHECK( size != dummy.GetCurrentSize().GetVectorXY() ); - application.Render(); application.SendNotification(); + application.Render(); dummy.SetSize(size); - application.Render(); application.SendNotification(); application.Render(); - application.SendNotification(); DALI_TEST_EQUALS(size, dummy.GetCurrentSize().GetVectorXY(), TEST_LOCATION); @@ -489,6 +494,7 @@ int UtcDaliControlImplSizeSet(void) END_TEST; } + int UtcDaliControlImplSizeAnimation(void) { ToolkitTestApplication application; @@ -586,10 +592,7 @@ int UtcDaliControlImplTouchEvent(void) END_TEST; } -/////////////////////////////////////////////////////////////////////////////////////////////////// - - -int UtcDaliControlImplKeyEvent(void) +int UtcDaliControlImplHoverEvent(void) { ToolkitTestApplication application; @@ -597,18 +600,21 @@ int UtcDaliControlImplKeyEvent(void) DummyControl dummy = DummyControl::New( true ); DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); + dummy.SetSize( Vector2( 100.0f, 100.0f ) ); + dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(dummy); - dummy.SetKeyInputFocus(); application.Render(); application.SendNotification(); application.Render(); application.SendNotification(); - DALI_TEST_EQUALS( dummyImpl.keyEventCalled, false, TEST_LOCATION ); - Integration::KeyEvent keyEvent; - application.ProcessEvent(keyEvent); - DALI_TEST_EQUALS( dummyImpl.keyEventCalled, true, TEST_LOCATION ); + DALI_TEST_EQUALS( dummyImpl.hoverEventCalled, false, TEST_LOCATION ); + Integration::HoverEvent event(1); + TouchPoint point( 1, TouchPoint::Motion, 20.0f, 20.0f ); + event.AddPoint( point ); + application.ProcessEvent( event ); + DALI_TEST_EQUALS( dummyImpl.hoverEventCalled, true, TEST_LOCATION ); Stage::GetCurrent().Remove(dummy); } @@ -617,52 +623,69 @@ int UtcDaliControlImplKeyEvent(void) { DummyControl dummy = DummyControl::New(); + dummy.SetSize( Vector2( 100.0f, 100.0f ) ); + dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(dummy); - dummy.SetKeyInputFocus(); application.Render(); application.SendNotification(); application.Render(); application.SendNotification(); - Integration::KeyEvent keyEvent; - application.ProcessEvent(keyEvent); + Integration::HoverEvent event(1); + TouchPoint point( 1, TouchPoint::Motion, 20.0f, 20.0f ); + event.AddPoint( point ); + application.ProcessEvent( event ); Stage::GetCurrent().Remove(dummy); } END_TEST; } -int UtcDaliControlImplStyleChange(void) +/////////////////////////////////////////////////////////////////////////////////////////////////// + + +int UtcDaliControlImplKeyEvent(void) { ToolkitTestApplication application; - DummyControl dummy = DummyControl::New( true ); - DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); + { + DummyControl dummy = DummyControl::New( true ); + DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); - Stage::GetCurrent().Add(dummy); + Stage::GetCurrent().Add(dummy); + dummy.SetKeyInputFocus(); - application.Render(); - application.SendNotification(); - application.Render(); - application.SendNotification(); + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); - // Add a Control and normal Actor as children - DummyControl dummyChild = DummyControl::New(); - dummy.Add(dummyChild); + DALI_TEST_EQUALS( dummyImpl.keyEventCalled, false, TEST_LOCATION ); + Integration::KeyEvent keyEvent; + application.ProcessEvent(keyEvent); + DALI_TEST_EQUALS( dummyImpl.keyEventCalled, true, TEST_LOCATION ); - Actor actor = Actor::New(); - dummy.Add(actor); + Stage::GetCurrent().Remove(dummy); + } - DALI_TEST_EQUALS( dummyImpl.fontChangeCalled, false, TEST_LOCATION ); - StyleChange styleChange; - styleChange.defaultFontChange = true; - Dali::StyleMonitor styleMonitor = StyleMonitor::Get(); - styleMonitor.EmitStyleChangeSignal(styleChange); + // Ensure full code coverage + { + DummyControl dummy = DummyControl::New(); + + Stage::GetCurrent().Add(dummy); + dummy.SetKeyInputFocus(); + + application.Render(); + application.SendNotification(); + application.Render(); + application.SendNotification(); - DALI_TEST_EQUALS( dummyImpl.fontChangeCalled, true, TEST_LOCATION ); + Integration::KeyEvent keyEvent; + application.ProcessEvent(keyEvent); - Stage::GetCurrent().Remove(dummy); + Stage::GetCurrent().Remove(dummy); + } END_TEST; } @@ -815,3 +838,24 @@ int UtcDaliControlImplMouseWheelEvent(void) } END_TEST; } + +int UtcDaliControlImplSetStyleName(void) +{ + ToolkitTestApplication application; + + { + DummyControl dummy = DummyControl::New( true ); + DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); + + dummy.SetSize( Vector2( 100.0f, 100.0f ) ); + dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); + Stage::GetCurrent().Add(dummy); + + dummy.SetStyleName("TestStyle"); + + DALI_TEST_CHECK( dummy.GetStyleName() == "TestStyle" ); + + Stage::GetCurrent().Remove(dummy); + } + END_TEST; +}