!7944 【Fix】修复TDD异常处理

Merge pull request !7944 from 张凯/add_nullcheck
This commit is contained in:
openharmony_ci 2024-08-08 04:21:00 +00:00 committed by Gitee
commit be35c2916c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
8 changed files with 17 additions and 2 deletions

View File

@ -155,7 +155,7 @@ HWTEST_F(WindowFocusTest, FocusChangedTest01, Function | MediumTest | Level3)
subAppInfo_.rect = { 400, 200, 100, 100 };
subAppInfo_.parentId = window3->GetWindowId();
const sptr<Window>& subWindow = Utils::CreateTestWindow(subAppInfo_);
ASSERT_NE(nullptr, subWindow);
ASSERT_EQ(WMError::WM_OK, window3->Show());
// Await 100ms and get callback result in listener.
usleep(WAIT_ASYNC_US);

View File

@ -283,6 +283,7 @@ HWTEST_F(WindowImmersiveTest, ImmersiveTest02, Function | MediumTest | Level3)
SetWindowSystemProps(window1, TEST_PROPS_1);
fullScreenAppinfo_.name = "Immer02";
const sptr<Window>& window2 = Utils::CreateTestWindow(fullScreenAppinfo_);
ASSERT_NE(nullptr, window2);
activeWindows_.push_back(window2);
SetWindowSystemProps(window2, TEST_PROPS_2);
ASSERT_EQ(WMError::WM_OK, window1->Show());
@ -311,6 +312,7 @@ HWTEST_F(WindowImmersiveTest, ImmersiveTest03, Function | MediumTest | Level3)
fullScreenAppinfo_.name = "Immer03";
fullScreenAppinfo_.needAvoid = true; // no immersive setting
const sptr<Window>& window2 = Utils::CreateTestWindow(fullScreenAppinfo_);
ASSERT_NE(nullptr, window2);
activeWindows_.push_back(window2);
SetWindowSystemProps(window2, TEST_PROPS_2);
ASSERT_EQ(WMError::WM_OK, window1->Show());

View File

@ -485,6 +485,7 @@ HWTEST_F(WindowLayoutTest, LayoutTile01, Function | MediumTest | Level3)
info.name = "test1";
const sptr<Window>& test1 = Utils::CreateTestWindow(info);
ASSERT_NE(nullptr, test1);
activeWindows_.push_back(test1);
ASSERT_EQ(WMError::WM_OK, test1->Show());
usleep(WAIT_SYANC_US);
@ -498,6 +499,7 @@ HWTEST_F(WindowLayoutTest, LayoutTile01, Function | MediumTest | Level3)
info.name = "test2";
const sptr<Window>& test2 = Utils::CreateTestWindow(info);
ASSERT_NE(nullptr, test2);
activeWindows_.push_back(test2);
ASSERT_EQ(WMError::WM_OK, test2->Show());
usleep(WAIT_SYANC_US);
@ -546,6 +548,7 @@ HWTEST_F(WindowLayoutTest, LayoutTileNegative01, Function | MediumTest | Level3)
info.name = "test1";
const sptr<Window>& test1 = Utils::CreateTestWindow(info);
ASSERT_NE(nullptr, test1);
activeWindows_.push_back(test1);
ASSERT_EQ(WMError::WM_OK, test1->Show());
usleep(WAIT_SYANC_US);
@ -559,6 +562,7 @@ HWTEST_F(WindowLayoutTest, LayoutTileNegative01, Function | MediumTest | Level3)
info.name = "test2";
const sptr<Window>& test2 = Utils::CreateTestWindow(info);
ASSERT_NE(nullptr, test2);
activeWindows_.push_back(test2);
ASSERT_EQ(WMError::WM_OK, test2->Show());
usleep(WAIT_SYANC_US);

View File

@ -183,6 +183,7 @@ HWTEST_F(WindowModeSupportInfoTest, WindowModeSupportInfo05, Function | MediumTe
}
window1->SetRequestModeSupportInfo(WindowModeSupport::WINDOW_MODE_SUPPORT_FULLSCREEN);
const sptr<Window>& window2 = Utils::CreateTestWindow(fullAppInfo_2_);
ASSERT_NE(nullptr, window2);
window2->SetRequestModeSupportInfo(WindowModeSupport::WINDOW_MODE_SUPPORT_ALL);
ASSERT_EQ(WMError::WM_OK, window1->Show());
ASSERT_EQ(WMError::WM_OK, window2->Show());

View File

