Removed REQUIRES_STYLE_CHANGE_SIGNALS
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-Popup.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 02c9469..159ea01
@@ -25,6 +25,7 @@
 #include <dali.h>
 #include <dali/integration-api/events/key-event-integ.h>
 #include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/wheel-event-integ.h>
 #include <dali/devel-api/actors/actor-devel.h>
 #include <dali/devel-api/scripting/scripting.h>
 #include <dali-toolkit/dali-toolkit.h>
@@ -224,7 +225,7 @@ int UtcDaliPopupNewP( void )
   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;
@@ -356,7 +357,7 @@ int UtcDaliPopupSetContentP(void)
 
   // Create the Popup actor
   Popup popup = Popup::New();
-  Stage::GetCurrent().Add( popup );
+  application.GetScene().Add( popup );
   popup.SetProperty( Toolkit::Popup::Property::ANIMATION_DURATION, 0.0f );
 
   // Put in show state so it's layer is connected to popup (for ancestor check).
@@ -401,7 +402,7 @@ int UtcDaliPopupSetFooterP(void)
 
   // Create the Popup actor
   Popup popup = Popup::New();
-  Stage::GetCurrent().Add( popup );
+  application.GetScene().Add( popup );
   popup.SetProperty( Toolkit::Popup::Property::ANIMATION_DURATION, 0.0f );
   // Put in show state so it's layer is connected to popup (for ancestor check).
   popup.SetDisplayState( Popup::SHOWN );
@@ -445,7 +446,7 @@ int UtcDaliPopupSetControlFooterMultiple(void)
 
   // Create the Popup actor
   Popup popup = Popup::New();
-  Stage::GetCurrent().Add( popup );
+  application.GetScene().Add( popup );
   popup.SetProperty( Toolkit::Popup::Property::ANIMATION_DURATION, 0.0f );
   // Put in show state so it's layer is connected to popup (for ancestor check).
   popup.SetDisplayState( Popup::SHOWN );
@@ -640,7 +641,7 @@ int UtcDaliPopupPropertyTailVisibility(void)
 
   // Create the Popup actor
   Popup popup = Popup::New();
-  Stage::GetCurrent().Add( popup );
+  application.GetScene().Add( popup );
 
   popup.SetProperty( Popup::Property::TAIL_VISIBILITY, false );
   popup.SetDisplayState( Popup::SHOWN );
@@ -680,7 +681,7 @@ int UtcDaliPopupOnTouchedOutsideSignal(void)
   popup.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
   popup.SetProperty( Actor::Property::SIZE, Vector2( 50.0f, 50.0f ) );
   popup.SetProperty( Popup::Property::ANIMATION_DURATION, 0.0f );
-  Stage::GetCurrent().Add( popup );
+  application.GetScene().Add( popup );
   popup.OutsideTouchedSignal().Connect( &OnPopupTouchedOutside );
   popup.SetDisplayState( Popup::SHOWN );
 
@@ -752,7 +753,7 @@ int UtcDaliPopupPropertyAutoHide(void)
   DALI_TEST_CHECK( popup.GetProperty( Popup::Property::AUTO_HIDE_DELAY ).Get( getAutoHideDelay ) );
   DALI_TEST_EQUALS( getAutoHideDelay, 200, TEST_LOCATION );
 
-  Stage::GetCurrent().Add( popup );
+  application.GetScene().Add( popup );
 
   DALI_TEST_EQUALS( gPopupState, Popup::HIDDEN, TEST_LOCATION );
 
@@ -792,7 +793,7 @@ int UtcDaliPopupPropertyAnimationMode(void)
   Popup popup = Popup::New();
   ConnectStateSignals( popup );
   popup.SetTitle( TextLabel::New( "Title" ) );
-  Stage::GetCurrent().Add( popup );
+  application.GetScene().Add( popup );
 
   std::string animationModes[] = { "NONE", "ZOOM", "FADE", "CUSTOM" };
 
@@ -959,7 +960,7 @@ int UtcDaliPopupPropertyContextualMode(void)
   placement.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
   placement.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) );
   placement.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
-  Stage::GetCurrent().Add( placement );
+  application.GetScene().Add( placement );
 
   placement.Add( popup );
 
@@ -1003,25 +1004,25 @@ int UtcDaliPopupPropertyBacking(void)
   // Create the Popup actor
   Popup popup = Popup::New();
   popup.SetProperty( Popup::Property::ANIMATION_DURATION, 0.0f );
-  Stage::GetCurrent().Add( popup );
+  application.GetScene().Add( popup );
 
   Actor backing = popup.FindChildByName( "popupBacking" );
   DALI_TEST_CHECK( backing );
 
