From be1d4aea36f474d65505e575ab84e40990f0963a Mon Sep 17 00:00:00 2001 From: zhangkun Date: Fri, 29 May 2026 11:29:57 +0800 Subject: [PATCH] fix(notification): expand screen lock init condition for unit tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Added fallback condition to call initScreenLockedState() when platform name is non-empty, ensuring the function runs on Wayland as well 2. Previously skipped on Wayland only; now also handles empty platform name case that occurs in unit test environments 3. Marks intention for subsequent migration to the login1 interface Log: Expand screen lock initialization condition to work in unit test and Wayland environments fix(notification): 扩展屏幕锁定初始化条件以支持单元测试 1. 新增 platformName 非空时的回退条件,确保在 Wayland 上也能调用 initScreenLockedState() 2. 原先仅在 Wayland 时跳过;现在同时处理单元测试环境中 platformName 为空的情况 3. 标注了后续迁移至 login1 接口的意图 Log: 扩展屏幕锁定初始化条件,兼容单元测试和 Wayland 环境 --- panels/notification/server/notificationmanager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/panels/notification/server/notificationmanager.cpp b/panels/notification/server/notificationmanager.cpp index a02efa10a..b8f565c90 100644 --- a/panels/notification/server/notificationmanager.cpp +++ b/panels/notification/server/notificationmanager.cpp @@ -81,7 +81,8 @@ NotificationManager::NotificationManager(QObject *parent) if(!config->value("notificationCleanupDays").isNull()) { m_cleanupDays = config->value("notificationCleanupDays").toInt(); } - if (QStringLiteral("wayland") != QGuiApplication::platformName()) { + if (QStringLiteral("wayland") != QGuiApplication::platformName() + && !QGuiApplication::platformName().isEmpty()) { // for unit test, Subsequent migration to the login1 interface initScreenLockedState(); } }