+
+int UtcDaliPopupPropertyAutoHide(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline( " UtcDaliPopupPropertyAutoHide" );
+
+ // Create the Popup actor
+ Popup popup = Popup::New();
+ ConnectStateSignals( popup );
+
+ Actor container = Actor::New();
+ PushButton button1 = PushButton::New();
+ button1.SetSize( DEFAULT_BUTTON_SIZE.GetVectorXY() );
+ container.Add( button1 );
+ popup.SetFooter( container );
+
+ popup.SetProperty( Popup::Property::ANIMATION_DURATION, 0.0f );
+ popup.SetProperty( Popup::Property::AUTO_HIDE_DELAY, 200 );
+
+ Stage::GetCurrent().Add( popup );
+
+ DALI_TEST_EQUALS( gPopupState, Popup::HIDDEN, TEST_LOCATION );
+
+ // Show
+ // Note: in most popup animation implementations show would result in
+ // popup being onstage immediately following Show(). However we can't
+ // assume for all. e.g. If one creates a animation with a delay.
+ popup.SetDisplayState( Popup::SHOWN );
+
+ DALI_TEST_EQUALS( gPopupState, Popup::SHOWN, TEST_LOCATION );
+
+ for( int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++ )
+ {
+ application.SendNotification();
+ application.Render( RENDER_FRAME_INTERVAL );
+ }
+
+ // Force the timer used by the popup to expire,
+ // this will cause the popup to hide automatically.
+ Dali::Timer timer = Timer::New( 0 );
+ timer.MockEmitSignal();
+
+ DALI_TEST_EQUALS( gPopupState, Popup::HIDDEN, TEST_LOCATION );
+
+ END_TEST;
+}
+
+/*
+ * This test checks all animation modes to confirm they all trigger all display states at the expected times.
+ */
+int UtcDaliPopupPropertyAnimationMode(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline( " UtcDaliPopupPropertyAnimationMode" );
+
+ // Create the Popup actor
+ Popup popup = Popup::New();
+ ConnectStateSignals( popup );
+ popup.SetTitle( TextLabel::New( "Title" ) );
+ Stage::GetCurrent().Add( popup );
+
+ std::string animationModes[] = { "NONE", "ZOOM", "FADE", "CUSTOM" };
+
+ // Try both default and zero animation duration, as zero has a special case for some animation types.
+ for( int j = 0; j <= 1; j++ )
+ {
+ // On the second loop, set duration to zero.
+ if( j == 1 )
+ {
+ popup.SetProperty( Popup::Property::ANIMATION_DURATION, 0.0f );
+ }
+
+ // Loop through 4 animation modes.
+ for( int i = 0; i < 4; i++ )
+ {
+ popup.SetProperty( Popup::Property::ANIMATION_MODE, animationModes[i] );
+
+ std::string checkMode;
+ DALI_TEST_CHECK( popup.GetProperty( Popup::Property::ANIMATION_MODE ).Get( checkMode ) )
+
+ DALI_TEST_EQUALS( checkMode, animationModes[i], TEST_LOCATION );
+
+ popup.SetDisplayState( Popup::SHOWN );
+
+ // Only wait for animation if it isn't instant.
+ if( j == 0 )
+ {
+ DALI_TEST_EQUALS( gPopupState, Popup::SHOWING, TEST_LOCATION );
+ WaitAnimation( application );
+ }
+
+ DALI_TEST_EQUALS( gPopupState, Popup::SHOWN, TEST_LOCATION );
+ popup.SetDisplayState( Popup::HIDDEN );
+
+ if( j == 0 )
+ {
+ DALI_TEST_EQUALS( gPopupState, Popup::HIDING, TEST_LOCATION );
+ WaitAnimation( application );
+ }
+
+ DALI_TEST_EQUALS( gPopupState, Popup::HIDDEN, TEST_LOCATION );
+ }
+ }
+
+ END_TEST;
+}
+