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-Popup.cpp;h=159ea013ffc83d35b4904e715c212457b9801a41;hp=e08b4b4a10ed8c65cda457644ab4f289cc500718;hb=HEAD;hpb=26a3b93400d9b9de81db36cbe4cea39f51940d10 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Popup.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Popup.cpp index e08b4b4..a46c93b 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Popup.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Popup.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -22,14 +22,14 @@ #include #include "dali-toolkit-test-utils/toolkit-timer.h" +#include +#include #include +#include +#include #include #include #include -#include -#include -#include -#include using namespace Dali; using namespace Toolkit; @@ -53,24 +53,24 @@ static void TestCallback(BaseHandle handle) gObjectCreatedCallBackCalled = true; } -const int RENDER_FRAME_INTERVAL = 10; ///< Duration of each frame in ms. -const int RENDER_ANIMATION_TEST_DURATION_MS = 2000; ///< 2000ms to test animation. -const int RENDER_ANIMATION_TEST_DURATION_FRAMES = RENDER_ANIMATION_TEST_DURATION_MS / RENDER_FRAME_INTERVAL; ///< equivalent frames. +const int RENDER_FRAME_INTERVAL = 10; ///< Duration of each frame in ms. +const int RENDER_ANIMATION_TEST_DURATION_MS = 2000; ///< 2000ms to test animation. +const int RENDER_ANIMATION_TEST_DURATION_FRAMES = RENDER_ANIMATION_TEST_DURATION_MS / RENDER_FRAME_INTERVAL; ///< equivalent frames. const Vector3 DEFAULT_BUTTON_SIZE(100.0f, 50.0f, 0.0f); Dali::Integration::Point GetPointDown() { Dali::Integration::Point point; - point.SetState( PointState::DOWN ); - point.SetScreenPosition( Vector2( 10, 10 ) ); + point.SetState(PointState::DOWN); + point.SetScreenPosition(Vector2(10, 10)); return point; } Dali::Integration::Point GetPointUp() { Dali::Integration::Point point; - point.SetState( PointState::UP ); - point.SetScreenPosition( Vector2( 10, 10 ) ); + point.SetState(PointState::UP); + point.SetScreenPosition(Vector2(10, 10)); return point; } @@ -81,32 +81,32 @@ Dali::Integration::Point GetPointUp() * @param[in] root The root actor to count from. * @return The number of descendants including root actor itself. */ -int DescendentCount( const Actor& root ) +int DescendentCount(const Actor& root) { unsigned int numChildren = root.GetChildCount(); int count = 1; - for( unsigned int i = 0; i < numChildren; ++i ) + for(unsigned int i = 0; i < numChildren; ++i) { - count += DescendentCount( root.GetChildAt( i ) ); + count += DescendentCount(root.GetChildAt(i)); } return count; } -bool HasAncestor( Actor child, Actor ancestor ) +bool HasAncestor(Actor child, Actor ancestor) { - while( child && child != ancestor ) + while(child && child != ancestor) { child = child.GetParent(); } - return ( child == ancestor ); + return (child == ancestor); } static Toolkit::Popup::DisplayState gPopupState = Toolkit::Popup::HIDDEN; -static bool gTouchedOutside; +static bool gTouchedOutside; // Signal callbacks @@ -135,21 +135,21 @@ static void OnPopupHidden() gPopupState = Toolkit::Popup::HIDDEN; } -void ConnectStateSignals( Toolkit::Popup popup ) +void ConnectStateSignals(Toolkit::Popup popup) { - popup.ShowingSignal().Connect( &OnPopupShowing ); - popup.ShownSignal().Connect( &OnPopupShown ); - popup.HidingSignal().Connect( &OnPopupHiding ); - popup.HiddenSignal().Connect( &OnPopupHidden ); + popup.ShowingSignal().Connect(&OnPopupShowing); + popup.ShownSignal().Connect(&OnPopupShown); + popup.HidingSignal().Connect(&OnPopupHiding); + popup.HiddenSignal().Connect(&OnPopupHidden); } -void WaitAnimation( ToolkitTestApplication& application ) +void WaitAnimation(ToolkitTestApplication& application) { // Wait for a while (allow animation to complete), and then check state. - for( int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++ ) + for(int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++) { application.SendNotification(); - application.Render( RENDER_FRAME_INTERVAL ); + application.Render(RENDER_FRAME_INTERVAL); } } @@ -175,30 +175,29 @@ struct PopupTestFunctor }; // Generate a KeyEvent to send to Core. -Integration::KeyEvent GenerateKey( const std::string& keyName, - const std::string& logicalKey, - const std::string& keyString, - int keyCode, - int keyModifier, - unsigned long timeStamp, - const Integration::KeyEvent::State& keyState, - const std::string& compose = "", - const std::string& deviceName = "", - const Device::Class::Type& deviceClass = Device::Class::NONE, - const Device::Subclass::Type& deviceSubclass = Device::Subclass::NONE - ) +Integration::KeyEvent GenerateKey(const std::string& keyName, + const std::string& logicalKey, + const std::string& keyString, + int keyCode, + int keyModifier, + unsigned long timeStamp, + const Integration::KeyEvent::State& keyState, + const std::string& compose = "", + const std::string& deviceName = "", + const Device::Class::Type& deviceClass = Device::Class::NONE, + const Device::Subclass::Type& deviceSubclass = Device::Subclass::NONE) { - return Integration::KeyEvent( keyName, - logicalKey, - keyString, - keyCode, - keyModifier, - timeStamp, - keyState, - compose, - deviceName, - deviceClass, - deviceSubclass ); + return Integration::KeyEvent(keyName, + logicalKey, + keyString, + keyCode, + keyModifier, + timeStamp, + keyState, + compose, + deviceName, + deviceClass, + deviceSubclass); } } // Anonymous namespace @@ -206,422 +205,422 @@ Integration::KeyEvent GenerateKey( const std::string& keyName, /* * This test checks popup creation. */ -int UtcDaliPopupNewP( void ) +int UtcDaliPopupNewP(void) { ToolkitTestApplication application; - tet_infoline( " UtcDaliPopupNewP" ); + tet_infoline(" UtcDaliPopupNewP"); // Create the Popup actor. Popup popup; - DALI_TEST_CHECK( !popup ); + DALI_TEST_CHECK(!popup); popup = Popup::New(); - DALI_TEST_CHECK( popup ); + DALI_TEST_CHECK(popup); - Popup popup2( popup ); + Popup popup2(popup); - DALI_TEST_CHECK( popup2 == popup ); + DALI_TEST_CHECK(popup2 == popup); // Additional check to ensure object is created by checking if it's registered. - ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); - DALI_TEST_CHECK( registry ); + ObjectRegistry registry = application.GetCore().GetObjectRegistry(); + DALI_TEST_CHECK(registry); gObjectCreatedCallBackCalled = false; - registry.ObjectCreatedSignal().Connect( &TestCallback ); + registry.ObjectCreatedSignal().Connect(&TestCallback); { Popup popup = Popup::New(); } - DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); + DALI_TEST_CHECK(gObjectCreatedCallBackCalled); END_TEST; } /* * This test checks popup destruction. */ -int UtcDaliPopupDestructorP( void ) +int UtcDaliPopupDestructorP(void) { ToolkitTestApplication application; - tet_infoline( " UtcDaliPopupDestructorP" ); + tet_infoline(" UtcDaliPopupDestructorP"); Popup* popup = new Popup(); delete popup; - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); END_TEST; } int UtcDaliPopupDownCastP(void) { ToolkitTestApplication application; - tet_infoline( " UtcDaliPopupDownCastP" ); + tet_infoline(" UtcDaliPopupDownCastP"); Handle handle = Popup::New(); - Popup popup = Popup::DownCast( handle ); + Popup popup = Popup::DownCast(handle); - DALI_TEST_CHECK( popup == handle ); + DALI_TEST_CHECK(popup == handle); END_TEST; } int UtcDaliPopupSetPropertyP(void) { ToolkitTestApplication application; - tet_infoline( " UtcDaliPopupSetProperty" ); + tet_infoline(" UtcDaliPopupSetProperty"); Popup popup = Popup::New(); //Test properties std::string testString = "Hello World"; - TextLabel textActorIn = TextLabel::New( testString ); + TextLabel textActorIn = TextLabel::New(testString); Property::Map map; - Scripting::CreatePropertyMap( textActorIn, map ); - popup.SetProperty( popup.GetPropertyIndex( "title" ), map ); - TextLabel textActorOut = TextLabel::DownCast( popup.GetTitle() ); + Scripting::CreatePropertyMap(textActorIn, map); + popup.SetProperty(popup.GetPropertyIndex("title"), map); + TextLabel textActorOut = TextLabel::DownCast(popup.GetTitle()); std::string resultText; - DALI_TEST_CHECK( textActorOut.GetProperty( Toolkit::TextLabel::Property::TEXT ).Get( resultText ) ); - DALI_TEST_EQUALS( testString, resultText, TEST_LOCATION ); + DALI_TEST_CHECK(textActorOut.GetProperty(Toolkit::TextLabel::Property::TEXT).Get(resultText)); + DALI_TEST_EQUALS(testString, resultText, TEST_LOCATION); END_TEST; } int UtcDaliPopupSetTitleP(void) { - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication - tet_infoline( " UtcDaliPopupSetTitleP" ); + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + tet_infoline(" UtcDaliPopupSetTitleP"); // Create the Popup actor Popup popup = Popup::New(); // Put in show state so it's layer is connected to popup (for ancestor check). - popup.SetDisplayState( Popup::SHOWN ); + popup.SetDisplayState(Popup::SHOWN); TextLabel titleActor = TextLabel::New(); - titleActor.SetProperty( Toolkit::TextLabel::Property::TEXT, "title" ); + titleActor.SetProperty(Toolkit::TextLabel::Property::TEXT, "title"); - DALI_TEST_CHECK( !popup.GetTitle() ); - popup.SetTitle( titleActor ); - TextLabel textActor = TextLabel::DownCast( popup.GetTitle() ); - DALI_TEST_CHECK( textActor == titleActor ); + DALI_TEST_CHECK(!popup.GetTitle()); + popup.SetTitle(titleActor); + TextLabel textActor = TextLabel::DownCast(popup.GetTitle()); + DALI_TEST_CHECK(textActor == titleActor); std::string resultText; - DALI_TEST_CHECK( textActor.GetProperty( Toolkit::TextLabel::Property::TEXT ).Get( resultText ) ); + DALI_TEST_CHECK(textActor.GetProperty(Toolkit::TextLabel::Property::TEXT).Get(resultText)); - DALI_TEST_CHECK( ( popup.GetTitle() ) && ( resultText == "title" ) ); + DALI_TEST_CHECK((popup.GetTitle()) && (resultText == "title")); // verify titleActor is actually inside popup, and not elsewhere on stage, or off even. - DALI_TEST_CHECK( HasAncestor( titleActor, popup ) ); + DALI_TEST_CHECK(HasAncestor(titleActor, popup)); TextLabel titleActor2 = TextLabel::New(); - titleActor2.SetProperty( Toolkit::TextLabel::Property::TEXT, "anothertitle" ); - popup.SetTitle( titleActor2 ); - DALI_TEST_CHECK( popup.GetTitle() != titleActor ); - DALI_TEST_CHECK( popup.GetTitle() == titleActor2 ); - DALI_TEST_CHECK( TextLabel::DownCast( popup.GetTitle() ).GetProperty( Toolkit::TextLabel::Property::TEXT ).Get( resultText ) ); + titleActor2.SetProperty(Toolkit::TextLabel::Property::TEXT, "anothertitle"); + popup.SetTitle(titleActor2); + DALI_TEST_CHECK(popup.GetTitle() != titleActor); + DALI_TEST_CHECK(popup.GetTitle() == titleActor2); + DALI_TEST_CHECK(TextLabel::DownCast(popup.GetTitle()).GetProperty(Toolkit::TextLabel::Property::TEXT).Get(resultText)); - DALI_TEST_CHECK( ( popup.GetTitle() ) && ( resultText == "anothertitle" ) ); + DALI_TEST_CHECK((popup.GetTitle()) && (resultText == "anothertitle")); // verify titleActor is actually inside popup, and not elsewhere on stage, or off even. - DALI_TEST_CHECK( HasAncestor( titleActor2, popup ) ); + DALI_TEST_CHECK(HasAncestor(titleActor2, popup)); END_TEST; } int UtcDaliPopupSetTitleN(void) { - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication - tet_infoline( " UtcDaliPopupSetTitleN" ); + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + tet_infoline(" UtcDaliPopupSetTitleN"); // Create the Popup actor Popup popup = Popup::New(); - TextLabel titleActor = TextLabel::New( "text" ); - popup.SetTitle( titleActor ); + TextLabel titleActor = TextLabel::New("text"); + popup.SetTitle(titleActor); - DALI_TEST_CHECK( popup.GetTitle() ); + DALI_TEST_CHECK(popup.GetTitle()); // Set a bad title value. // Confirm this has disabled the title. Actor badActor; - popup.SetTitle( badActor ); + popup.SetTitle(badActor); - DALI_TEST_CHECK( !popup.GetTitle() ); + DALI_TEST_CHECK(!popup.GetTitle()); END_TEST; } int UtcDaliPopupSetContentP(void) { - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication - tet_infoline( " UtcDaliPopupSetContentP" ); + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + tet_infoline(" UtcDaliPopupSetContentP"); // Create the Popup actor Popup popup = Popup::New(); - application.GetScene().Add( popup ); - popup.SetProperty( Toolkit::Popup::Property::ANIMATION_DURATION, 0.0f ); + 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 ); + popup.SetDisplayState(Popup::SHOWN); PushButton button = PushButton::New(); - DALI_TEST_CHECK( !HasAncestor( button, popup ) ); - popup.SetFooter( button ); + DALI_TEST_CHECK(!HasAncestor(button, popup)); + popup.SetFooter(button); // Hide and then re-show popup to cause button to be rearranged and added to popup. - popup.SetDisplayState( Popup::HIDDEN ); - popup.SetDisplayState( Popup::SHOWN ); - DALI_TEST_CHECK( HasAncestor( button, popup ) ); + popup.SetDisplayState(Popup::HIDDEN); + popup.SetDisplayState(Popup::SHOWN); + DALI_TEST_CHECK(HasAncestor(button, popup)); END_TEST; } int UtcDaliPopupSetContentN(void) { - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication - tet_infoline( " UtcDaliPopupSetContentN" ); + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + tet_infoline(" UtcDaliPopupSetContentN"); // Create the Popup actor Popup popup = Popup::New(); - TextLabel content = TextLabel::New( "text" ); - popup.SetContent( content ); + TextLabel content = TextLabel::New("text"); + popup.SetContent(content); - DALI_TEST_CHECK( popup.GetContent() ); + DALI_TEST_CHECK(popup.GetContent()); // Set a bad title value. Actor badActor; - popup.SetContent( badActor ); + popup.SetContent(badActor); - DALI_TEST_CHECK( !popup.GetContent() ); + DALI_TEST_CHECK(!popup.GetContent()); END_TEST; } int UtcDaliPopupSetFooterP(void) { - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication tet_infoline(" UtcDaliPopupSetFooterP"); // Create the Popup actor Popup popup = Popup::New(); - application.GetScene().Add( popup ); - popup.SetProperty( Toolkit::Popup::Property::ANIMATION_DURATION, 0.0f ); + 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 ); + popup.SetDisplayState(Popup::SHOWN); PushButton button = PushButton::New(); - DALI_TEST_CHECK( !HasAncestor(button, popup) ); - popup.SetFooter( button ); + DALI_TEST_CHECK(!HasAncestor(button, popup)); + popup.SetFooter(button); // Hide and then re-show popup to cause button to be rearranged and added to popup. - popup.SetDisplayState( Popup::HIDDEN ); - popup.SetDisplayState( Popup::SHOWN ); - DALI_TEST_CHECK( HasAncestor( button, popup ) ); + popup.SetDisplayState(Popup::HIDDEN); + popup.SetDisplayState(Popup::SHOWN); + DALI_TEST_CHECK(HasAncestor(button, popup)); END_TEST; } int UtcDaliPopupSetFooterN(void) { - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication tet_infoline(" UtcDaliPopupSetFooterN"); // Create the Popup actor Popup popup = Popup::New(); PushButton button = PushButton::New(); - popup.SetFooter( button ); + popup.SetFooter(button); - DALI_TEST_CHECK( popup.GetFooter() ); + DALI_TEST_CHECK(popup.GetFooter()); // Set a bad title value. Actor badActor; - popup.SetFooter( badActor ); + popup.SetFooter(badActor); - DALI_TEST_CHECK( !popup.GetFooter() ); + DALI_TEST_CHECK(!popup.GetFooter()); END_TEST; } int UtcDaliPopupSetControlFooterMultiple(void) { - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication tet_infoline(" UtcDaliPopupSetControlFooterMultiple"); // Create the Popup actor Popup popup = Popup::New(); - application.GetScene().Add( popup ); - popup.SetProperty( Toolkit::Popup::Property::ANIMATION_DURATION, 0.0f ); + 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 ); + popup.SetDisplayState(Popup::SHOWN); - Actor container = Actor::New(); - PushButton button1 = PushButton::New(); - PushButton button2 = PushButton::New(); - DALI_TEST_CHECK( !HasAncestor( button1, popup ) ); - DALI_TEST_CHECK( !HasAncestor( button2, popup ) ); - container.Add( button1 ); - container.Add( button2 ); - popup.SetFooter( container ); + Actor container = Actor::New(); + PushButton button1 = PushButton::New(); + PushButton button2 = PushButton::New(); + DALI_TEST_CHECK(!HasAncestor(button1, popup)); + DALI_TEST_CHECK(!HasAncestor(button2, popup)); + container.Add(button1); + container.Add(button2); + popup.SetFooter(container); // Hide and then re-show popup to cause button to be rearranged and added to popup. - popup.SetDisplayState( Popup::HIDDEN ); - popup.SetDisplayState( Popup::SHOWN ); - DALI_TEST_CHECK( HasAncestor( button1, popup ) ); - DALI_TEST_CHECK( HasAncestor( button2, popup ) ); + popup.SetDisplayState(Popup::HIDDEN); + popup.SetDisplayState(Popup::SHOWN); + DALI_TEST_CHECK(HasAncestor(button1, popup)); + DALI_TEST_CHECK(HasAncestor(button2, popup)); END_TEST; } int UtcDaliPopupSetTitleAndFooter(void) { - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication - tet_infoline( " UtcDaliPopupSetTitleAndFooter" ); + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + tet_infoline(" UtcDaliPopupSetTitleAndFooter"); // Create the Popup actor Popup popup = Popup::New(); // Put in show state so it's layer is connected to popup (for ancestor check). - popup.SetDisplayState( Popup::SHOWN ); + popup.SetDisplayState(Popup::SHOWN); // Add the title TextLabel titleActor = TextLabel::New(); - titleActor.SetProperty( Toolkit::TextLabel::Property::TEXT, "title" ); + titleActor.SetProperty(Toolkit::TextLabel::Property::TEXT, "title"); - DALI_TEST_CHECK( !popup.GetTitle() ); - popup.SetTitle( titleActor ); - TextLabel textActor = TextLabel::DownCast( popup.GetTitle() ); - DALI_TEST_CHECK( textActor == titleActor ); + DALI_TEST_CHECK(!popup.GetTitle()); + popup.SetTitle(titleActor); + TextLabel textActor = TextLabel::DownCast(popup.GetTitle()); + DALI_TEST_CHECK(textActor == titleActor); std::string resultText; - DALI_TEST_CHECK( textActor.GetProperty( Toolkit::TextLabel::Property::TEXT ).Get( resultText ) ); - DALI_TEST_CHECK( ( popup.GetTitle() ) && ( resultText == "title" ) ); + DALI_TEST_CHECK(textActor.GetProperty(Toolkit::TextLabel::Property::TEXT).Get(resultText)); + DALI_TEST_CHECK((popup.GetTitle()) && (resultText == "title")); // verify titleActor is actually inside popup, and not elsewhere on stage, or off even. - DALI_TEST_CHECK( HasAncestor( titleActor, popup ) ); + DALI_TEST_CHECK(HasAncestor(titleActor, popup)); // Add the footer PushButton button = PushButton::New(); - DALI_TEST_CHECK( !HasAncestor(button, popup) ); - popup.SetFooter( button ); + DALI_TEST_CHECK(!HasAncestor(button, popup)); + popup.SetFooter(button); // Hide and then re-show popup to cause button to be rearranged and added to popup. - popup.SetDisplayState( Popup::HIDDEN ); - popup.SetDisplayState( Popup::SHOWN ); - DALI_TEST_CHECK( HasAncestor( button, popup ) ); + popup.SetDisplayState(Popup::HIDDEN); + popup.SetDisplayState(Popup::SHOWN); + DALI_TEST_CHECK(HasAncestor(button, popup)); END_TEST; } int UtcDaliPopupSetStateP(void) { - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication tet_infoline(" UtcDaliPopupSetStateP"); // Create the Popup actor Popup popup = Popup::New(); - popup.SetProperty( Toolkit::Popup::Property::ANIMATION_DURATION, 0.0f ); + popup.SetProperty(Toolkit::Popup::Property::ANIMATION_DURATION, 0.0f); - DALI_TEST_EQUALS( popup.GetDisplayState(), Popup::HIDDEN, TEST_LOCATION ); + DALI_TEST_EQUALS(popup.GetDisplayState(), Popup::HIDDEN, TEST_LOCATION); - popup.SetDisplayState( Popup::SHOWN ); - DALI_TEST_EQUALS( Popup::SHOWN, popup.GetDisplayState(), TEST_LOCATION ); + popup.SetDisplayState(Popup::SHOWN); + DALI_TEST_EQUALS(Popup::SHOWN, popup.GetDisplayState(), TEST_LOCATION); - popup.SetDisplayState( Popup::HIDDEN ); - DALI_TEST_EQUALS( Popup::HIDDEN, popup.GetDisplayState(), TEST_LOCATION ); + popup.SetDisplayState(Popup::HIDDEN); + DALI_TEST_EQUALS(Popup::HIDDEN, popup.GetDisplayState(), TEST_LOCATION); END_TEST; } int UtcDaliPopupSetStateN(void) { - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication tet_infoline(" UtcDaliPopupSetStateN"); // Create the Popup actor Popup popup = Popup::New(); - popup.SetProperty( Toolkit::Popup::Property::ANIMATION_DURATION, 1.0f ); + popup.SetProperty(Toolkit::Popup::Property::ANIMATION_DURATION, 1.0f); - DALI_TEST_EQUALS( popup.GetDisplayState(), Popup::HIDDEN, TEST_LOCATION ); + DALI_TEST_EQUALS(popup.GetDisplayState(), Popup::HIDDEN, TEST_LOCATION); - popup.SetDisplayState( Popup::SHOWN ); - DALI_TEST_EQUALS( Popup::SHOWING, popup.GetDisplayState(), TEST_LOCATION ); + popup.SetDisplayState(Popup::SHOWN); + DALI_TEST_EQUALS(Popup::SHOWING, popup.GetDisplayState(), TEST_LOCATION); // Test cancelling a show before it has finished. - popup.SetDisplayState( Popup::HIDDEN ); - DALI_TEST_EQUALS( Popup::HIDING, popup.GetDisplayState(), TEST_LOCATION ); + popup.SetDisplayState(Popup::HIDDEN); + DALI_TEST_EQUALS(Popup::HIDING, popup.GetDisplayState(), TEST_LOCATION); END_TEST; } int UtcDaliPopupDisplayStateSignal(void) { - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication - tet_infoline( " UtcDaliPopupDisplayStateSignal" ); + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + tet_infoline(" UtcDaliPopupDisplayStateSignal"); // Create the Popup actor Popup popup = Popup::New(); - ConnectStateSignals( popup ); + ConnectStateSignals(popup); - popup.SetProperty( Toolkit::Popup::Property::ANIMATION_DURATION, 1.0f ); - popup.SetDisplayState( Popup::SHOWN ); - DALI_TEST_EQUALS( Popup::SHOWING, popup.GetDisplayState(), TEST_LOCATION ); - DALI_TEST_EQUALS( gPopupState, Popup::SHOWING, TEST_LOCATION ); + popup.SetProperty(Toolkit::Popup::Property::ANIMATION_DURATION, 1.0f); + popup.SetDisplayState(Popup::SHOWN); + DALI_TEST_EQUALS(Popup::SHOWING, popup.GetDisplayState(), TEST_LOCATION); + DALI_TEST_EQUALS(gPopupState, Popup::SHOWING, TEST_LOCATION); // Wait for a while (allow animation to complete), and then check state. - for( int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++) + for(int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++) { application.SendNotification(); - application.Render( RENDER_FRAME_INTERVAL ); + application.Render(RENDER_FRAME_INTERVAL); } - DALI_TEST_EQUALS( Popup::SHOWN, popup.GetDisplayState(), TEST_LOCATION ); - DALI_TEST_EQUALS( gPopupState, Popup::SHOWN, TEST_LOCATION ); + DALI_TEST_EQUALS(Popup::SHOWN, popup.GetDisplayState(), TEST_LOCATION); + DALI_TEST_EQUALS(gPopupState, Popup::SHOWN, TEST_LOCATION); // Hide slowly - popup.SetDisplayState( Popup::HIDDEN ); - DALI_TEST_EQUALS( Popup::HIDING, popup.GetDisplayState(), TEST_LOCATION ); - DALI_TEST_EQUALS( gPopupState, Popup::HIDING, TEST_LOCATION ); + popup.SetDisplayState(Popup::HIDDEN); + DALI_TEST_EQUALS(Popup::HIDING, popup.GetDisplayState(), TEST_LOCATION); + DALI_TEST_EQUALS(gPopupState, Popup::HIDING, TEST_LOCATION); // Wait for a while (allow animation to complete), and then check state. - for( int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++) + for(int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++) { application.SendNotification(); - application.Render( RENDER_FRAME_INTERVAL ); + application.Render(RENDER_FRAME_INTERVAL); } - DALI_TEST_EQUALS( Popup::HIDDEN, popup.GetDisplayState(), TEST_LOCATION ); - DALI_TEST_EQUALS( gPopupState, Popup::HIDDEN, TEST_LOCATION ); + DALI_TEST_EQUALS(Popup::HIDDEN, popup.GetDisplayState(), TEST_LOCATION); + DALI_TEST_EQUALS(gPopupState, Popup::HIDDEN, TEST_LOCATION); END_TEST; } int UtcDaliPopupShowHide(void) { - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication tet_infoline(" UtcDaliPopupShowHide"); // Create the Popup actor Popup popup = Popup::New(); - ConnectStateSignals( popup ); + ConnectStateSignals(popup); - Actor container = Actor::New(); - PushButton button1 = PushButton::New(); - PushButton button2 = PushButton::New(); - button1.SetProperty( Actor::Property::SIZE, DEFAULT_BUTTON_SIZE.GetVectorXY() ); - button2.SetProperty( Actor::Property::SIZE, DEFAULT_BUTTON_SIZE.GetVectorXY() ); - container.Add( button1 ); - container.Add( button2 ); - popup.SetFooter( container ); + Actor container = Actor::New(); + PushButton button1 = PushButton::New(); + PushButton button2 = PushButton::New(); + button1.SetProperty(Actor::Property::SIZE, DEFAULT_BUTTON_SIZE.GetVectorXY()); + button2.SetProperty(Actor::Property::SIZE, DEFAULT_BUTTON_SIZE.GetVectorXY()); + container.Add(button1); + container.Add(button2); + popup.SetFooter(container); // 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 ); + popup.SetDisplayState(Popup::SHOWN); // Wait for a while (allow animation to complete), and then check state. for(int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++) { application.SendNotification(); - application.Render( RENDER_FRAME_INTERVAL ); + application.Render(RENDER_FRAME_INTERVAL); } // Hide - popup.SetDisplayState( Popup::HIDDEN ); + popup.SetDisplayState(Popup::HIDDEN); // Wait for a while (allow animation to complete), and then check state. for(int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++) @@ -630,60 +629,60 @@ int UtcDaliPopupShowHide(void) application.Render(RENDER_FRAME_INTERVAL); } - DALI_TEST_EQUALS( gPopupState, Popup::HIDDEN, TEST_LOCATION ); + DALI_TEST_EQUALS(gPopupState, Popup::HIDDEN, TEST_LOCATION); END_TEST; } int UtcDaliPopupPropertyTailVisibility(void) { - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication tet_infoline(" UtcDaliPopupShowHideTail"); // Create the Popup actor Popup popup = Popup::New(); - application.GetScene().Add( popup ); + application.GetScene().Add(popup); - popup.SetProperty( Popup::Property::TAIL_VISIBILITY, false ); - popup.SetDisplayState( Popup::SHOWN ); + popup.SetProperty(Popup::Property::TAIL_VISIBILITY, false); + popup.SetDisplayState(Popup::SHOWN); - int withoutTailCount = DescendentCount( popup ); + int withoutTailCount = DescendentCount(popup); - popup.SetDisplayState( Popup::HIDDEN ); + popup.SetDisplayState(Popup::HIDDEN); - popup.SetProperty( Popup::Property::TAIL_POSITION, "BOTTOM_CENTER" ); - popup.SetProperty( Popup::Property::TAIL_VISIBILITY, true ); - popup.SetDisplayState( Popup::SHOWN ); + popup.SetProperty(Popup::Property::TAIL_POSITION, "BOTTOM_CENTER"); + popup.SetProperty(Popup::Property::TAIL_VISIBILITY, true); + popup.SetDisplayState(Popup::SHOWN); - int withTailCount = DescendentCount( popup ); + int withTailCount = DescendentCount(popup); // There should be more actors if the Tail has been added. - DALI_TEST_CHECK( withTailCount > withoutTailCount ); + DALI_TEST_CHECK(withTailCount > withoutTailCount); // Hide again - popup.SetDisplayState( Popup::HIDDEN ); - popup.SetProperty( Popup::Property::TAIL_VISIBILITY, false ); - popup.SetDisplayState( Popup::SHOWN ); + popup.SetDisplayState(Popup::HIDDEN); + popup.SetProperty(Popup::Property::TAIL_VISIBILITY, false); + popup.SetDisplayState(Popup::SHOWN); int withoutTailCount2 = DescendentCount(popup); - DALI_TEST_CHECK( withTailCount > withoutTailCount2 ); + DALI_TEST_CHECK(withTailCount > withoutTailCount2); END_TEST; } int UtcDaliPopupOnTouchedOutsideSignal(void) { - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication tet_infoline(" UtcDaliPopupOnTouchedOutside"); // Create the Popup actor Popup popup = Popup::New(); - popup.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - popup.SetProperty( Actor::Property::ANCHOR_POINT, ParentOrigin::CENTER ); - 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 ); - application.GetScene().Add( popup ); - popup.OutsideTouchedSignal().Connect( &OnPopupTouchedOutside ); - popup.SetDisplayState( Popup::SHOWN ); + popup.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + popup.SetProperty(Actor::Property::ANCHOR_POINT, ParentOrigin::CENTER); + 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); + application.GetScene().Add(popup); + popup.OutsideTouchedSignal().Connect(&OnPopupTouchedOutside); + popup.SetDisplayState(Popup::SHOWN); application.SendNotification(); application.Render(); @@ -692,91 +691,91 @@ int UtcDaliPopupOnTouchedOutsideSignal(void) Dali::Integration::TouchEvent event; event = Dali::Integration::TouchEvent(); - event.AddPoint( GetPointDown() ); - application.ProcessEvent( event ); + event.AddPoint(GetPointDown()); + application.ProcessEvent(event); application.SendNotification(); application.Render(); event = Dali::Integration::TouchEvent(); - event.AddPoint( GetPointUp() ); - application.ProcessEvent( event ); + event.AddPoint(GetPointUp()); + application.ProcessEvent(event); application.SendNotification(); application.Render(); // Confirm the signal is ignored if touch_transparent. gTouchedOutside = false; - popup.SetProperty( Popup::Property::TOUCH_TRANSPARENT, true ); + popup.SetProperty(Popup::Property::TOUCH_TRANSPARENT, true); event = Dali::Integration::TouchEvent(); - event.AddPoint( GetPointDown() ); - application.ProcessEvent( event ); + event.AddPoint(GetPointDown()); + application.ProcessEvent(event); application.SendNotification(); application.Render(); event = Dali::Integration::TouchEvent(); - event.AddPoint( GetPointUp() ); - application.ProcessEvent( event ); + event.AddPoint(GetPointUp()); + application.ProcessEvent(event); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( !gTouchedOutside ); + DALI_TEST_CHECK(!gTouchedOutside); END_TEST; } int UtcDaliPopupPropertyAutoHide(void) { - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication - tet_infoline( " UtcDaliPopupPropertyAutoHide" ); + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + tet_infoline(" UtcDaliPopupPropertyAutoHide"); // Create the Popup actor Popup popup = Popup::New(); - ConnectStateSignals( popup ); + ConnectStateSignals(popup); - Actor container = Actor::New(); - PushButton button1 = PushButton::New(); - button1.SetProperty( Actor::Property::SIZE, DEFAULT_BUTTON_SIZE.GetVectorXY() ); - container.Add( button1 ); - popup.SetFooter( container ); + Actor container = Actor::New(); + PushButton button1 = PushButton::New(); + button1.SetProperty(Actor::Property::SIZE, DEFAULT_BUTTON_SIZE.GetVectorXY()); + container.Add(button1); + popup.SetFooter(container); - popup.SetProperty( Popup::Property::ANIMATION_DURATION, 0.0f ); + popup.SetProperty(Popup::Property::ANIMATION_DURATION, 0.0f); float getAnimationDuration = 0.0f; - DALI_TEST_CHECK( popup.GetProperty( Popup::Property::ANIMATION_DURATION ).Get( getAnimationDuration ) ); - DALI_TEST_EQUALS( getAnimationDuration, 0.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + DALI_TEST_CHECK(popup.GetProperty(Popup::Property::ANIMATION_DURATION).Get(getAnimationDuration)); + DALI_TEST_EQUALS(getAnimationDuration, 0.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION); - popup.SetProperty( Popup::Property::AUTO_HIDE_DELAY, 200 ); + popup.SetProperty(Popup::Property::AUTO_HIDE_DELAY, 200); int getAutoHideDelay = 0; - DALI_TEST_CHECK( popup.GetProperty( Popup::Property::AUTO_HIDE_DELAY ).Get( getAutoHideDelay ) ); - DALI_TEST_EQUALS( getAutoHideDelay, 200, TEST_LOCATION ); + DALI_TEST_CHECK(popup.GetProperty(Popup::Property::AUTO_HIDE_DELAY).Get(getAutoHideDelay)); + DALI_TEST_EQUALS(getAutoHideDelay, 200, TEST_LOCATION); - application.GetScene().Add( popup ); + application.GetScene().Add(popup); - DALI_TEST_EQUALS( gPopupState, Popup::HIDDEN, TEST_LOCATION ); + 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 ); + popup.SetDisplayState(Popup::SHOWN); - DALI_TEST_EQUALS( gPopupState, Popup::SHOWN, TEST_LOCATION ); + DALI_TEST_EQUALS(gPopupState, Popup::SHOWN, TEST_LOCATION); - for( int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++ ) + for(int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++) { application.SendNotification(); - application.Render( RENDER_FRAME_INTERVAL ); + 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 ); + Dali::Timer timer = Timer::New(0); timer.MockEmitSignal(); - DALI_TEST_EQUALS( gPopupState, Popup::HIDDEN, TEST_LOCATION ); + DALI_TEST_EQUALS(gPopupState, Popup::HIDDEN, TEST_LOCATION); END_TEST; } @@ -786,64 +785,64 @@ int UtcDaliPopupPropertyAutoHide(void) */ int UtcDaliPopupPropertyAnimationMode(void) { - ToolkitTestApplication application; // Exceptions require ToolkitTestApplication - tet_infoline( " UtcDaliPopupPropertyAnimationMode" ); + ToolkitTestApplication application; // Exceptions require ToolkitTestApplication + tet_infoline(" UtcDaliPopupPropertyAnimationMode"); // Create the Popup actor Popup popup = Popup::New(); - ConnectStateSignals( popup ); - popup.SetTitle( TextLabel::New( "Title" ) ); - application.GetScene().Add( popup ); + ConnectStateSignals(popup); + popup.SetTitle(TextLabel::New("Title")); + application.GetScene().Add(popup); - std::string animationModes[] = { "NONE", "ZOOM", "FADE", "CUSTOM" }; + 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++ ) + for(int j = 0; j <= 1; j++) { // On the second loop, set duration to zero. - if( j == 1 ) + if(j == 1) { - popup.SetProperty( Popup::Property::ANIMATION_DURATION, 0.0f ); + popup.SetProperty(Popup::Property::ANIMATION_DURATION, 0.0f); } // Loop through 4 animation modes. - for( int i = 0; i < 4; i++ ) + for(int i = 0; i < 4; i++) { - popup.SetProperty( Popup::Property::ANIMATION_MODE, animationModes[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_CHECK(popup.GetProperty(Popup::Property::ANIMATION_MODE).Get(checkMode)) - DALI_TEST_EQUALS( checkMode, animationModes[i], TEST_LOCATION ); + DALI_TEST_EQUALS(checkMode, animationModes[i], TEST_LOCATION); - popup.SetProperty( Toolkit::Popup::Property::DISPLAY_STATE, "SHOWN" ); + popup.SetProperty(Toolkit::Popup::Property::DISPLAY_STATE, "SHOWN"); std::string resultState; // Only wait for animation if it isn't instant. - if( j == 0 ) + if(j == 0) { - DALI_TEST_EQUALS( gPopupState, Popup::SHOWING, TEST_LOCATION ); - DALI_TEST_CHECK( popup.GetProperty( Toolkit::Popup::Property::DISPLAY_STATE ).Get( resultState ) ); - DALI_TEST_EQUALS( resultState, "SHOWING", TEST_LOCATION ); - WaitAnimation( application ); + DALI_TEST_EQUALS(gPopupState, Popup::SHOWING, TEST_LOCATION); + DALI_TEST_CHECK(popup.GetProperty(Toolkit::Popup::Property::DISPLAY_STATE).Get(resultState)); + DALI_TEST_EQUALS(resultState, "SHOWING", TEST_LOCATION); + WaitAnimation(application); } - DALI_TEST_EQUALS( gPopupState, Popup::SHOWN, TEST_LOCATION ); - DALI_TEST_CHECK( popup.GetProperty( Toolkit::Popup::Property::DISPLAY_STATE ).Get( resultState ) ); - DALI_TEST_EQUALS( resultState, "SHOWN", TEST_LOCATION ); - popup.SetDisplayState( Popup::HIDDEN ); + DALI_TEST_EQUALS(gPopupState, Popup::SHOWN, TEST_LOCATION); + DALI_TEST_CHECK(popup.GetProperty(Toolkit::Popup::Property::DISPLAY_STATE).Get(resultState)); + DALI_TEST_EQUALS(resultState, "SHOWN", TEST_LOCATION); + popup.SetDisplayState(Popup::HIDDEN); - if( j == 0 ) + if(j == 0) { - DALI_TEST_EQUALS( gPopupState, Popup::HIDING, TEST_LOCATION ); - DALI_TEST_CHECK( popup.GetProperty( Toolkit::Popup::Property::DISPLAY_STATE ).Get( resultState ) ); - DALI_TEST_EQUALS( resultState, "HIDING", TEST_LOCATION ); - WaitAnimation( application ); + DALI_TEST_EQUALS(gPopupState, Popup::HIDING, TEST_LOCATION); + DALI_TEST_CHECK(popup.GetProperty(Toolkit::Popup::Property::DISPLAY_STATE).Get(resultState)); + DALI_TEST_EQUALS(resultState, "HIDING", TEST_LOCATION); + WaitAnimation(application); } - DALI_TEST_EQUALS( gPopupState, Popup::HIDDEN, TEST_LOCATION ); - DALI_TEST_CHECK( popup.GetProperty( Toolkit::Popup::Property::DISPLAY_STATE ).Get( resultState ) ); - DALI_TEST_EQUALS( resultState, "HIDDEN", TEST_LOCATION ); + DALI_TEST_EQUALS(gPopupState, Popup::HIDDEN, TEST_LOCATION); + DALI_TEST_CHECK(popup.GetProperty(Toolkit::Popup::Property::DISPLAY_STATE).Get(resultState)); + DALI_TEST_EQUALS(resultState, "HIDDEN", TEST_LOCATION); } } @@ -853,29 +852,29 @@ int UtcDaliPopupPropertyAnimationMode(void) int UtcDaliPopupPropertyTitle(void) { ToolkitTestApplication application; - tet_infoline( " UtcDaliPopupPropertyTitle" ); + tet_infoline(" UtcDaliPopupPropertyTitle"); // Create the Popup actor Popup popup = Popup::New(); std::string testLabelText = "TitleTest"; - TextLabel titleLabel = TextLabel::New(); - titleLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, testLabelText ); - Actor title = titleLabel; + TextLabel titleLabel = TextLabel::New(); + titleLabel.SetProperty(Toolkit::TextLabel::Property::TEXT, testLabelText); + Actor title = titleLabel; Property::Map map; - Scripting::CreatePropertyMap( title, map ); - popup.SetProperty( Toolkit::Popup::Property::TITLE, map ); + Scripting::CreatePropertyMap(title, map); + popup.SetProperty(Toolkit::Popup::Property::TITLE, map); Property::Map resultMap; - DALI_TEST_CHECK( popup.GetProperty( Toolkit::Popup::Property::TITLE ).Get( resultMap ) ); + DALI_TEST_CHECK(popup.GetProperty(Toolkit::Popup::Property::TITLE).Get(resultMap)); - Property::Value* resultProperty = resultMap.Find( "text" ); - DALI_TEST_CHECK( resultProperty ); + Property::Value* resultProperty = resultMap.Find("text"); + DALI_TEST_CHECK(resultProperty); std::string resultText; - DALI_TEST_CHECK( resultProperty->Get( resultText ) ); + DALI_TEST_CHECK(resultProperty->Get(resultText)); - DALI_TEST_EQUALS( resultText, testLabelText, TEST_LOCATION ); + DALI_TEST_EQUALS(resultText, testLabelText, TEST_LOCATION); END_TEST; } @@ -883,29 +882,29 @@ int UtcDaliPopupPropertyTitle(void) int UtcDaliPopupPropertyContent(void) { ToolkitTestApplication application; - tet_infoline( " UtcDaliPopupPropertyContent" ); + tet_infoline(" UtcDaliPopupPropertyContent"); // Create the Popup actor Popup popup = Popup::New(); std::string testLabelText = "ContentTest"; - TextLabel contentLabel = TextLabel::New(); - contentLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, testLabelText ); - Actor content = contentLabel; + TextLabel contentLabel = TextLabel::New(); + contentLabel.SetProperty(Toolkit::TextLabel::Property::TEXT, testLabelText); + Actor content = contentLabel; Property::Map map; - Scripting::CreatePropertyMap( content, map ); - popup.SetProperty( Toolkit::Popup::Property::CONTENT, map ); + Scripting::CreatePropertyMap(content, map); + popup.SetProperty(Toolkit::Popup::Property::CONTENT, map); Property::Map resultMap; - DALI_TEST_CHECK( popup.GetProperty( Toolkit::Popup::Property::CONTENT ).Get( resultMap ) ); + DALI_TEST_CHECK(popup.GetProperty(Toolkit::Popup::Property::CONTENT).Get(resultMap)); - Property::Value* resultProperty = resultMap.Find( "text" ); - DALI_TEST_CHECK( resultProperty ); + Property::Value* resultProperty = resultMap.Find("text"); + DALI_TEST_CHECK(resultProperty); std::string resultText; - DALI_TEST_CHECK( resultProperty->Get( resultText ) ); + DALI_TEST_CHECK(resultProperty->Get(resultText)); - DALI_TEST_EQUALS( resultText, testLabelText, TEST_LOCATION ); + DALI_TEST_EQUALS(resultText, testLabelText, TEST_LOCATION); END_TEST; } @@ -913,29 +912,29 @@ int UtcDaliPopupPropertyContent(void) int UtcDaliPopupPropertyFooter(void) { ToolkitTestApplication application; - tet_infoline( " UtcDaliPopupPropertyFooter" ); + tet_infoline(" UtcDaliPopupPropertyFooter"); // Create the Popup actor Popup popup = Popup::New(); std::string testLabelText = "FooterTest"; - TextLabel footerLabel = TextLabel::New(); - footerLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, testLabelText ); - Actor footer = footerLabel; + TextLabel footerLabel = TextLabel::New(); + footerLabel.SetProperty(Toolkit::TextLabel::Property::TEXT, testLabelText); + Actor footer = footerLabel; Property::Map map; - Scripting::CreatePropertyMap( footer, map ); - popup.SetProperty( Toolkit::Popup::Property::FOOTER, map ); + Scripting::CreatePropertyMap(footer, map); + popup.SetProperty(Toolkit::Popup::Property::FOOTER, map); Property::Map resultMap; - DALI_TEST_CHECK( popup.GetProperty( Toolkit::Popup::Property::FOOTER ).Get( resultMap ) ); + DALI_TEST_CHECK(popup.GetProperty(Toolkit::Popup::Property::FOOTER).Get(resultMap)); - Property::Value* resultProperty = resultMap.Find( "text" ); - DALI_TEST_CHECK( resultProperty ); + Property::Value* resultProperty = resultMap.Find("text"); + DALI_TEST_CHECK(resultProperty); std::string resultText; - DALI_TEST_CHECK( resultProperty->Get( resultText ) ); + DALI_TEST_CHECK(resultProperty->Get(resultText)); - DALI_TEST_EQUALS( resultText, testLabelText, TEST_LOCATION ); + DALI_TEST_EQUALS(resultText, testLabelText, TEST_LOCATION); END_TEST; } @@ -943,52 +942,52 @@ int UtcDaliPopupPropertyFooter(void) int UtcDaliPopupPropertyContextualMode(void) { ToolkitTestApplication application; - tet_infoline( " UtcDaliPopupPropertyContextualMode" ); + tet_infoline(" UtcDaliPopupPropertyContextualMode"); // Create the Popup actor Popup popup = Popup::New(); - popup.SetProperty( Popup::Property::ANIMATION_DURATION, 0.0f ); + popup.SetProperty(Popup::Property::ANIMATION_DURATION, 0.0f); std::string testLabelText = "ContentTest"; TextLabel contentLabel = TextLabel::New(); - popup.SetContent( contentLabel ); + popup.SetContent(contentLabel); // Placement actor to parent the popup from so the popup's contextual position can be relative to it. Actor placement = Actor::New(); - placement.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - 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 ); - application.GetScene().Add( placement ); + placement.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + 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); + application.GetScene().Add(placement); - placement.Add( popup ); + placement.Add(popup); // Test all contextual modes. - const char* mode[5] = { "NON_CONTEXTUAL", "ABOVE", "RIGHT", "BELOW", "LEFT" }; - Vector2 offsetValues[5]; - offsetValues[0] = Vector2( 0.375f, 0.0f ); - offsetValues[1] = Vector2( -0.125f, -10.5f ); - offsetValues[2] = Vector2( 10.875f, -0.5f ); - offsetValues[3] = Vector2( -0.125f, 10.5f ); - offsetValues[4] = Vector2( -10.875f, -0.5f ); - - for( int i = 0; i < 5; ++i ) + const char* mode[5] = {"NON_CONTEXTUAL", "ABOVE", "RIGHT", "BELOW", "LEFT"}; + Vector2 offsetValues[5]; + offsetValues[0] = Vector2(0.375f, 0.0f); + offsetValues[1] = Vector2(-0.125f, -10.5f); + offsetValues[2] = Vector2(10.875f, -0.5f); + offsetValues[3] = Vector2(-0.125f, 10.5f); + offsetValues[4] = Vector2(-10.875f, -0.5f); + + for(int i = 0; i < 5; ++i) { - popup.SetProperty( Toolkit::Popup::Property::CONTEXTUAL_MODE, mode[i] ); + popup.SetProperty(Toolkit::Popup::Property::CONTEXTUAL_MODE, mode[i]); std::string propertyResult; - DALI_TEST_CHECK( popup.GetProperty( Toolkit::Popup::Property::CONTEXTUAL_MODE ).Get( propertyResult ) ); - DALI_TEST_EQUALS( propertyResult, std::string( mode[i] ), TEST_LOCATION ); + DALI_TEST_CHECK(popup.GetProperty(Toolkit::Popup::Property::CONTEXTUAL_MODE).Get(propertyResult)); + DALI_TEST_EQUALS(propertyResult, std::string(mode[i]), TEST_LOCATION); - popup.SetDisplayState( Popup::SHOWN ); + popup.SetDisplayState(Popup::SHOWN); application.SendNotification(); application.Render(); // Check the position of the label within the popup. - DALI_TEST_EQUALS( contentLabel.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ).GetVectorXY(), offsetValues[i], TEST_LOCATION ); + DALI_TEST_EQUALS(contentLabel.GetCurrentProperty(Actor::Property::WORLD_POSITION).GetVectorXY(), offsetValues[i], TEST_LOCATION); - popup.SetDisplayState( Popup::HIDDEN ); + popup.SetDisplayState(Popup::HIDDEN); application.SendNotification(); application.Render(); } @@ -999,59 +998,59 @@ int UtcDaliPopupPropertyContextualMode(void) int UtcDaliPopupPropertyBacking(void) { ToolkitTestApplication application; - tet_infoline( " UtcDaliPopupPropertyBacking" ); + tet_infoline(" UtcDaliPopupPropertyBacking"); // Create the Popup actor Popup popup = Popup::New(); - popup.SetProperty( Popup::Property::ANIMATION_DURATION, 0.0f ); - application.GetScene().Add( popup ); + popup.SetProperty(Popup::Property::ANIMATION_DURATION, 0.0f); + application.GetScene().Add(popup); - Actor backing = popup.FindChildByName( "popupBacking" ); - DALI_TEST_CHECK( backing ); + Actor backing = popup.FindChildByName("popupBacking"); + DALI_TEST_CHECK(backing); - DALI_TEST_EQUALS( backing.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + DALI_TEST_EQUALS(backing.GetCurrentProperty(Actor::Property::OPACITY), 1.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION); // Check enabled property. - popup.SetDisplayState( Popup::SHOWN ); + popup.SetDisplayState(Popup::SHOWN); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( backing.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.5f, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + DALI_TEST_EQUALS(backing.GetCurrentProperty(Actor::Property::OPACITY), 0.5f, Math::MACHINE_EPSILON_0, TEST_LOCATION); - popup.SetDisplayState( Popup::HIDDEN ); + popup.SetDisplayState(Popup::HIDDEN); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( backing.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + DALI_TEST_EQUALS(backing.GetCurrentProperty(Actor::Property::OPACITY), 0.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION); - popup.SetProperty( Popup::Property::BACKING_ENABLED, false ); + popup.SetProperty(Popup::Property::BACKING_ENABLED, false); bool propertyResult; - DALI_TEST_CHECK( popup.GetProperty( Popup::Property::BACKING_ENABLED ).Get( propertyResult ) ); - DALI_TEST_EQUALS( propertyResult, false, TEST_LOCATION ); + DALI_TEST_CHECK(popup.GetProperty(Popup::Property::BACKING_ENABLED).Get(propertyResult)); + DALI_TEST_EQUALS(propertyResult, false, TEST_LOCATION); - popup.SetDisplayState( Popup::SHOWN ); + popup.SetDisplayState(Popup::SHOWN); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( backing.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + DALI_TEST_EQUALS(backing.GetCurrentProperty(Actor::Property::OPACITY), 0.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION); - popup.SetDisplayState( Popup::HIDDEN ); + popup.SetDisplayState(Popup::HIDDEN); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( backing.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION ); + DALI_TEST_EQUALS(backing.GetCurrentProperty(Actor::Property::OPACITY), 0.0f, Math::MACHINE_EPSILON_0, TEST_LOCATION); // Check color property. - popup.SetProperty( Popup::Property::BACKING_ENABLED, true ); - popup.SetProperty( Popup::Property::BACKING_COLOR, Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); + popup.SetProperty(Popup::Property::BACKING_ENABLED, true); + popup.SetProperty(Popup::Property::BACKING_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f)); - popup.SetDisplayState( Popup::SHOWN ); + popup.SetDisplayState(Popup::SHOWN); application.SendNotification(); application.Render(); Vector4 resultColor; - popup.GetProperty( Popup::Property::BACKING_COLOR ).Get( resultColor ); - DALI_TEST_EQUALS( resultColor, Vector4( 1.0f, 0.0f, 0.0f, 1.0f ), Math::MACHINE_EPSILON_0, TEST_LOCATION ); + popup.GetProperty(Popup::Property::BACKING_COLOR).Get(resultColor); + DALI_TEST_EQUALS(resultColor, Vector4(1.0f, 0.0f, 0.0f, 1.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION); END_TEST; } @@ -1059,17 +1058,17 @@ int UtcDaliPopupPropertyBacking(void) int UtcDaliPopupPropertyBackgroundImage(void) { ToolkitTestApplication application; - tet_infoline( " UtcDaliPopupPropertyBackgroundImage" ); + tet_infoline(" UtcDaliPopupPropertyBackgroundImage"); // Create the Popup actor Popup popup = Popup::New(); - application.GetScene().Add( popup ); + application.GetScene().Add(popup); // Check setting an image - popup.SetProperty( Toolkit::Popup::Property::POPUP_BACKGROUND_IMAGE, "invalid-image.png" ); + popup.SetProperty(Toolkit::Popup::Property::POPUP_BACKGROUND_IMAGE, "invalid-image.png"); std::string resultString; - popup.GetProperty( Toolkit::Popup::Property::POPUP_BACKGROUND_IMAGE ).Get( resultString ); - DALI_TEST_EQUALS( resultString, "invalid-image.png", TEST_LOCATION ); + popup.GetProperty(Toolkit::Popup::Property::POPUP_BACKGROUND_IMAGE).Get(resultString); + DALI_TEST_EQUALS(resultString, "invalid-image.png", TEST_LOCATION); END_TEST; } @@ -1077,82 +1076,82 @@ int UtcDaliPopupPropertyBackgroundImage(void) int UtcDaliPopupPropertyCustomAnimation(void) { ToolkitTestApplication application; - tet_infoline( " UtcDaliPopupPropertyCustomAnimation" ); + tet_infoline(" UtcDaliPopupPropertyCustomAnimation"); // Create the Popup actor - Popup popup = Popup::New(); - TextLabel content = TextLabel::New( "text" ); - popup.SetContent( content ); + Popup popup = Popup::New(); + TextLabel content = TextLabel::New("text"); + popup.SetContent(content); - popup.SetProperty( Popup::Property::ANIMATION_DURATION, 1.0f ); - popup.SetProperty( Popup::Property::ANIMATION_MODE, "CUSTOM" ); + popup.SetProperty(Popup::Property::ANIMATION_DURATION, 1.0f); + popup.SetProperty(Popup::Property::ANIMATION_MODE, "CUSTOM"); - Actor popupContainer = popup.FindChildByName( "popupContainer" ); - DALI_TEST_CHECK( popupContainer ); + Actor popupContainer = popup.FindChildByName("popupContainer"); + DALI_TEST_CHECK(popupContainer); - Vector3 entryAnimationDestination( 300.0f, 200.0f, 0.0f ); - Vector3 exitAnimationDestination( -300.0f, -200.0f, 0.0f ); + Vector3 entryAnimationDestination(300.0f, 200.0f, 0.0f); + Vector3 exitAnimationDestination(-300.0f, -200.0f, 0.0f); Property::Map animationMapEntry; - animationMapEntry.Insert( "actor", "customAnimationPopup" ); - animationMapEntry.Insert( "property", "position" ); - animationMapEntry.Insert( "value", entryAnimationDestination ); - animationMapEntry.Insert( "alphaFunction", "EASE_OUT" ); + animationMapEntry.Insert("actor", "customAnimationPopup"); + animationMapEntry.Insert("property", "position"); + animationMapEntry.Insert("value", entryAnimationDestination); + animationMapEntry.Insert("alphaFunction", "EASE_OUT"); Property::Array timePeriodMapEntry; - timePeriodMapEntry.PushBack( 0.0f ); - timePeriodMapEntry.PushBack( 1.0f ); + timePeriodMapEntry.PushBack(0.0f); + timePeriodMapEntry.PushBack(1.0f); - animationMapEntry.Insert( "timePeriod", timePeriodMapEntry ); + animationMapEntry.Insert("timePeriod", timePeriodMapEntry); Property::Map animationMapExit; - animationMapExit.Insert( "actor", "customAnimationPopup" ); - animationMapExit.Insert( "property", "position" ); - animationMapExit.Insert( "value", exitAnimationDestination ); - animationMapExit.Insert( "alphaFunction", "EASE_IN" ); + animationMapExit.Insert("actor", "customAnimationPopup"); + animationMapExit.Insert("property", "position"); + animationMapExit.Insert("value", exitAnimationDestination); + animationMapExit.Insert("alphaFunction", "EASE_IN"); Property::Array timePeriodMapExit; - timePeriodMapExit.PushBack( 0.0f ); - timePeriodMapExit.PushBack( 1.0f ); + timePeriodMapExit.PushBack(0.0f); + timePeriodMapExit.PushBack(1.0f); - animationMapExit.Insert( "timePeriod", timePeriodMapExit ); + animationMapExit.Insert("timePeriod", timePeriodMapExit); - popup.SetProperty( Toolkit::Popup::Property::ENTRY_ANIMATION, animationMapEntry ); - popup.SetProperty( Toolkit::Popup::Property::EXIT_ANIMATION, animationMapExit ); + popup.SetProperty(Toolkit::Popup::Property::ENTRY_ANIMATION, animationMapEntry); + popup.SetProperty(Toolkit::Popup::Property::EXIT_ANIMATION, animationMapExit); Property::Map resultMap; - DALI_TEST_CHECK( popup.GetProperty( Toolkit::Popup::Property::ENTRY_ANIMATION ).Get( resultMap ) ); - DALI_TEST_EQUALS( resultMap.Count(), 0u, TEST_LOCATION ); - DALI_TEST_CHECK( popup.GetProperty( Toolkit::Popup::Property::EXIT_ANIMATION ).Get( resultMap ) ); - DALI_TEST_EQUALS( resultMap.Count(), 0u, TEST_LOCATION ); + DALI_TEST_CHECK(popup.GetProperty(Toolkit::Popup::Property::ENTRY_ANIMATION).Get(resultMap)); + DALI_TEST_EQUALS(resultMap.Count(), 0u, TEST_LOCATION); + DALI_TEST_CHECK(popup.GetProperty(Toolkit::Popup::Property::EXIT_ANIMATION).Get(resultMap)); + DALI_TEST_EQUALS(resultMap.Count(), 0u, TEST_LOCATION); - application.GetScene().Add( popup ); - popup.SetDisplayState( Popup::SHOWN ); + application.GetScene().Add(popup); + popup.SetDisplayState(Popup::SHOWN); - for( int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++ ) + for(int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++) { application.SendNotification(); - application.Render( RENDER_FRAME_INTERVAL ); + application.Render(RENDER_FRAME_INTERVAL); } // Test the popup has animated to it's entry-transition destination. - DALI_TEST_EQUALS( popupContainer.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), entryAnimationDestination, 0.1f, TEST_LOCATION ); + DALI_TEST_EQUALS(popupContainer.GetCurrentProperty(Actor::Property::WORLD_POSITION), entryAnimationDestination, 0.1f, TEST_LOCATION); - popup.SetDisplayState( Popup::HIDDEN ); + popup.SetDisplayState(Popup::HIDDEN); - for( int j = 0; j < RENDER_ANIMATION_TEST_DURATION_FRAMES; j++ ) + for(int j = 0; j < RENDER_ANIMATION_TEST_DURATION_FRAMES; j++) { application.SendNotification(); - application.Render( RENDER_FRAME_INTERVAL ); + application.Render(RENDER_FRAME_INTERVAL); } - DALI_TEST_EQUALS( popupContainer.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), exitAnimationDestination, 0.1f, TEST_LOCATION ); + DALI_TEST_EQUALS(popupContainer.GetCurrentProperty(Actor::Property::WORLD_POSITION), exitAnimationDestination, 0.1f, TEST_LOCATION); END_TEST; } static bool gPushButtonClicked; -static bool PushButtonClicked( Button button ) +static bool PushButtonClicked(Button button) { gPushButtonClicked = true; return true; @@ -1161,32 +1160,32 @@ static bool PushButtonClicked( Button button ) int UtcDaliPopupPropertyTouchTransparent(void) { ToolkitTestApplication application; - tet_infoline( " UtcDaliPopupPropertyTouchTransparent" ); + tet_infoline(" UtcDaliPopupPropertyTouchTransparent"); // Create the Popup actor - Popup popup = Popup::New(); - TextLabel content = TextLabel::New( "text" ); - popup.SetContent( content ); - popup.SetProperty( Popup::Property::ANIMATION_DURATION, 0.0f ); - popup.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - popup.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - popup.SetProperty( Actor::Property::SIZE, Vector2(100.0f, 100.0f) ); - popup.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); + Popup popup = Popup::New(); + TextLabel content = TextLabel::New("text"); + popup.SetContent(content); + popup.SetProperty(Popup::Property::ANIMATION_DURATION, 0.0f); + popup.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + popup.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + popup.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + popup.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS); // Create a button (to go underneath the popup). PushButton button = Toolkit::PushButton::New(); - button.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - button.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - button.SetProperty( Actor::Property::SIZE, Vector2(100.0f, 100.0f) ); - button.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); + button.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + button.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + button.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + button.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS); - button.ClickedSignal().Connect( &PushButtonClicked ); + button.ClickedSignal().Connect(&PushButtonClicked); - application.GetScene().Add( button ); + application.GetScene().Add(button); - button.Add( popup ); + button.Add(popup); - popup.SetDisplayState( Popup::SHOWN ); + popup.SetDisplayState(Popup::SHOWN); application.SendNotification(); application.Render(); @@ -1195,45 +1194,45 @@ int UtcDaliPopupPropertyTouchTransparent(void) // Perform a click, the popup should block the click from hitting the button. event = Dali::Integration::TouchEvent(); - event.AddPoint( GetPointDown() ); - application.ProcessEvent( event ); + event.AddPoint(GetPointDown()); + application.ProcessEvent(event); application.SendNotification(); application.Render(); event = Dali::Integration::TouchEvent(); - event.AddPoint( GetPointUp() ); - application.ProcessEvent( event ); + event.AddPoint(GetPointUp()); + application.ProcessEvent(event); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( !gPushButtonClicked ); + 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 ); + 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 ); + popup.SetProperty(Popup::Property::TOUCH_TRANSPARENT, true); bool propertyResult; - DALI_TEST_CHECK( popup.GetProperty( Popup::Property::TOUCH_TRANSPARENT ).Get( propertyResult ) ); - DALI_TEST_EQUALS( propertyResult, true, TEST_LOCATION ); + DALI_TEST_CHECK(popup.GetProperty(Popup::Property::TOUCH_TRANSPARENT).Get(propertyResult)); + DALI_TEST_EQUALS(propertyResult, true, TEST_LOCATION); // Perform a click, the popup should allow the click to travel through to the button. event = Dali::Integration::TouchEvent(); - event.AddPoint( GetPointDown() ); - application.ProcessEvent( event ); + event.AddPoint(GetPointDown()); + application.ProcessEvent(event); application.SendNotification(); application.Render(); event = Dali::Integration::TouchEvent(); - event.AddPoint( GetPointUp() ); - application.ProcessEvent( event ); + event.AddPoint(GetPointUp()); + application.ProcessEvent(event); application.SendNotification(); application.Render(); - DALI_TEST_CHECK( gPushButtonClicked ); + DALI_TEST_CHECK(gPushButtonClicked); END_TEST; } @@ -1241,105 +1240,105 @@ int UtcDaliPopupPropertyTouchTransparent(void) int UtcDaliPopupPropertyTail(void) { ToolkitTestApplication application; - tet_infoline( " UtcDaliPopupPropertyTail" ); + tet_infoline(" UtcDaliPopupPropertyTail"); // Create the Popup actor Popup popup = Popup::New(); - popup.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - popup.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - popup.SetProperty( Actor::Property::SIZE, Vector2(100.0f, 100.0f) ); - popup.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); - TextLabel content = TextLabel::New( "text" ); - popup.SetContent( content ); + popup.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + popup.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + popup.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + popup.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS); + TextLabel content = TextLabel::New("text"); + popup.SetContent(content); std::string imageFilename = "invalid-image.jpg"; - popup.SetProperty( Popup::Property::TAIL_DOWN_IMAGE, imageFilename ); - popup.SetProperty( Popup::Property::TAIL_UP_IMAGE, imageFilename ); - popup.SetProperty( Popup::Property::TAIL_RIGHT_IMAGE, imageFilename ); - popup.SetProperty( Popup::Property::TAIL_LEFT_IMAGE, imageFilename ); + popup.SetProperty(Popup::Property::TAIL_DOWN_IMAGE, imageFilename); + popup.SetProperty(Popup::Property::TAIL_UP_IMAGE, imageFilename); + popup.SetProperty(Popup::Property::TAIL_RIGHT_IMAGE, imageFilename); + popup.SetProperty(Popup::Property::TAIL_LEFT_IMAGE, imageFilename); std::string resultString; - popup.GetProperty( Toolkit::Popup::Property::TAIL_DOWN_IMAGE ).Get( resultString ); - DALI_TEST_EQUALS( resultString, imageFilename, TEST_LOCATION ); - popup.GetProperty( Toolkit::Popup::Property::TAIL_UP_IMAGE ).Get( resultString ); - DALI_TEST_EQUALS( resultString, imageFilename, TEST_LOCATION ); - popup.GetProperty( Toolkit::Popup::Property::TAIL_RIGHT_IMAGE ).Get( resultString ); - DALI_TEST_EQUALS( resultString, imageFilename, TEST_LOCATION ); - popup.GetProperty( Toolkit::Popup::Property::TAIL_LEFT_IMAGE ).Get( resultString ); - DALI_TEST_EQUALS( resultString, imageFilename, TEST_LOCATION ); - - popup.SetProperty( Popup::Property::TAIL_VISIBILITY, true ); + popup.GetProperty(Toolkit::Popup::Property::TAIL_DOWN_IMAGE).Get(resultString); + DALI_TEST_EQUALS(resultString, imageFilename, TEST_LOCATION); + popup.GetProperty(Toolkit::Popup::Property::TAIL_UP_IMAGE).Get(resultString); + DALI_TEST_EQUALS(resultString, imageFilename, TEST_LOCATION); + popup.GetProperty(Toolkit::Popup::Property::TAIL_RIGHT_IMAGE).Get(resultString); + DALI_TEST_EQUALS(resultString, imageFilename, TEST_LOCATION); + popup.GetProperty(Toolkit::Popup::Property::TAIL_LEFT_IMAGE).Get(resultString); + DALI_TEST_EQUALS(resultString, imageFilename, TEST_LOCATION); + + popup.SetProperty(Popup::Property::TAIL_VISIBILITY, true); bool boolResult; - DALI_TEST_CHECK( popup.GetProperty( Popup::Property::TAIL_VISIBILITY ).Get( boolResult ) ); - DALI_TEST_EQUALS( boolResult, true, TEST_LOCATION ); + DALI_TEST_CHECK(popup.GetProperty(Popup::Property::TAIL_VISIBILITY).Get(boolResult)); + DALI_TEST_EQUALS(boolResult, true, TEST_LOCATION); - Actor tailActor; - Vector3 tailPosition( ParentOrigin::TOP_CENTER ); + Actor tailActor; + Vector3 tailPosition(ParentOrigin::TOP_CENTER); - popup.SetProperty( Popup::Property::TAIL_POSITION, tailPosition ); + popup.SetProperty(Popup::Property::TAIL_POSITION, tailPosition); Vector3 vectorResult; - DALI_TEST_CHECK( popup.GetProperty( Popup::Property::TAIL_POSITION ).Get( vectorResult ) ); - DALI_TEST_EQUALS( vectorResult, tailPosition, TEST_LOCATION ); + DALI_TEST_CHECK(popup.GetProperty(Popup::Property::TAIL_POSITION).Get(vectorResult)); + DALI_TEST_EQUALS(vectorResult, tailPosition, TEST_LOCATION); - application.GetScene().Add( popup ); + application.GetScene().Add(popup); - popup.SetDisplayState( Popup::SHOWN ); + popup.SetDisplayState(Popup::SHOWN); application.SendNotification(); application.Render(); - tailActor = popup.FindChildByName( "tailImage" ); - DALI_TEST_CHECK( tailActor ); + tailActor = popup.FindChildByName("tailImage"); + DALI_TEST_CHECK(tailActor); - float baseValX = tailActor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ).x; + float baseValX = tailActor.GetCurrentProperty(Actor::Property::WORLD_POSITION).x; - DALI_TEST_GREATER( baseValX, tailActor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ).y, TEST_LOCATION ); + DALI_TEST_GREATER(baseValX, tailActor.GetCurrentProperty(Actor::Property::WORLD_POSITION).y, TEST_LOCATION); - popup.SetDisplayState( Popup::HIDDEN ); + popup.SetDisplayState(Popup::HIDDEN); application.SendNotification(); application.Render(); tailPosition = ParentOrigin::CENTER_LEFT; - popup.SetProperty( Popup::Property::TAIL_POSITION, tailPosition ); + popup.SetProperty(Popup::Property::TAIL_POSITION, tailPosition); - popup.SetDisplayState( Popup::SHOWN ); + popup.SetDisplayState(Popup::SHOWN); application.SendNotification(); application.Render(); - tailActor = popup.FindChildByName( "tailImage" ); - DALI_TEST_CHECK( tailActor ); + tailActor = popup.FindChildByName("tailImage"); + DALI_TEST_CHECK(tailActor); - float baseValY = tailActor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ).y; - DALI_TEST_GREATER( baseValX, tailActor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ).x, TEST_LOCATION ); + float baseValY = tailActor.GetCurrentProperty(Actor::Property::WORLD_POSITION).y; + DALI_TEST_GREATER(baseValX, tailActor.GetCurrentProperty(Actor::Property::WORLD_POSITION).x, TEST_LOCATION); - popup.SetDisplayState( Popup::HIDDEN ); + popup.SetDisplayState(Popup::HIDDEN); application.SendNotification(); application.Render(); tailPosition = ParentOrigin::BOTTOM_CENTER; - popup.SetProperty( Popup::Property::TAIL_POSITION, tailPosition ); + popup.SetProperty(Popup::Property::TAIL_POSITION, tailPosition); - popup.SetDisplayState( Popup::SHOWN ); + popup.SetDisplayState(Popup::SHOWN); application.SendNotification(); application.Render(); - tailActor = popup.FindChildByName( "tailImage" ); - DALI_TEST_CHECK( tailActor ); - DALI_TEST_EQUALS( tailActor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ).x, baseValX, TEST_LOCATION ); - DALI_TEST_GREATER( tailActor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ).y, baseValY, TEST_LOCATION ); + tailActor = popup.FindChildByName("tailImage"); + DALI_TEST_CHECK(tailActor); + DALI_TEST_EQUALS(tailActor.GetCurrentProperty(Actor::Property::WORLD_POSITION).x, baseValX, TEST_LOCATION); + DALI_TEST_GREATER(tailActor.GetCurrentProperty(Actor::Property::WORLD_POSITION).y, baseValY, TEST_LOCATION); - popup.SetDisplayState( Popup::HIDDEN ); + popup.SetDisplayState(Popup::HIDDEN); application.SendNotification(); application.Render(); tailPosition = ParentOrigin::CENTER_RIGHT; - popup.SetProperty( Popup::Property::TAIL_POSITION, tailPosition ); + popup.SetProperty(Popup::Property::TAIL_POSITION, tailPosition); - popup.SetDisplayState( Popup::SHOWN ); + popup.SetDisplayState(Popup::SHOWN); application.SendNotification(); application.Render(); - tailActor = popup.FindChildByName( "tailImage" ); - DALI_TEST_CHECK( tailActor ); - DALI_TEST_GREATER( tailActor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ).x, baseValX, TEST_LOCATION ); - DALI_TEST_EQUALS( tailActor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ).y, baseValY, TEST_LOCATION ); + tailActor = popup.FindChildByName("tailImage"); + DALI_TEST_CHECK(tailActor); + DALI_TEST_GREATER(tailActor.GetCurrentProperty(Actor::Property::WORLD_POSITION).x, baseValX, TEST_LOCATION); + DALI_TEST_EQUALS(tailActor.GetCurrentProperty(Actor::Property::WORLD_POSITION).y, baseValY, TEST_LOCATION); - popup.SetDisplayState( Popup::HIDDEN ); + popup.SetDisplayState(Popup::HIDDEN); application.SendNotification(); application.Render(); @@ -1349,49 +1348,49 @@ int UtcDaliPopupPropertyTail(void) int UtcDaliPopupTypeToast(void) { ToolkitTestApplication application; - tet_infoline( " UtcDaliPopupTypeToast" ); + tet_infoline(" UtcDaliPopupTypeToast"); - TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( "PopupToast" ); - DALI_TEST_CHECK( typeInfo ) + TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo("PopupToast"); + DALI_TEST_CHECK(typeInfo) BaseHandle baseHandle = typeInfo.CreateInstance(); - DALI_TEST_CHECK( baseHandle ) + DALI_TEST_CHECK(baseHandle) - Toolkit::Popup popup = Toolkit::Popup::DownCast( baseHandle ); - gPopupState = Toolkit::Popup::HIDDEN; - ConnectStateSignals( popup ); - popup.SetProperty( Popup::Property::ANIMATION_DURATION, 1.0f ); + Toolkit::Popup popup = Toolkit::Popup::DownCast(baseHandle); + gPopupState = Toolkit::Popup::HIDDEN; + ConnectStateSignals(popup); + popup.SetProperty(Popup::Property::ANIMATION_DURATION, 1.0f); - popup.SetTitle( Toolkit::TextLabel::New( "This is a Toast Popup.\nIt will auto-hide itself" ) ); - application.GetScene().Add( popup ); - popup.SetDisplayState( Toolkit::Popup::SHOWN ); + popup.SetTitle(Toolkit::TextLabel::New("This is a Toast Popup.\nIt will auto-hide itself")); + application.GetScene().Add(popup); + popup.SetDisplayState(Toolkit::Popup::SHOWN); - for( int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++ ) + for(int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++) { application.SendNotification(); - application.Render( RENDER_FRAME_INTERVAL ); + application.Render(RENDER_FRAME_INTERVAL); } // Check the toast popup is shown. - DALI_TEST_EQUALS( gPopupState, Popup::SHOWN, TEST_LOCATION ); + DALI_TEST_EQUALS(gPopupState, Popup::SHOWN, TEST_LOCATION); - for( int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++ ) + for(int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++) { application.SendNotification(); - application.Render( RENDER_FRAME_INTERVAL ); + application.Render(RENDER_FRAME_INTERVAL); } // Check the toast popup hides. - Dali::Timer timer = Timer::New( 0 ); + Dali::Timer timer = Timer::New(0); timer.MockEmitSignal(); - for( int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++ ) + for(int i = 0; i < RENDER_ANIMATION_TEST_DURATION_FRAMES; i++) { application.SendNotification(); - application.Render( RENDER_FRAME_INTERVAL ); + application.Render(RENDER_FRAME_INTERVAL); } - DALI_TEST_EQUALS( gPopupState, Popup::HIDDEN, TEST_LOCATION ); + DALI_TEST_EQUALS(gPopupState, Popup::HIDDEN, TEST_LOCATION); END_TEST; } @@ -1399,27 +1398,27 @@ int UtcDaliPopupTypeToast(void) int UtcDaliPopupTypeRegistryCreation(void) { ToolkitTestApplication application; - tet_infoline( " UtcDaliPopupTypeRegistryCreation" ); + tet_infoline(" UtcDaliPopupTypeRegistryCreation"); - TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( "Popup" ); - DALI_TEST_CHECK( typeInfo ) + TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo("Popup"); + DALI_TEST_CHECK(typeInfo) BaseHandle baseHandle = typeInfo.CreateInstance(); - DALI_TEST_CHECK( baseHandle ) + DALI_TEST_CHECK(baseHandle) - Toolkit::Popup popup = Toolkit::Popup::DownCast( baseHandle ); - gPopupState = Toolkit::Popup::HIDDEN; - ConnectStateSignals( popup ); - popup.SetProperty( Popup::Property::ANIMATION_DURATION, 0.0f ); + Toolkit::Popup popup = Toolkit::Popup::DownCast(baseHandle); + gPopupState = Toolkit::Popup::HIDDEN; + ConnectStateSignals(popup); + popup.SetProperty(Popup::Property::ANIMATION_DURATION, 0.0f); - application.GetScene().Add( popup ); - popup.SetDisplayState( Toolkit::Popup::SHOWN ); + application.GetScene().Add(popup); + popup.SetDisplayState(Toolkit::Popup::SHOWN); application.SendNotification(); application.Render(); // Check the popup is shown. - DALI_TEST_EQUALS( gPopupState, Popup::SHOWN, TEST_LOCATION ); + DALI_TEST_EQUALS(gPopupState, Popup::SHOWN, TEST_LOCATION); END_TEST; } @@ -1427,21 +1426,21 @@ int UtcDaliPopupTypeRegistryCreation(void) int UtcDaliPopupPropertyTypeRegistryConnectSignal(void) { ToolkitTestApplication application; - tet_infoline( " UtcDaliPopupPropertyTypeRegistryConnectSignal" ); + tet_infoline(" UtcDaliPopupPropertyTypeRegistryConnectSignal"); // Create the Popup actor Popup popup = Popup::New(); TestConnectionTrackerObject* testTracker = new TestConnectionTrackerObject(); // Note: The emmision of this signals has already been tested in other tests. - DALI_TEST_CHECK( popup.ConnectSignal( testTracker, "touchedOutside", PopupTestFunctor() ) ); - DALI_TEST_CHECK( popup.ConnectSignal( testTracker, "showing", PopupTestFunctor() ) ); - DALI_TEST_CHECK( popup.ConnectSignal( testTracker, "shown", PopupTestFunctor() ) ); - DALI_TEST_CHECK( popup.ConnectSignal( testTracker, "hiding", PopupTestFunctor() ) ); - DALI_TEST_CHECK( popup.ConnectSignal( testTracker, "hidden", PopupTestFunctor() ) ); + DALI_TEST_CHECK(popup.ConnectSignal(testTracker, "touchedOutside", PopupTestFunctor())); + DALI_TEST_CHECK(popup.ConnectSignal(testTracker, "showing", PopupTestFunctor())); + DALI_TEST_CHECK(popup.ConnectSignal(testTracker, "shown", PopupTestFunctor())); + DALI_TEST_CHECK(popup.ConnectSignal(testTracker, "hiding", PopupTestFunctor())); + DALI_TEST_CHECK(popup.ConnectSignal(testTracker, "hidden", PopupTestFunctor())); // Test connecting to an invalid signal does not work. - DALI_TEST_CHECK( !popup.ConnectSignal( testTracker, "invalid", PopupTestFunctor() ) ); + DALI_TEST_CHECK(!popup.ConnectSignal(testTracker, "invalid", PopupTestFunctor())); END_TEST; } @@ -1449,17 +1448,17 @@ int UtcDaliPopupPropertyTypeRegistryConnectSignal(void) int UtcDaliPopupOnChildAdd(void) { ToolkitTestApplication application; - tet_infoline( " UtcDaliPopupOnChildAdd" ); + tet_infoline(" UtcDaliPopupOnChildAdd"); // Create the Popup actor Popup popup = Popup::New(); - popup.SetProperty( Popup::Property::ANIMATION_DURATION, 0.0f ); + popup.SetProperty(Popup::Property::ANIMATION_DURATION, 0.0f); std::string testLabelText = "ContentTest"; - TextLabel contentLabel = TextLabel::New( testLabelText ); + TextLabel contentLabel = TextLabel::New(testLabelText); - popup.Add( contentLabel ); + popup.Add(contentLabel); - DALI_TEST_CHECK( HasAncestor( contentLabel, popup ) ); + DALI_TEST_CHECK(HasAncestor(contentLabel, popup)); END_TEST; } @@ -1467,26 +1466,26 @@ int UtcDaliPopupOnChildAdd(void) int UtcDaliPopupOnKeyEvent(void) { ToolkitTestApplication application; - tet_infoline( " UtcDaliPopupOnKeyEvent" ); + tet_infoline(" UtcDaliPopupOnKeyEvent"); // Create the Popup actor Popup popup = Popup::New(); - popup.SetProperty( Popup::Property::ANIMATION_DURATION, 0.0f ); - application.GetScene().Add( popup ); + popup.SetProperty(Popup::Property::ANIMATION_DURATION, 0.0f); + application.GetScene().Add(popup); - popup.SetDisplayState( Popup::SHOWN ); + popup.SetDisplayState(Popup::SHOWN); application.SendNotification(); application.Render(); - DALI_TEST_EQUALS( popup.GetDisplayState(), Popup::SHOWN, TEST_LOCATION ); + DALI_TEST_EQUALS(popup.GetDisplayState(), Popup::SHOWN, TEST_LOCATION); 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(); - DALI_TEST_EQUALS( popup.GetDisplayState(), Popup::HIDDEN, TEST_LOCATION ); + DALI_TEST_EQUALS(popup.GetDisplayState(), Popup::HIDDEN, TEST_LOCATION); END_TEST; } @@ -1495,21 +1494,21 @@ int UtcDaliPopupSetPopupBackgroundBorderProperty(void) { ToolkitTestApplication application; - tet_infoline( "Set the background border property of a popup & retrieve it" ); + tet_infoline("Set the background border property of a popup & retrieve it"); Popup popup = Popup::New(); - Rect< int > rect( 40, 30, 20, 10 ); - tet_infoline( "Ensure value we want to set is different from what is already set" ); - DALI_TEST_CHECK( rect != popup.GetProperty( Popup::Property::POPUP_BACKGROUND_BORDER ).Get< Rect< int > >() ); + Rect rect(40, 30, 20, 10); + tet_infoline("Ensure value we want to set is different from what is already set"); + DALI_TEST_CHECK(rect != popup.GetProperty(Popup::Property::POPUP_BACKGROUND_BORDER).Get >()); - tet_infoline( "Set the property and retrieve it to make sure it's the value we set" ); - popup.SetProperty( Popup::Property::POPUP_BACKGROUND_BORDER, rect ); - DALI_TEST_EQUALS( rect, popup.GetProperty( Popup::Property::POPUP_BACKGROUND_BORDER ).Get< Rect< int > >(), TEST_LOCATION ); + tet_infoline("Set the property and retrieve it to make sure it's the value we set"); + popup.SetProperty(Popup::Property::POPUP_BACKGROUND_BORDER, rect); + DALI_TEST_EQUALS(rect, popup.GetProperty(Popup::Property::POPUP_BACKGROUND_BORDER).Get >(), TEST_LOCATION); - tet_infoline( "Set a vector4 as well which should also work" ); - Vector4 vectorValue( 10.0f, 20.0f, 30.0f, 40.0f ); - popup.SetProperty( Popup::Property::POPUP_BACKGROUND_BORDER, vectorValue ); - DALI_TEST_EQUALS( Rect< int >( 10, 20, 30, 40 ), popup.GetProperty( Popup::Property::POPUP_BACKGROUND_BORDER ).Get< Rect< int > >(), TEST_LOCATION ); + tet_infoline("Set a vector4 as well which should also work"); + Vector4 vectorValue(10.0f, 20.0f, 30.0f, 40.0f); + popup.SetProperty(Popup::Property::POPUP_BACKGROUND_BORDER, vectorValue); + DALI_TEST_EQUALS(Rect(10, 20, 30, 40), popup.GetProperty(Popup::Property::POPUP_BACKGROUND_BORDER).Get >(), TEST_LOCATION); END_TEST; }