/*
- * Copyright (c) 2015 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.
DALI_TEST_CHECK( popup2 == popup );
// Additional check to ensure object is created by checking if it's registered.
- ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ ObjectRegistry registry = application.GetCore().GetObjectRegistry();
DALI_TEST_CHECK( registry );
gObjectCreatedCallBackCalled = false;
Actor footerActor = Actor::New();
// The confirmation popup can use any control type for the ok or cancel buttons.
- // It requires that the name is "control-ok" to provide the "control-signal-ok" signal.
+ // It requires that the name is "controlOk" to provide the "controlSignalOk" signal.
PushButton buttonOK = PushButton::New();
- buttonOK.SetName( "control-ok" );
+ buttonOK.SetProperty( Dali::Actor::Property::NAME, "controlOk" );
footerActor.Add( buttonOK );
PushButton buttonCancel = PushButton::New();
- buttonCancel.SetName( "control-cancel" );
+ buttonCancel.SetProperty( Dali::Actor::Property::NAME, "controlCancel" );
footerActor.Add( buttonCancel );
popup.SetFooter( footerActor );
- // Tell the confirmation popup to connect to the signal in our button called "on-stage".
- popup.SetProperty( Toolkit::ConfirmationPopup::Property::CONNECT_SIGNAL_OK_SELECTED, "on-stage" );
+ // Tell the confirmation popup to connect to the signal in our button called "onScene".
+ popup.SetProperty( Toolkit::ConfirmationPopup::Property::CONNECT_SIGNAL_OK_SELECTED, "onScene" );
+ std::string resultProperty;
+ DALI_TEST_CHECK( popup.GetProperty( Toolkit::ConfirmationPopup::Property::CONNECT_SIGNAL_OK_SELECTED ).Get( resultProperty ) );
+ DALI_TEST_EQUALS( resultProperty, "onScene", TEST_LOCATION );
// Connect to the confirmation popup's OK signal. This signal is dynamically created upon connection.
gSignalReceivedOK = false;
gSignalReceivedCancel = false;
TestConnectionTrackerObject* testTracker = new TestConnectionTrackerObject();
- popup.ConnectSignal( testTracker, "control-signal-ok", ConfirmationPopupOKTestFunctor() );
+ popup.ConnectSignal( testTracker, "controlSignalOk", ConfirmationPopupOKTestFunctor() );
// Check no signal has occurred yet.
DALI_TEST_CHECK( !gSignalReceivedOK );
DALI_TEST_CHECK( !gSignalReceivedCancel );
// Provoke the signal.
- Stage::GetCurrent().Add( popup );
+ application.GetScene().Add( popup );
// Check the signal has occurred.
DALI_TEST_CHECK( gSignalReceivedOK );
// Remove the popup from the stage, and connect the cancel signal.
popup.Unparent();
- popup.SetProperty( Toolkit::ConfirmationPopup::Property::CONNECT_SIGNAL_CANCEL_SELECTED, "on-stage" );
- popup.ConnectSignal( testTracker, "control-signal-cancel", ConfirmationPopupCancelTestFunctor() );
+ popup.SetProperty( Toolkit::ConfirmationPopup::Property::CONNECT_SIGNAL_CANCEL_SELECTED, "onScene" );
+ DALI_TEST_CHECK( popup.GetProperty( Toolkit::ConfirmationPopup::Property::CONNECT_SIGNAL_CANCEL_SELECTED ).Get( resultProperty ) );
+ DALI_TEST_EQUALS( resultProperty, "onScene", TEST_LOCATION );
+
+ popup.ConnectSignal( testTracker, "controlSignalCancel", ConfirmationPopupCancelTestFunctor() );
// Check the cancel signal has not occurred yet.
DALI_TEST_CHECK( gSignalReceivedOK );
DALI_TEST_CHECK( !gSignalReceivedCancel );
// Provoke the signal.
- Stage::GetCurrent().Add( popup );
+ application.GetScene().Add( popup );
// Check the cancel signal has occurred.
DALI_TEST_CHECK( gSignalReceivedOK );
Actor footerActor = Actor::New();
PushButton buttonOK = PushButton::New();
- buttonOK.SetName( "control-ok-misnamed" );
+ buttonOK.SetProperty( Dali::Actor::Property::NAME, "controlOkMisnamed" );
popup.SetFooter( buttonOK );
- // Tell the confirmation popup to connect to the signal in our button called "on-stage".
- popup.SetProperty( Toolkit::ConfirmationPopup::Property::CONNECT_SIGNAL_OK_SELECTED, "on-stage" );
+ // Tell the confirmation popup to connect to the signal in our button called "onScene".
+ popup.SetProperty( Toolkit::ConfirmationPopup::Property::CONNECT_SIGNAL_OK_SELECTED, "onScene" );
// Connect to the confirmation popup's OK signal.
gSignalReceivedOK = false;
- // The connection will fail at this point as no actor with the name "control-ok" will be located.
+ // The connection will fail at this point as no actor with the name "controlOk" will be located.
TestConnectionTrackerObject* testTracker = new TestConnectionTrackerObject();
- popup.ConnectSignal( testTracker, "control-signal-ok", ConfirmationPopupOKTestFunctor() );
+ popup.ConnectSignal( testTracker, "controlSignalOk", ConfirmationPopupOKTestFunctor() );
// Check no signal has occurred yet.
DALI_TEST_CHECK( !gSignalReceivedOK );
// Provoke the signal.
- Stage::GetCurrent().Add( popup );
+ application.GetScene().Add( popup );
// Check the signal has still not occurred, as our button was incorrectly named.
DALI_TEST_CHECK( !gSignalReceivedOK );
END_TEST;
}
+int UtcDaliConfirmationPopupTypeRegistryCreation(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( " UtcDaliConfirmationPopupTypeRegistryCreation" );
+
+ TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( "ConfirmationPopup" );
+ DALI_TEST_CHECK( typeInfo )
+
+ BaseHandle baseHandle = typeInfo.CreateInstance();
+ DALI_TEST_CHECK( baseHandle )
+
+ Toolkit::Popup popup = Toolkit::Popup::DownCast( baseHandle );
+ popup.SetProperty( Popup::Property::ANIMATION_DURATION, 0.0f );
+
+ application.GetScene().Add( popup );
+ popup.SetDisplayState( Toolkit::Popup::SHOWN );
+
+ application.SendNotification();
+ application.Render();
+
+ // Check the popup is shown.
+ DALI_TEST_EQUALS( popup.GetDisplayState(), Popup::SHOWN, TEST_LOCATION );
+
+ END_TEST;
+}
+