mirror of
https://gitee.com/openharmony/window_window_manager
synced 2025-03-04 05:37:27 +00:00
TDD整改
Signed-off-by: 张有康 <zhangyoukang1@h-partners.com>
This commit is contained in:
parent
c937825a33
commit
cfbb256f3d
@ -684,7 +684,7 @@ HWTEST_F(ScreenSceneConfigTest, GetCurvedCompressionAreaInLandscape03, Function
|
||||
HWTEST_F(ScreenSceneConfigTest, ReadStringListConfigInfo01, Function | SmallTest | Level3)
|
||||
{
|
||||
xmlNodePtr rootNode = nullptr;
|
||||
ScreenSceneConfig::ReadStringListConfigInfo(nullptr, "");
|
||||
ScreenSceneConfig::ReadStringListConfigInfo(rootNode, "");
|
||||
EXPECT_EQ(rootNode, nullptr);
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "display_manager_adapter.h"
|
||||
#include "display_manager_agent_default.h"
|
||||
#include "scene_board_judgement.h"
|
||||
#include "screen_session_manager/include/screen_session_manager.h"
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
@ -1179,16 +1180,10 @@ HWTEST_F(ScreenSessionManagerProxyTest, RemoveVirtualScreenFromGroup, Function |
|
||||
|
||||
sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
|
||||
sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
|
||||
|
||||
int resultValue = 0;
|
||||
std::vector<ScreenId> screens = {1002, 1003, 1004};
|
||||
std::function<void()> func = [&]()
|
||||
{
|
||||
screenSessionManagerProxy->RemoveVirtualScreenFromGroup(screens);
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
EXPECT_EQ(resultValue, 1);
|
||||
screenSessionManagerProxy->RemoveVirtualScreenFromGroup(screens);
|
||||
auto screenSession = ScreenSessionManager::GetInstance().GetScreenSession(2000);
|
||||
EXPECT_EQ(screenSession, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1594,16 +1589,10 @@ HWTEST_F(ScreenSessionManagerProxyTest, ConvertScreenIdToRsScreenId, Function |
|
||||
sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
|
||||
sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
|
||||
|
||||
int resultValue = 0;
|
||||
ScreenId screenId = 1001;
|
||||
ScreenId rsScreenId = 1002;
|
||||
std::function<void()> func = [&]()
|
||||
{
|
||||
screenSessionManagerProxy->ConvertScreenIdToRsScreenId(screenId, rsScreenId);
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
EXPECT_EQ(resultValue, 1);
|
||||
auto ret = screenSessionManagerProxy->ConvertScreenIdToRsScreenId(screenId, rsScreenId);
|
||||
EXPECT_EQ(ret, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1639,15 +1628,9 @@ HWTEST_F(ScreenSessionManagerProxyTest, DumpAllScreensInfo, Function | SmallTest
|
||||
sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
|
||||
sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
|
||||
|
||||
int resultValue = 0;
|
||||
std::string dumpInfo;
|
||||
std::function<void()> func = [&]()
|
||||
{
|
||||
screenSessionManagerProxy->DumpAllScreensInfo(dumpInfo);
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
EXPECT_EQ(resultValue, 1);
|
||||
screenSessionManagerProxy->DumpAllScreensInfo(dumpInfo);
|
||||
EXPECT_NE(dumpInfo, "");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1661,16 +1644,10 @@ HWTEST_F(ScreenSessionManagerProxyTest, DumpSpecialScreenInfo, Function | SmallT
|
||||
sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
|
||||
sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
|
||||
|
||||
int resultValue = 0;
|
||||
ScreenId id = 1001;
|
||||
std::string dumpInfo;
|
||||
std::function<void()> func = [&]()
|
||||
{
|
||||
screenSessionManagerProxy->DumpSpecialScreenInfo(id, dumpInfo);
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
EXPECT_EQ(resultValue, 1);
|
||||
screenSessionManagerProxy->DumpSpecialScreenInfo(id, dumpInfo);
|
||||
EXPECT_NE(dumpInfo, "");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1684,15 +1661,13 @@ HWTEST_F(ScreenSessionManagerProxyTest, SetFoldDisplayMode, Function | SmallTest
|
||||
sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
|
||||
sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
|
||||
|
||||
int resultValue = 0;
|
||||
const FoldDisplayMode displayMode {0};
|
||||
std::function<void()> func = [&]()
|
||||
{
|
||||
screenSessionManagerProxy->SetFoldDisplayMode(displayMode);
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
EXPECT_EQ(resultValue, 1);
|
||||
screenSessionManagerProxy->SetFoldDisplayMode(displayMode);
|
||||
if (screenSessionManagerProxy->IsFoldable()) {
|
||||
EXPECT_NE(ScreenSessionManager::GetInstance().foldScreenController_, nullptr);
|
||||
} else {
|
||||
EXPECT_EQ(ScreenSessionManager::GetInstance().foldScreenController_, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1728,15 +1703,13 @@ HWTEST_F(ScreenSessionManagerProxyTest, SetFoldStatusLocked, Function | SmallTes
|
||||
sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
|
||||
sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
|
||||
|
||||
int resultValue = 0;
|
||||
bool locked = true;
|
||||
std::function<void()> func = [&]()
|
||||
{
|
||||
screenSessionManagerProxy->SetFoldStatusLocked(locked);
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
EXPECT_EQ(resultValue, 1);
|
||||
screenSessionManagerProxy->SetFoldStatusLocked(locked);
|
||||
if (screenSessionManagerProxy->IsFoldable()) {
|
||||
EXPECT_NE(ScreenSessionManager::GetInstance().foldScreenController_, nullptr);
|
||||
} else {
|
||||
EXPECT_EQ(ScreenSessionManager::GetInstance().foldScreenController_, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1786,15 +1759,9 @@ HWTEST_F(ScreenSessionManagerProxyTest, IsFoldable, Function | SmallTest | Level
|
||||
SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
|
||||
sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
|
||||
sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
|
||||
|
||||
int resultValue = 0;
|
||||
std::function<void()> func = [&]()
|
||||
{
|
||||
screenSessionManagerProxy->IsFoldable();
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
EXPECT_EQ(resultValue, 1);
|
||||
screenSessionManagerProxy->IsFoldable();
|
||||
auto screenSession = ScreenSessionManager::GetInstance().GetScreenSession(2000);
|
||||
EXPECT_EQ(screenSession, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1807,15 +1774,8 @@ HWTEST_F(ScreenSessionManagerProxyTest, IsCaptured, Function | SmallTest | Level
|
||||
SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
|
||||
sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
|
||||
sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
|
||||
|
||||
int resultValue = 0;
|
||||
std::function<void()> func = [&]()
|
||||
{
|
||||
screenSessionManagerProxy->IsCaptured();
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
EXPECT_EQ(resultValue, 1);
|
||||
auto ret = screenSessionManagerProxy->IsCaptured();
|
||||
EXPECT_EQ(ret, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1895,15 +1855,9 @@ HWTEST_F(ScreenSessionManagerProxyTest, SetClient, Function | SmallTest | Level1
|
||||
sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
|
||||
sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
|
||||
|
||||
int resultValue = 0;
|
||||
const sptr<IScreenSessionManagerClient> client = nullptr;
|
||||
std::function<void()> func = [&]()
|
||||
{
|
||||
screenSessionManagerProxy->SetClient(client);
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
EXPECT_EQ(resultValue, 1);
|
||||
screenSessionManagerProxy->SetClient(client);
|
||||
EXPECT_EQ(client, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1916,15 +1870,9 @@ HWTEST_F(ScreenSessionManagerProxyTest, SwitchUser, Function | SmallTest | Level
|
||||
SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
|
||||
sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
|
||||
sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
|
||||
|
||||
int resultValue = 0;
|
||||
std::function<void()> func = [&]()
|
||||
{
|
||||
screenSessionManagerProxy->SwitchUser();
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
EXPECT_EQ(resultValue, 1);
|
||||
screenSessionManagerProxy->SwitchUser();
|
||||
auto screenSession = ScreenSessionManager::GetInstance().GetScreenSession(2000);
|
||||
EXPECT_EQ(screenSession, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1937,16 +1885,10 @@ HWTEST_F(ScreenSessionManagerProxyTest, GetScreenProperty, Function | SmallTest
|
||||
SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
|
||||
sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
|
||||
sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
|
||||
|
||||
int resultValue = 0;
|
||||
ScreenId screenId = 1001;
|
||||
std::function<void()> func = [&]()
|
||||
{
|
||||
screenSessionManagerProxy->GetScreenProperty(screenId);
|
||||
resultValue = 1;
|
||||
};
|
||||
func();
|
||||
EXPECT_EQ(resultValue, 1);
|
||||
screenSessionManagerProxy->GetScreenProperty(screenId);
|
||||
auto screenSession = ScreenSessionManager::GetInstance().GetScreenSession(2000);
|
||||
EXPECT_EQ(screenSession, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -215,9 +215,8 @@ HWTEST_F(ScreenSnapshotPickerConnectionTest, GetScreenSnapshotInfo03, Function |
|
||||
*/
|
||||
HWTEST_F(ScreenSnapshotPickerConnectionTest, SnapshotPickerDisconnectExtension01, Function | SmallTest | Level1)
|
||||
{
|
||||
std::unique_ptr<ScreenSessionAbilityConnection> abilityConnection_ = nullptr;
|
||||
ScreenSnapshotPickerConnection::GetInstance().SnapshotPickerDisconnectExtension();
|
||||
EXPECT_EQ(abilityConnection_, nullptr);
|
||||
EXPECT_EQ(ScreenSnapshotPickerConnection::GetInstance().abilityConnection_, nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "session_manager.h"
|
||||
#include "session_display_power_controller.h"
|
||||
#include "zidl/window_manager_agent_interface.h"
|
||||
#include "screen_session_manager/include/screen_session_manager.h"
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
@ -166,11 +167,8 @@ HWTEST_F(SessionDisplayPowerControllerTest, SuspendBegin, Function | SmallTest |
|
||||
HWTEST_F(SessionDisplayPowerControllerTest, WaitScreenOffNotify, Function | SmallTest | Level1)
|
||||
{
|
||||
DisplayState state = DisplayState::ON_SUSPEND;
|
||||
SessionDisplayPowerController controller([](DisplayId id, sptr<DisplayInfo> info, const std::map<DisplayId,
|
||||
sptr<DisplayInfo>>& infos, DisplayStateChangeType type) {
|
||||
EXPECT_TRUE(true);
|
||||
});
|
||||
EXPECT_EQ(state, DisplayState::ON_SUSPEND);
|
||||
ScreenSessionManager::GetInstance().sessionDisplayPowerController_->WaitScreenOffNotify(state);
|
||||
EXPECT_NE(state, DisplayState::UNKNOWN);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user