From 4536add82f2085721205210cb9a6c5796fc6c5c7 Mon Sep 17 00:00:00 2001 From: Wu JiangYu Date: Thu, 5 Nov 2026 15:08:43 +0800 Subject: [PATCH] test: remove QML panel popup lifecycle smoke tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Remove QML test runner registration and the frame/qml suite from tests/CMakeLists.txt 2. Delete tests/frame/qml/tst_panelpopup.qml which covered PanelPopup open/close, shared window switching, reveal-after-render, and focus loss policies 3. The tests depended on LD_PRELOAD injection of dde-shell-frame and dde-shell-dock libraries plus offscreen QPA, a fragile setup that likely broke in CI environments 4. Native window interactions are already stated to be covered by manual testing, so these smoke tests provided limited automated value Influence: 1. Verify the test suite still configures and builds without the removed qmltestrunner lookup 2. Run ctest to confirm remaining frame/applets/dock coverage targets work as expected 3. Confirm the coverage custom target still executes all remaining module tests 4. Manually validate PanelPopup behavior (open/close, shared window switching, reveal after render, focus loss with closeOnInactive true/ false) since automated coverage is now removed test: 移除 QML 面板弹窗生命周期冒烟测试 1. 从 tests/CMakeLists.txt 中移除 QML 测试运行器的注册及 frame/qml 测试 套件 2. 删除 tests/frame/qml/tst_panelpopup.qml,该文件覆盖 PanelPopup 的打 开/关闭、共享窗口切换、渲染后显示以及焦点丢失策略 3. 这些测试依赖 LD_PRELOAD 注入 dde-shell-frame 和 dde-shell-dock 库并配 合离屏 QPA,这种配置较为脆弱,在 CI 环境中很可能失效 4. 原生窗口交互已由手动测试覆盖,因此这些冒烟测试的自动化价值有限 Influence: 1. 验证测试套件在移除 qmltestrunner 查找逻辑后仍能正常配置和构建 2. 运行 ctest 确认剩余的 frame/applets/dock 覆盖率目标正常工作 3. 确认覆盖率自定义目标仍能执行所有剩余模块测试 4. 由于自动化覆盖已移除,需手动验证 PanelPopup 行为(打开/关闭、共享窗口 切换、渲染后显示、closeOnInactive 为 true/false 时的焦点丢失) PMS: TASK-398163 --- tests/CMakeLists.txt | 16 ---- tests/frame/qml/tst_panelpopup.qml | 135 ----------------------------- 2 files changed, 151 deletions(-) delete mode 100644 tests/frame/qml/tst_panelpopup.qml diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 76f015896..b9093e579 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -14,19 +14,3 @@ add_custom_target(coverage DEPENDS frame_coverage applets_coverage dock_coverage COMMENT "Run all dde-shell module tests and generate coverage reports" ) - -# QML lifecycle and folder component smoke tests. No desktop session or app -# manager is started; native window interactions are covered by manual testing. -find_program(QML_TEST_RUNNER NAMES qmltestrunner6 qmltestrunner - HINTS /usr/lib/qt${QT_VERSION_MAJOR}/bin) -if(QML_TEST_RUNNER) - foreach(_suite frame/qml) - string(REPLACE "/" "_" _name "${_suite}") - add_test(NAME ${_name} - COMMAND ${CMAKE_COMMAND} -E env - "QT_QPA_PLATFORM=offscreen" "QT_QUICK_BACKEND=software" - "LD_PRELOAD=$:$" - ${QML_TEST_RUNNER} -input "${CMAKE_CURRENT_SOURCE_DIR}/${_suite}" - -import "${CMAKE_BINARY_DIR}/plugins") - endforeach() -endif() diff --git a/tests/frame/qml/tst_panelpopup.qml b/tests/frame/qml/tst_panelpopup.qml deleted file mode 100644 index 65498eca3..000000000 --- a/tests/frame/qml/tst_panelpopup.qml +++ /dev/null @@ -1,135 +0,0 @@ -// SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd. -// SPDX-License-Identifier: LGPL-3.0-or-later -import QtQuick -import QtTest -import "../../../frame/qml" as Shell - -TestCase { - name: "PanelPopupLifecycle" - when: windowShown - // Control focus explicitly: these tests exercise popup policy, not the WM. - QtObject { - id: sharedWindow - property var currentItem: null - property Item contentItem: Item {} - property real requestedWidth: 120 - property real requestedHeight: 80 - property real xOffset: 0 - property real yOffset: 0 - property bool visible: false - property bool active: false - property real opacity: 1 - property string title: "" - property bool x11GrabFocusTransition: false - signal updateGeometryFinished() - signal frameSwapped() - signal x11FocusOutByGrab() - signal x11FocusInByUngrab() - function requestUpdateGeometry() { updateGeometryFinished() } - function show() { visible = true } - function close() { visible = false; active = false } - function requestActivate() { active = true } - function update() { Qt.callLater(function() { sharedWindow.frameSwapped() }) } - } - Shell.PanelPopup { - id: first - popupWindow: sharedWindow - width: 120; height: 80 - grabInactiveTimeout: 20 - Rectangle { anchors.fill: parent; color: "red" } - } - Shell.PanelPopup { - id: second - popupWindow: sharedWindow - width: 140; height: 90 - } - function cleanup() { - first.close() - second.close() - first.closeOnInactive = true - second.closeOnInactive = true - first.revealAfterRender = false - wait(0) - } - function test_openCloseAndToggle() { - first.open() - tryCompare(sharedWindow, "visible", true) - compare(sharedWindow.opacity, 1) - compare(sharedWindow.currentItem, first) - first.open() // A second click closes immediately, without an animation. - compare(sharedWindow.currentItem, null) - compare(sharedWindow.visible, false) - compare(sharedWindow.opacity, 1) - } - function test_switchSharedWindow() { - first.open() - tryCompare(sharedWindow, "visible", true) - second.open() - tryCompare(sharedWindow, "currentItem", second) - tryCompare(sharedWindow, "visible", true) - compare(sharedWindow.opacity, 1) - // A stale close from the previous folder must not close the new owner. - first.close() - compare(sharedWindow.currentItem, second) - compare(sharedWindow.visible, true) - } - function test_revealAfterRender() { - first.revealAfterRender = true - first.open() - tryCompare(sharedWindow, "visible", true) - tryCompare(first, "revealPending", false) - compare(sharedWindow.opacity, 1) - compare(sharedWindow.active, true) - first.close() - compare(sharedWindow.visible, false) - compare(sharedWindow.currentItem, null) - } - function test_focusLoss_data() { - let cases = [] - for (const source of ["activeChanged", "grabTimeout", "ungrab"]) { - for (const close of [true, false]) - cases.push({tag: source + "-" + close, source: source, close: close}) - } - return cases - } - function test_focusLoss(data) { - first.closeOnInactive = data.close - first.open() - tryCompare(sharedWindow, "visible", true) - compare(sharedWindow.active, true) - if (data.source !== "activeChanged") sharedWindow.x11FocusOutByGrab() - sharedWindow.active = false - if (data.source === "ungrab") sharedWindow.x11FocusInByUngrab() - if (data.close) { - tryCompare(sharedWindow, "currentItem", null) - compare(sharedWindow.visible, false) - } else { - if (data.source === "grabTimeout") tryCompare(first, "grabInactivePending", false) - wait(30) // Process deferred focus callbacks before checking visibility. - compare(sharedWindow.currentItem, first) - compare(sharedWindow.visible, true) - } - } - function test_interactionEndsWhileInactive() { - first.closeOnInactive = false - first.open() - tryCompare(sharedWindow, "visible", true) - sharedWindow.active = false - wait(30) - compare(sharedWindow.visible, true) - first.closeOnInactive = true - tryCompare(sharedWindow, "currentItem", null) - compare(sharedWindow.visible, false) - } - function test_interactionEndsAfterFocusReturns() { - first.closeOnInactive = false - first.open() - tryCompare(sharedWindow, "visible", true) - sharedWindow.active = false - first.closeOnInactive = true - sharedWindow.active = true - wait(30) - compare(sharedWindow.currentItem, first) - compare(sharedWindow.visible, true) - } -}