From 33c332cd458af833de480da709bbab4a9683b505 Mon Sep 17 00:00:00 2001 From: yanghongwei Date: Thu, 29 Apr 2021 14:54:31 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E6=B5=8B=E8=AF=95MainWindow=E7=9A=84pa?= =?UTF-8?q?nelGeometryChanged?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 测试MainWindow的panelGeometryChanged Log: 添加单元测试 Change-Id: I6481b3436d13a5a9c3ccf62d4430a8ed83a37a08 --- tests/window/ut_mainwindow.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/window/ut_mainwindow.cpp b/tests/window/ut_mainwindow.cpp index 9651bc0b0..7aed6dc8b 100644 --- a/tests/window/ut_mainwindow.cpp +++ b/tests/window/ut_mainwindow.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include @@ -82,4 +83,11 @@ TEST_F(Test_MainWindow, coverage_test) qApp->sendEvent(m_window->m_dragWidget, &dragLeaveEvent); QTest::qWait(10); ASSERT_EQ(QApplication::overrideCursor()->shape(), Qt::ArrowCursor); + + // 测试窗口大小变化时是否发出panelGeometryChanged信号 + QEvent resizeEvent(QEvent::Resize); + QSignalSpy signal(m_window, &MainWindow::panelGeometryChanged); + qApp->sendEvent(m_window, &resizeEvent); + QTest::qWait(10); + ASSERT_EQ(signal.count(), 1); }