!12350 【fix】 测试用例review意见整改

Merge pull request !12350 from 张凯/fix_useSharedPointer
This commit is contained in:
openharmony_ci 2025-01-24 10:56:42 +00:00 committed by Gitee
commit beb5c33c5c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -540,17 +540,21 @@ HWTEST_F(SceneSessionManagerTest12, DestroyAndDetachCallback, Function | SmallTe
*/
HWTEST_F(SceneSessionManagerTest12, IsKeyboardForeground, Function | SmallTest | Level3)
{
SceneSessionManager* sceneSessionManager = sptr<SceneSessionManager>::MakeSptr();
ASSERT_NE(sceneSessionManager, nullptr);
auto sceneSessionManager = sptr<SceneSessionManager>::MakeSptr();
SessionInfo info;
info.abilityName_ = "test1";
info.bundleName_ = "test2";
sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
ASSERT_NE(property, nullptr);
property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
sceneSessionManager->IsKeyboardForeground();
property->SetWindowType(WindowType::WINDOW_TYPE_SYSTEM_ALARM_WINDOW);
sceneSessionManager->IsKeyboardForeground();
sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
sceneSession->property_ = sptr<WindowSessionProperty>::MakeSptr();
sceneSessionManager->sceneSessionMap_.insert({sceneSession->GetPersistentId(), sceneSession});
sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
sceneSession->state_ = SessionState::STATE_FOREGROUND;
ASSERT_EQ(true, sceneSessionManager->IsKeyboardForeground());
sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_SYSTEM_ALARM_WINDOW);
ASSERT_EQ(false, sceneSessionManager->IsKeyboardForeground());
sceneSessionManager->sceneSessionMap_.clear();
ASSERT_EQ(false, sceneSessionManager->IsKeyboardForeground());
}
/**