DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::RIGHT);
+ // Clear the focus again
+ manager.ClearFocus();
+
+ // Send the up event for line coverage, but nothing was focued so focus manager will try the initial focus
+ preFocusChangeCallback.Reset();
+ application.ProcessEvent(upEvent);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+ DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
+
+ // Clear the focus again
+ manager.ClearFocus();
+
+ // Send the down event for line coverage, but nothing was focued so focus manager will try the initial focus
+ preFocusChangeCallback.Reset();
+ application.ProcessEvent(downEvent);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+ DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
+
END_TEST;
}
+int UtcDaliKeyboardFocusManagerSignalChangedBySpaceKeyEvent(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerSignalChangedBySpaceKeyEvent");
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ bool preFocusChangeSignalVerified = false;
+ 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 );
+
+ // Press Any key to notice physical keyboard event is comming to KeyboardFocusManager
+ // It makes mIsFocusIndicatorEnabled true
+ application.ProcessEvent(spaceEvent);
+
+ // Send the space event
+ application.ProcessEvent(spaceEvent);
+ DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+ DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == Actor());
+
+ // Clear the focus again
+ manager.ClearFocus();
+
+ // Send the space event again for line coverage
+ preFocusChangeCallback.Reset();
+ application.ProcessEvent(spaceEvent);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+ DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
+ END_TEST;
+}
mFocusedActorEnterKeySignal(),
mCurrentFocusActor(),
mFocusIndicatorActor(),
- mIsFocusIndicatorEnabled( -1 ),
+ mIsFocusIndicatorShown( -1 ),
mFocusGroupLoopEnabled( false ),
mIsWaitingKeyboardFocusChangeCommit( false ),
mClearFocusOnTouch( true ),
mEnableFocusIndicator( true ),
+ mAlwaysShowIndicator( true ),
mFocusHistory(),
mSlotDelegate( this ),
mCustomAlgorithmInterface(NULL)
{
- // TODO: Get FocusIndicatorEnable constant from stylesheet to set mIsFocusIndicatorEnabled.
+ // TODO: Get FocusIndicatorEnable constant from stylesheet to set mIsFocusIndicatorShown.
Stage::GetCurrent().KeyEventSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnKeyEvent);
Stage::GetCurrent().TouchSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnTouch );
}
if( styleManager )
{
Property::Map config = Toolkit::DevelStyleManager::GetConfigurations( styleManager );
- mIsFocusIndicatorEnabled = static_cast<int>(config["alwaysShowFocus"].Get<bool>());
- mClearFocusOnTouch = mIsFocusIndicatorEnabled ? false : true;
+ mAlwaysShowIndicator = config["alwaysShowFocus"].Get<bool>();
+ mIsFocusIndicatorShown = static_cast<int>(mAlwaysShowIndicator);
+ mClearFocusOnTouch = mIsFocusIndicatorShown ? false : true;
}
}
{
DALI_ASSERT_DEBUG( !mIsWaitingKeyboardFocusChangeCommit && "Calling this function in the PreFocusChangeSignal callback?" );
- if( mIsFocusIndicatorEnabled == -1 )
+ if( mIsFocusIndicatorShown == -1 )
{
GetConfigurationFromStyleManger();
}
// Check whether the actor is in the stage and is keyboard focusable.
if( actor && actor.IsKeyboardFocusable() && actor.OnStage() )
{
- if( mIsFocusIndicatorEnabled && mEnableFocusIndicator )
+ if( mIsFocusIndicatorShown && mEnableFocusIndicator )
{
actor.Add( GetFocusIndicatorActor() );
}
}
mCurrentFocusActor.Reset();
- mIsFocusIndicatorEnabled = 0;
+ mIsFocusIndicatorShown = static_cast<int>(mAlwaysShowIndicator);
}
void KeyboardFocusManager::SetFocusGroupLoop(bool enabled)
std::string keyName = event.keyPressedName;
- if( mIsFocusIndicatorEnabled == -1 )
+ if( mIsFocusIndicatorShown == -1 )
{
GetConfigurationFromStyleManger();
}
{
if(!isAccessibilityEnabled)
{
- if(!mIsFocusIndicatorEnabled)
+ if(!mIsFocusIndicatorShown)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = 1;
+ mIsFocusIndicatorShown = 1;
}
else
{
{
if(!isAccessibilityEnabled)
{
- if(!mIsFocusIndicatorEnabled)
+ if(!mIsFocusIndicatorShown)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = 1;
+ mIsFocusIndicatorShown = 1;
}
else
{
}
else if (keyName == "Up" && !isAccessibilityEnabled)
{
- if(!mIsFocusIndicatorEnabled)
+ if(!mIsFocusIndicatorShown)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = 1;
+ mIsFocusIndicatorShown = 1;
}
else
{
}
else if (keyName == "Down" && !isAccessibilityEnabled)
{
- if(!mIsFocusIndicatorEnabled)
+ if(!mIsFocusIndicatorShown)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = 1;
+ mIsFocusIndicatorShown = 1;
}
else
{
}
else if (keyName == "Prior" && !isAccessibilityEnabled)
{
- if(!mIsFocusIndicatorEnabled)
+ if(!mIsFocusIndicatorShown)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = 1;
+ mIsFocusIndicatorShown = 1;
}
else
{
}
else if (keyName == "Next" && !isAccessibilityEnabled)
{
- if(!mIsFocusIndicatorEnabled)
+ if(!mIsFocusIndicatorShown)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = 1;
+ mIsFocusIndicatorShown = 1;
}
else
{
}
else if (keyName == "Tab" && !isAccessibilityEnabled)
{
- if(!mIsFocusIndicatorEnabled)
+ if(!mIsFocusIndicatorShown)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = 1;
+ mIsFocusIndicatorShown = 1;
}
else
{
}
else if (keyName == "space" && !isAccessibilityEnabled)
{
- if(!mIsFocusIndicatorEnabled)
+ if(!mIsFocusIndicatorShown)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = 1;
+ mIsFocusIndicatorShown = 1;
}
isFocusStartableKey = true;
else if (keyName == "" && !isAccessibilityEnabled)
{
// Check the fake key event for evas-plugin case
- if(!mIsFocusIndicatorEnabled)
+ if(!mIsFocusIndicatorShown)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = 1;
+ mIsFocusIndicatorShown = 1;
}
isFocusStartableKey = true;
{
if (keyName == "Return")
{
- if(!mIsFocusIndicatorEnabled && !isAccessibilityEnabled)
+ if(!mIsFocusIndicatorShown && !isAccessibilityEnabled)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = 1;
+ mIsFocusIndicatorShown = 1;
}
else
{
}
}
- if(isFocusStartableKey && mIsFocusIndicatorEnabled && !isAccessibilityEnabled)
+ if(isFocusStartableKey && mIsFocusIndicatorShown && !isAccessibilityEnabled)
{
Actor actor = GetCurrentFocusActor();
if( actor )
void KeyboardFocusManager::OnTouch(const TouchData& touch)
{
- // if mIsFocusIndicatorEnabled is -1, it means Configuration is not loaded.
+ // if mIsFocusIndicatorShown is -1, it means Configuration is not loaded.
// Try to load configuration.
- if( mIsFocusIndicatorEnabled == -1 )
+ if( mIsFocusIndicatorShown == -1 )
{
GetConfigurationFromStyleManger();
}