-  DALI_TEST_EQUALS( backing.GetCurrentProperty< float >( DevelActor::Property::OPACITY ), 1.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+  DALI_TEST_EQUALS( backing.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION );
 
   // Check enabled property.
   popup.SetDisplayState( Popup::SHOWN );
   application.SendNotification();
   application.Render();
 
-  DALI_TEST_EQUALS( backing.GetCurrentProperty< float >( DevelActor::Property::OPACITY ), 0.5f, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+  DALI_TEST_EQUALS( backing.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.5f, Math::MACHINE_EPSILON_0, TEST_LOCATION );
 
   popup.SetDisplayState( Popup::HIDDEN );
   application.SendNotification();
   application.Render();
 
-  DALI_TEST_EQUALS( backing.GetCurrentProperty< float >( DevelActor::Property::OPACITY ), 0.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+  DALI_TEST_EQUALS( backing.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION );
 
   popup.SetProperty( Popup::Property::BACKING_ENABLED, false );
   bool propertyResult;
@@ -1032,13 +1033,13 @@ int UtcDaliPopupPropertyBacking(void)
   application.SendNotification();
   application.Render();
 
-  DALI_TEST_EQUALS( backing.GetCurrentProperty< float >( DevelActor::Property::OPACITY ), 0.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+  DALI_TEST_EQUALS( backing.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION );
 
   popup.SetDisplayState( Popup::HIDDEN );
   application.SendNotification();
   application.Render();
 
-  DALI_TEST_EQUALS( backing.GetCurrentProperty< float >( DevelActor::Property::OPACITY ), 0.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+  DALI_TEST_EQUALS( backing.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION );
 
   // Check color property.
   popup.SetProperty( Popup::Property::BACKING_ENABLED, true );
@@ -1062,7 +1063,7 @@ int UtcDaliPopupPropertyBackgroundImage(void)
 
   // Create the Popup actor
   Popup popup = Popup::New();
-  Stage::GetCurrent().Add( popup );
+  application.GetScene().Add( popup );
 
   // Check setting an image
   popup.SetProperty( Toolkit::Popup::Property::POPUP_BACKGROUND_IMAGE, "invalid-image.png" );
@@ -1125,7 +1126,7 @@ int UtcDaliPopupPropertyCustomAnimation(void)
   DALI_TEST_CHECK( popup.GetProperty( Toolkit::Popup::Property::EXIT_ANIMATION ).Get( resultMap ) );
   DALI_TEST_EQUALS( resultMap.Count(), 0u, TEST_LOCATION );
 
-  Stage::GetCurrent().Add( popup );
+  application.GetScene().Add( popup );
   popup.SetDisplayState( Popup::SHOWN );
 
   for( int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++ )
@@ -1181,7 +1182,7 @@ int UtcDaliPopupPropertyTouchTransparent(void)
 
   button.ClickedSignal().Connect( &PushButtonClicked );
 
-  Stage::GetCurrent().Add( button );
+  application.GetScene().Add( button );
 
   button.Add( popup );
 
@@ -1207,6 +1208,12 @@ int UtcDaliPopupPropertyTouchTransparent(void)
 
   DALI_TEST_CHECK( !gPushButtonClicked );
 
+  // Perform a wheel event
+  Dali::Integration::WheelEvent wheelEvent( Dali::Integration::WheelEvent::MOUSE_WHEEL, 0, 0u, Vector2( 10.0f, 10.0f ), 1, 1000u );
+  application.ProcessEvent( wheelEvent );
+  application.SendNotification();
+  application.Render();
+
   // Enable touch transparency.
   popup.SetProperty( Popup::Property::TOUCH_TRANSPARENT, true );
   bool propertyResult;
@@ -1274,7 +1281,7 @@ int UtcDaliPopupPropertyTail(void)
   DALI_TEST_CHECK( popup.GetProperty( Popup::Property::TAIL_POSITION ).Get( vectorResult ) );
   DALI_TEST_EQUALS( vectorResult, tailPosition, TEST_LOCATION );
 
-  Stage::GetCurrent().Add( popup );
+  application.GetScene().Add( popup );
 
   popup.SetDisplayState( Popup::SHOWN );
   application.SendNotification();
@@ -1356,7 +1363,7 @@ int UtcDaliPopupTypeToast(void)
   popup.SetProperty( Popup::Property::ANIMATION_DURATION, 1.0f );
 
   popup.SetTitle( Toolkit::TextLabel::New( "This is a Toast Popup.\nIt will auto-hide itself" ) );
-  Stage::GetCurrent().Add( popup );
+  application.GetScene().Add( popup );
   popup.SetDisplayState( Toolkit::Popup::SHOWN );
 
   for( int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++ )
@@ -1405,7 +1412,7 @@ int UtcDaliPopupTypeRegistryCreation(void)
   ConnectStateSignals( popup );
   popup.SetProperty( Popup::Property::ANIMATION_DURATION, 0.0f );
 
-  Stage::GetCurrent().Add( popup );
+  application.GetScene().Add( popup );
   popup.SetDisplayState( Toolkit::Popup::SHOWN );
 
   application.SendNotification();
@@ -1439,10 +1446,10 @@ int UtcDaliPopupPropertyTypeRegistryConnectSignal(void)
   END_TEST;
 }
 
-int UtcDaliPopupOnControlChildAdd(void)
+int UtcDaliPopupOnChildAdd(void)
 {
   ToolkitTestApplication application;
-  tet_infoline( " UtcDaliPopupOnControlChildAdd" );
+  tet_infoline( " UtcDaliPopupOnChildAdd" );
 
   // Create the Popup actor
   Popup popup = Popup::New();
@@ -1465,7 +1472,7 @@ int UtcDaliPopupOnKeyEvent(void)
   // Create the Popup actor
   Popup popup = Popup::New();
   popup.SetProperty( Popup::Property::ANIMATION_DURATION, 0.0f );
-  Stage::GetCurrent().Add( popup );
+  application.GetScene().Add( popup );
 
   popup.SetDisplayState( Popup::SHOWN );
   application.SendNotification();
@@ -1475,7 +1482,7 @@ int UtcDaliPopupOnKeyEvent(void)
 
   popup.SetKeyInputFocus();
 
-  application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::Down, "", "", Device::Class::TOUCH, Device::Subclass::NONE ) );
+  application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::DOWN, "", "", Device::Class::TOUCH, Device::Subclass::NONE ) );
   application.SendNotification();
   application.Render();