@ -106,6 +106,7 @@ HWTEST_F(WindowSplitImmersiveTest, SplitImmersive01, Function | MediumTest | Lev
// enter split mode
splitInfo_.mode = WindowMode::WINDOW_MODE_SPLIT_PRIMARY;
const sptr<Window>& priWindow = Utils::CreateTestWindow(splitInfo_);
ASSERT_NE(nullptr, priWindow);
activeWindows_.push_back(priWindow);
ASSERT_EQ(WMError::WM_OK, priWindow->Show());
sleep(SPLIT_TEST_SLEEP_S);

View File

@ -145,6 +145,7 @@ HWTEST_F(WindowSplitTest, SplitWindow02, Function | MediumTest | Level3)
sleep(SPLIT_TEST_SLEEP_S);
const sptr<Window>& secWindow = Utils::CreateTestWindow(splitInfo_);
ASSERT_NE(nullptr, secWindow);
activeWindows_.push_back(secWindow);
secWindow->SetWindowMode(WindowMode::WINDOW_MODE_SPLIT_SECONDARY);
sleep(SPLIT_TEST_SLEEP_S);
@ -182,6 +183,7 @@ HWTEST_F(WindowSplitTest, SplitScreen03, Function | MediumTest | Level3)
ASSERT_EQ(WMError::WM_OK, fullWindow->Show());
sleep(SPLIT_TEST_SLEEP_S);
const sptr<Window>& priWindow = Utils::CreateTestWindow(splitInfo_);
ASSERT_NE(nullptr, priWindow);
activeWindows_.push_back(priWindow);
ASSERT_EQ(WMError::WM_OK, priWindow->Show());
sleep(SPLIT_TEST_SLEEP_S);
@ -217,6 +219,7 @@ HWTEST_F(WindowSplitTest, SplitScreen04, Function | MediumTest | Level3)
ASSERT_EQ(WMError::WM_OK, fullWindow->Show());
sleep(SPLIT_TEST_SLEEP_S);
const sptr<Window>& secWindow = Utils::CreateTestWindow(splitInfo_);
ASSERT_NE(nullptr, secWindow);
activeWindows_.push_back(secWindow);
ASSERT_EQ(WMError::WM_OK, secWindow->Show());
sleep(SPLIT_TEST_SLEEP_S);

View File

@ -137,6 +137,7 @@ HWTEST_F(WindowTouchOutsideTest, onTouchOutside, Function | MediumTest | Level3)
}
firstWindow->RegisterTouchOutsideListener(windowlistener1_);
const sptr<Window> &secondWindow = Utils::CreateTestWindow(secondWindowInfo_);
ASSERT_NE(nullptr, secondWindow);
firstWindow->Show();
secondWindow->Show();
SingletonContainer::Get<WindowAdapter>().ProcessPointDown(secondWindow->GetWindowId());
@ -159,6 +160,7 @@ HWTEST_F(WindowTouchOutsideTest, onTouchOutsideNotShow, Function | MediumTest |
}
firstWindow->RegisterTouchOutsideListener(windowlistener1_);
const sptr<Window> &secondWindow = Utils::CreateTestWindow(secondWindowInfo_);
ASSERT_NE(nullptr, secondWindow);
secondWindow->Show();
SingletonContainer::Get<WindowAdapter>().ProcessPointDown(secondWindow->GetWindowId());
usleep(WAIT_CALLBACK_US);
@ -180,12 +182,14 @@ HWTEST_F(WindowTouchOutsideTest, onTouchOutsideForAllWindow, Function | MediumTe
}
firstWindow->RegisterTouchOutsideListener(windowlistener1_);
const sptr<Window> &secondWindow = Utils::CreateTestWindow(secondWindowInfo_);
ASSERT_NE(nullptr, secondWindow);
firstWindow->RegisterTouchOutsideListener(windowlistener2_);
firstWindow->Show();
secondWindow->Show();
const sptr<Window> &thirdWindow = Utils::CreateTestWindow(thirdWindowInfo_);
ASSERT_NE(nullptr, thirdWindow);
thirdWindow->Show();
SingletonContainer::Get<WindowAdapter>().ProcessPointDown(thirdWindow->GetWindowId());
usleep(WAIT_CALLBACK_US);

View File

@ -202,7 +202,7 @@ HWTEST_F(WindowVisibilityInfoTest, WindowVisibilityInfoTest01, Function | Medium
subAppInfo_.rect = {0, 600, 300, 100};
subAppInfo_.parentId = window1->GetWindowId();
sptr<Window> subWindow1 = Utils::CreateTestWindow(subAppInfo_);
ASSERT_NE(nullptr, subWindow1);
bool isWindowVisible = false;
bool isSubWindowVisible = false;