Repository navigation
feat: add accessible names for eye protection buttons - #470
Conversation
1. Set AccessibleName (eye_0..eye_3) on RoundColorWidget buttons in EyeProtectionAction so AT-SPI based UI automation can locate them. 2. objectName alone does not surface as the AT-SPI accessible name. 3. Stable locale-independent identifiers keep test selectors intact. Log: Improves UI automation testability; no change to eye protection behavior or visuals. Influence: 1. Verify eye protection mode switching from the main menu still works (classic/green/night/off). 2. Verify the buttons' tooltips remain unchanged. 3. Run the eye_care AT suite to confirm the buttons are locatable. feat: 补充护眼模式按钮的可访问名称 1. EyeProtectionAction 中为 RoundColorWidget 按钮设置 AccessibleName (eye_0..eye_3),供 AT-SPI 自动化定位。 2. 仅设置 objectName 不会进入 AT-SPI name。 3. 采用与语言无关的稳定标识,避免翻译变化破坏用例选择器。 Log: 提升自动化可测性;护眼模式行为与外观无变化。 Influence: 1. 验证主菜单中经典/绿色/夜间/无护眼切换功能正常。 2. 验证按钮 tooltip 文案不变。 3. 运行 eye_care AT 套件确认按钮可定位。 PMS: TASK-399111
Reviewer's GuideUIAssign stable accessible names to the eye-protection color buttons so AT-SPI automation can locate them without changing their behavior or tooltips.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="reader/eyeprotection/EyeProtectionAction.cpp" line_range="67" />
<code_context>
btn->setObjectName(QString("eye_%1").arg(i));
+ // AT 自动化依赖 AccessibleName 定位(objectName 不进入 AT-SPI name);
+ // 取与 objectName 一致的稳定标识,避免随语言/翻译变化破坏用例选择器
+ btn->setAccessibleName(QString("eye_%1").arg(i));
btn->setFixedSize(QSize(25, 25));
btn->setToolTip(QCoreApplication::translate("EyeProtection", s_modeNames[i]));
</code_context>
<issue_to_address>
**Screen readers announce machine IDs**
When a user navigates these controls with a screen reader, screen readers use the explicit accessible name instead of a meaningful mode label, so users hear identifiers such as “eye_0” rather than which eye-protection mode the color represents.
Use a localized, descriptive accessible name for each mode and expose the stable automation identifier through a separate selector mechanism.
</issue_to_address>| btn->setObjectName(QString("eye_%1").arg(i)); | ||
| // AT 自动化依赖 AccessibleName 定位(objectName 不进入 AT-SPI name); | ||
| // 取与 objectName 一致的稳定标识,避免随语言/翻译变化破坏用例选择器 | ||
| btn->setAccessibleName(QString("eye_%1").arg(i)); |
There was a problem hiding this comment.
🟡 Medium · Screen readers announce machine IDs
When a user navigates these controls with a screen reader, screen readers use the explicit accessible name instead of a meaningful mode label, so users hear identifiers such as “eye_0” rather than which eye-protection mode the color represents.
Use a localized, descriptive accessible name for each mode and expose the stable automation identifier through a separate selector mechanism.
Prompt for AI agents
In `reader/eyeprotection/EyeProtectionAction.cpp` at line 67:
**Screen readers announce machine IDs**
When a user navigates these controls with a screen reader, screen readers use the explicit accessible name instead of a meaningful mode label, so users hear identifiers such as “eye_0” rather than which eye-protection mode the color represents.
Use a localized, descriptive accessible name for each mode and expose the stable automation identifier through a separate selector mechanism.|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, pengfeixx The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
变更说明 / Changes
为护眼模式主菜单中的四个圆形色块按钮(RoundColorWidget)补充
setAccessibleName(eye_0~eye_3),供 AT-SPI 自动化测试定位。objectName不会进入 AT-SPI accessible name,自动化无法定位这些按钮objectName一致的稳定标识,不随语言/翻译变化,保证测试选择器稳定动机 / Motivation
V25 AT 用例库新增的护眼模式用例(2029057–2029083 共 14 条)需要对护眼按钮进行 GUI 自动化定位;当前构建中这些按钮对 AT-SPI 完全不可见,导致 eye_care 套件无法可靠执行。
关联 AT 用例仓库变更:app-test-v25 deepin-reader eye_care 套件(多平台任务 V-10048)。
PMS: TASK-399111
测试 / Test
Summary by Sourcery
New Features:
eye_0througheye_3) for the eye-protection color buttons so accessibility automation can locate them.