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-KeyboardFocusManager.cpp;h=720f596fae403a886baa08aff53a50f97df0ebc2;hp=cdecb166b6562ade4b5487f959c483242f1e8ea0;hb=1a0dc2cc53708bbc32546da6031e996465544f51;hpb=d37f5d8ff0d554b566dfbcdc765a681123cbf4e8 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp b/automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp old mode 100755 new mode 100644 index cdecb16..720f596 --- a/automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-KeyboardFocusManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ #include #include #include +#include using namespace Dali; using namespace Dali::Toolkit; @@ -297,12 +298,12 @@ int UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor(void) // Create the first actor and add it to the stage Actor first = Actor::New(); first.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); - Stage::GetCurrent().Add(first); + application.GetScene().Add(first); // Create the second actor and add it to the stage Actor second = Actor::New(); second.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); - Stage::GetCurrent().Add(second); + application.GetScene().Add(second); // Create the third actor but don't add it to the stage Actor third = Actor::New(); @@ -326,7 +327,7 @@ int UtcDaliKeyboardFocusManagerSetAndGetCurrentFocusActor(void) DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); // Add the third actor to the stage - Stage::GetCurrent().Add(third); + application.GetScene().Add(third); // Check that it will fail to set focus on the third actor as it's not focusable DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false); @@ -368,12 +369,12 @@ int UtcDaliKeyboardFocusManagerMoveFocus(void) // Create the first actor and add it to the stage Actor first = Actor::New(); first.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); - Stage::GetCurrent().Add(first); + application.GetScene().Add(first); // Create the second actor and add it to the stage Actor second = Actor::New(); second.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); - Stage::GetCurrent().Add(second); + application.GetScene().Add(second); // Move the focus to the right DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == false); @@ -424,7 +425,7 @@ int UtcDaliKeyboardFocusManagerMoveFocus(void) // Create a 2x2 table view and try to move focus inside it TableView tableView = TableView::New( 2, 2 ); - Stage::GetCurrent().Add(tableView); + application.GetScene().Add(tableView); // Create the third actor Actor third = Actor::New(); @@ -531,12 +532,12 @@ int UtcDaliKeyboardFocusManagerCustomAlgorithmMoveFocus(void) // Create the first actor and add it to the stage Actor first = Actor::New(); first.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); - Stage::GetCurrent().Add(first); + application.GetScene().Add(first); // Create the second actor and add it to the stage Actor second = Actor::New(); second.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); - Stage::GetCurrent().Add(second); + application.GetScene().Add(second); // Move the focus to the right DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == false); @@ -625,8 +626,8 @@ int UtcDaliKeyboardFocusManagerFocusablePropertiesMoveFocus(void) PushButton button2 = PushButton::New(); button1.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); button2.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); - Stage::GetCurrent().Add(button1); - Stage::GetCurrent().Add(button2); + application.GetScene().Add(button1); + application.GetScene().Add(button2); // Set the focus to the button1 DALI_TEST_CHECK(manager.SetCurrentFocusActor(button1) == true); @@ -690,7 +691,7 @@ int UtcDaliKeyboardFocusManagerFocusablePropertiesMoveFocus(void) // Create a 1x1 table view and try to move focus inside it TableView tableView = TableView::New( 1, 1 ); - Stage::GetCurrent().Add(tableView); + application.GetScene().Add(tableView); PushButton button = PushButton::New(); button.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); @@ -732,12 +733,12 @@ int UtcDaliKeyboardFocusManagerClearFocus(void) // Create the first actor and add it to the stage Actor first = Actor::New(); first.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); - Stage::GetCurrent().Add(first); + application.GetScene().Add(first); // Create the second actor and add it to the stage Actor second = Actor::New(); second.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); - Stage::GetCurrent().Add(second); + application.GetScene().Add(second); // Check that the focus is set on the first actor DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true); @@ -819,7 +820,7 @@ int UtcDaliKeyboardFocusManagerGetFocusGroup(void) Actor parent = Actor::New(); Actor child = Actor::New(); parent.Add(child); - Stage::GetCurrent().Add(parent); + application.GetScene().Add(parent); // Create three actors and add them as the children of the first child actor Actor grandChild = Actor::New(); @@ -893,7 +894,7 @@ int UtcDaliKeyboardFocusManagerSignalFocusedActorActivated(void) FocusedActorActivatedCallback focusedActorActivatedCallback(focusedActorActivatedSignalVerified); manager.FocusedActorEnterKeySignal().Connect( &focusedActorActivatedCallback, &FocusedActorActivatedCallback::Callback ); - Integration::KeyEvent returnEvent( "Return", "", "", 0, 0, 0, Integration::KeyEvent::Up, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); + Integration::KeyEvent returnEvent( "Return", "", "", 0, 0, 0, Integration::KeyEvent::UP, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); // Press Any key to notice physical keyboard event is comming to KeyboardFocusManager // It makes mIsFocusIndicatorEnabled true @@ -902,12 +903,12 @@ int UtcDaliKeyboardFocusManagerSignalFocusedActorActivated(void) // Create the first button and add it to the stage PushButton firstPushButton = PushButton::New(); firstPushButton.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); - Stage::GetCurrent().Add(firstPushButton); + application.GetScene().Add(firstPushButton); // Create the second button and add it to the stage PushButton secondPushButton = PushButton::New(); secondPushButton.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); - Stage::GetCurrent().Add(secondPushButton); + application.GetScene().Add(secondPushButton); // Check that the focus is set on the first button DALI_TEST_CHECK(manager.SetCurrentFocusActor(firstPushButton) == true); @@ -951,8 +952,8 @@ int UtcDaliKeyboardFocusManagerSignalFocusGroupChanged(void) FocusGroupChangedCallback focusGroupChangedCallback(focusGroupChangedSignalVerified); manager.FocusGroupChangedSignal().Connect( &focusGroupChangedCallback, &FocusGroupChangedCallback::Callback ); - Integration::KeyEvent tabEvent( "Tab", "", "", 0, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - Integration::KeyEvent shiftTabEvent( "Tab", "", "", 0, 1, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); + Integration::KeyEvent tabEvent( "Tab", "", "", 0, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); + Integration::KeyEvent shiftTabEvent( "Tab", "", "", 0, 1, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); // Press Any key to notice physical keyboard event is comming to KeyboardFocusManager // It makes mIsFocusIndicatorEnabled true @@ -1002,22 +1003,22 @@ int UtcDaliKeyboardFocusManagerMoveFocusBackward(void) // Create the first actor and add it to the stage Actor first = Actor::New(); first.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); - Stage::GetCurrent().Add(first); + application.GetScene().Add(first); // Create the second actor and add it to the stage Actor second = Actor::New(); second.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); - Stage::GetCurrent().Add(second); + application.GetScene().Add(second); // Create the third actor and add it to the stage Actor third = Actor::New(); third.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); - Stage::GetCurrent().Add(third); + application.GetScene().Add(third); // Create the fourth actor and add it to the stage Actor fourth = Actor::New(); fourth.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); - Stage::GetCurrent().Add(fourth); + application.GetScene().Add(fourth); // Check that the focus is set on the second actor DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true); @@ -1059,7 +1060,7 @@ int UtcDaliKeyboardFocusManagerMoveFocusBackward(void) { Actor actor = Actor::New(); actor.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); - Stage::GetCurrent().Add(actor); + application.GetScene().Add(actor); manager.SetCurrentFocusActor(actor); } @@ -1091,12 +1092,12 @@ int UtcDaliKeyboardFocusManagerChangeFocusDirectionByKeyEvents(void) FocusChangedCallback focusChangedCallback(focusChangedSignalVerified); manager.FocusChangedSignal().Connect( &focusChangedCallback, &FocusChangedCallback::Callback ); - Integration::KeyEvent leftEvent( "Left", "", "", 0, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - Integration::KeyEvent rightEvent( "Right", "", "", 0, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - Integration::KeyEvent upEvent( "Up", "", "", 0, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - Integration::KeyEvent downEvent( "Down", "", "", 0, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - Integration::KeyEvent pageUpEvent( "Prior", "", "", 0, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); - Integration::KeyEvent pageDownEvent( "Next", "", "", 0, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); + Integration::KeyEvent leftEvent( "Left", "", "", 0, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); + Integration::KeyEvent rightEvent( "Right", "", "", 0, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); + Integration::KeyEvent upEvent( "Up", "", "", 0, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); + Integration::KeyEvent downEvent( "Down", "", "", 0, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); + Integration::KeyEvent pageUpEvent( "Prior", "", "", 0, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); + Integration::KeyEvent pageDownEvent( "Next", "", "", 0, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); // Press Any key to notice physical keyboard event is comming to KeyboardFocusManager // It makes mIsFocusIndicatorEnabled true @@ -1104,7 +1105,7 @@ int UtcDaliKeyboardFocusManagerChangeFocusDirectionByKeyEvents(void) // Create a 2x2 table view and try to move focus inside it TableView tableView = TableView::New( 2, 2 ); - Stage::GetCurrent().Add(tableView); + application.GetScene().Add(tableView); // Create the first actor Actor first = Actor::New(); @@ -1248,7 +1249,7 @@ int UtcDaliKeyboardFocusManagerSignalChangedBySpaceKeyEvent(void) PreFocusChangeCallback preFocusChangeCallback(preFocusChangeSignalVerified); manager.PreFocusChangeSignal().Connect( &preFocusChangeCallback, &PreFocusChangeCallback::Callback ); - Integration::KeyEvent spaceEvent( "space", "", "", 0, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); + Integration::KeyEvent spaceEvent( "space", "", "", 0, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); // Press Any key to notice physical keyboard event is comming to KeyboardFocusManager // It makes mIsFocusIndicatorEnabled true @@ -1302,12 +1303,12 @@ int UtcDaliKeyboardFocusManagerMoveFocusTestStateChange(void) // Create the first actor and add it to the stage Control first = Control::New(); first.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); - Stage::GetCurrent().Add(first); + application.GetScene().Add(first); // Create the second actor and add it to the stage Control second = Control::New(); second.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true); - Stage::GetCurrent().Add(second); + application.GetScene().Add(second); // Move the focus to the right DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == false); @@ -1361,7 +1362,7 @@ int UtcDaliKeyboardFocusManagerMoveFocusTestStateChange(void) // Create a 2x2 table view and try to move focus inside it TableView tableView = TableView::New( 2, 2 ); - Stage::GetCurrent().Add(tableView); + application.GetScene().Add(tableView); // Create the third actor Control third = Control::New(); @@ -1501,7 +1502,7 @@ int UtcDaliKeyboardFocusManagerFocusedActorUnstaged(void) DALI_TEST_CHECK( ! manager.GetCurrentFocusActor() ); tet_infoline( "Add actor to stage and attempt to set, our actor should be returned from KeyboardFocusManager" ); - Stage::GetCurrent().Add( actor ); + application.GetScene().Add( actor ); manager.SetCurrentFocusActor( actor ); DALI_TEST_CHECK( manager.GetCurrentFocusActor() == actor ); @@ -1523,12 +1524,12 @@ int UtcDaliKeyboardFocusManagerEnableFocusIndicator(void) Actor actor = Actor::New(); actor.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true ); - Stage::GetCurrent().Add( actor ); + application.GetScene().Add( actor ); manager.SetCurrentFocusActor( actor ); // Press Any key to notice physical keyboard event is comming to KeyboardFocusManager // It makes mIsFocusIndicatorEnabled true and add focus indicator to focused actor. - Integration::KeyEvent rightEvent( "Right", "", "", 0, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); + Integration::KeyEvent rightEvent( "Right", "", "", 0, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); application.ProcessEvent(rightEvent); Actor indicatorActor = manager.GetFocusIndicatorActor(); @@ -1570,7 +1571,7 @@ int UtcDaliKeyboardFocusManagerCheckConsumedKeyEvent(void) // Press Any key to notice physical keyboard event is comming to KeyboardFocusManager // It makes mIsFocusIndicatorEnabled true and add focus indicator to focused actor. - Integration::KeyEvent event1( "Right", "", "", 0, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); + Integration::KeyEvent event1( "Right", "", "", 0, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ); application.ProcessEvent(event1); DALI_TEST_CHECK( controlCallback.mIsCalled );