X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-ControlWrapper.cpp;h=0921d6119c2657c721f05d87e6cc64a45bf0fba6;hp=cc1a62ee8923566012f2ecb2e67160c26ed44ad6;hb=2951af4fa549b8383cebb3464fd14eb86a993e25;hpb=ca4209fb071e5c353a7e528098a2e497765118d8 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ControlWrapper.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ControlWrapper.cpp index cc1a62e..0921d61 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ControlWrapper.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ControlWrapper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -51,6 +51,15 @@ void utc_dali_toolkit_control_wrapper_cleanup(void) namespace { bool gOnRelayout = false; + +static bool gKeyInputFocusCallBackCalled; + +static void TestKeyInputFocusCallback( Control control ) +{ + tet_infoline(" TestKeyInputFocusCallback"); + + gKeyInputFocusCallBackCalled = true; +} } // namespace /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -78,9 +87,11 @@ struct TestCustomControl : public Toolkit::Internal::ControlWrapper mDaliProperty( Property::INVALID_INDEX ), mSizeSet( Vector3::ZERO ), mTargetSize( Vector3::ZERO ), - mNego( nego ) + mNego( nego ), + mDepth( 0u ) { } + /** * Destructor */ @@ -95,6 +106,7 @@ struct TestCustomControl : public Toolkit::Internal::ControlWrapper OnInitialize( name ); } + using Control::OnInitialize; ///< To tell the compiler that we really do want to overload OnInitialize in this class & were not trying to override it virtual void OnInitialize( const char* name ) {} // From Toolkit::Internal::ControlWrapper @@ -807,3 +819,23 @@ int UtcDaliControlWrapperAnimateVisual(void) END_TEST; } + +int UtcDaliControlWrapperEmitKeyFocusSignal(void) +{ + ToolkitTestApplication application; + + Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT ); + ControlWrapper controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl ); + + gKeyInputFocusCallBackCalled = false; + controlWrapper.KeyInputFocusGainedSignal().Connect(&TestKeyInputFocusCallback); + + application.SendNotification(); + application.Render(); + + controlWrapperImpl->EmitKeyInputFocusSignal( true ); + + DALI_TEST_CHECK( gKeyInputFocusCallBackCalled ); + + END_TEST; +} \ No newline at end of file