/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
namespace
{
bool gOnRelayout = false;
+
+static bool gKeyInputFocusCallBackCalled;
+
+static void TestKeyInputFocusCallback( Control control )
+{
+ tet_infoline(" TestKeyInputFocusCallback");
+
+ gKeyInputFocusCallBackCalled = true;
+}
} // namespace
///////////////////////////////////////////////////////////////////////////////////////////////////
mDaliProperty( Property::INVALID_INDEX ),
mSizeSet( Vector3::ZERO ),
mTargetSize( Vector3::ZERO ),
- mNego( nego )
+ mNego( nego ),
+ mDepth( 0u )
{
}
+
/**
* Destructor
*/
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
Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
ControlWrapper controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl );
- Stage::GetCurrent().Add( controlWrapper );
+ application.GetScene().Add( controlWrapper );
application.SendNotification();
application.Render();
Actor child = Actor::New();
child.SetResizePolicy( Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS );
- child.SetSize(150, 150);
+ child.SetProperty( Actor::Property::SIZE, Vector2(150, 150) );
application.SendNotification();
application.Render();
{
ToolkitTestApplication application;
- Test::ObjectDestructionTracker objectDestructionTracker;
+ Test::ObjectDestructionTracker objectDestructionTracker( application.GetCore().GetObjectRegistry() );
{
Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
{
ToolkitTestApplication application;
- Test::ObjectDestructionTracker objectDestructionTracker;
+ Test::ObjectDestructionTracker objectDestructionTracker( application.GetCore().GetObjectRegistry() );
{
Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
DALI_TEST_EQUALS( controlWrapperImpl->GetVisual( TEST_PROPERTY ), visual, TEST_LOCATION );
DALI_TEST_EQUALS( controlWrapperImpl->IsVisualEnabled( TEST_PROPERTY ), false, TEST_LOCATION );
- Stage::GetCurrent().Add( controlWrapper );
+ application.GetScene().Add( controlWrapper );
// Render and notify
application.SendNotification();
DALI_TEST_EQUALS( controlWrapperImpl->IsVisualEnabled( TEST_PROPERTY ), false, TEST_LOCATION );
- DALI_TEST_EQUALS( controlWrapper.OnStage(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( controlWrapper.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ), true, TEST_LOCATION );
controlWrapperImpl->EnableVisual( TEST_PROPERTY, true );
DALI_TEST_EQUALS( controlWrapperImpl->IsVisualEnabled( TEST_PROPERTY ), false, TEST_LOCATION );
DALI_TEST_EQUALS( visual.GetDepthIndex(), 10, TEST_LOCATION );
- Stage::GetCurrent().Add( controlWrapper );
+ application.GetScene().Add( controlWrapper );
// Render and notify
application.SendNotification();
DALI_TEST_EQUALS( controlWrapperImpl->IsVisualEnabled( TEST_PROPERTY ), false, TEST_LOCATION );
- DALI_TEST_EQUALS( controlWrapper.OnStage(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( controlWrapper.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ), true, TEST_LOCATION );
controlWrapperImpl->EnableVisual( TEST_PROPERTY, true );
//DummyControl actor = DummyControl::New();
controlWrapper.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
- controlWrapper.SetName("Actor1");
- controlWrapper.SetColor(Color::CYAN);
- Stage::GetCurrent().Add(controlWrapper);
+ controlWrapper.SetProperty( Dali::Actor::Property::NAME,"Actor1");
+ controlWrapper.SetProperty( Actor::Property::COLOR,Color::CYAN);
+ application.GetScene().Add(controlWrapper);
Animation anim = controlWrapperImpl->CreateTransition( transition );
DALI_TEST_CHECK( ! anim );
Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
ControlWrapper controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl );
- Stage::GetCurrent().Add( controlWrapper );
+ application.GetScene().Add( controlWrapper );
// "background" property
Property::Map rendererMap;
controlWrapper.SetProperty( Control::Property::BACKGROUND, rendererMap );
Property::Value propertyValue = controlWrapper.GetProperty( Control::Property::BACKGROUND );
Property::Map* resultMap = propertyValue.GetMap();
- DALI_TEST_CHECK( resultMap->Find( Visual::Property::TYPE ) );
- DALI_TEST_EQUALS( resultMap->Find( Visual::Property::TYPE )->Get<int>(), (int)Visual::COLOR, TEST_LOCATION );
+ DALI_TEST_CHECK( resultMap->Find( Toolkit::Visual::Property::TYPE ) );
+ DALI_TEST_EQUALS( resultMap->Find( Toolkit::Visual::Property::TYPE )->Get<int>(), (int)Visual::COLOR, TEST_LOCATION );
DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR ) );
DALI_TEST_EQUALS( resultMap->Find( ColorVisual::Property::MIX_COLOR )->Get<Vector4>(), Color::RED, TEST_LOCATION );
tet_infoline("Test that the control wrapper's visuals can be animated by name when registered");
ToolkitTestApplication application;
- Test::ObjectDestructionTracker objectDestructionTracker;
+ Test::ObjectDestructionTracker objectDestructionTracker( application.GetCore().GetObjectRegistry() );
{
Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
// Register to self
controlWrapperImpl->TestRegisterVisual( index, visual );
- Stage::GetCurrent().Add( controlWrapper );
- controlWrapper.SetSize( 100, 100 );
+ application.GetScene().Add( controlWrapper );
+ controlWrapper.SetProperty( Actor::Property::SIZE, Vector2( 100, 100 ) );
application.SendNotification();
application.Render(0); // Trigger animation start
DALI_TEST_EQUALS( objectDestructionTracker.IsDestroyed(), false, TEST_LOCATION ); // Control not destroyed yet
DALI_TEST_EQUALS( controlWrapperImpl->GetVisual( index ), visual, TEST_LOCATION );
- Stage::GetCurrent().Remove( controlWrapper );
+ application.GetScene().Remove( controlWrapper );
}
DALI_TEST_EQUALS( objectDestructionTracker.IsDestroyed(), true, TEST_LOCATION ); // Should be destroyed
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;
+}