test(passworddialog): nine widget tests for the previously-untested API#1478
Conversation
PasswordDialog had decent setPassword/getPassword round-trip coverage in tst_ui.cpp but its other public API was largely untested. Fill the gap: - passwordDialogShowCheckboxTogglesEchoMode: the "Show password" checkbox flips QLineEdit::echoMode between Password and Normal. - passwordDialogSetLengthUpdatesSpinBox: setLength() writes through to the QSpinBox. - passwordDialogSetPasswordCharTemplateUpdatesCombo: setPasswordChar Template() selects the matching combo-box index. - passwordDialogUsePwgenDisablesTemplateSelector: usePwgen(true) greys out the in-app template selector + label (pwgen takes over); usePwgen(false) restores them. - passwordDialogSetPassPopulatesField: setPass() is a thin wrapper around setPassword(); first line lands in getPassword(). - passwordDialogSetAvailableTemplatesAppliesDefault: registering templates and naming a default triggers setTemplate() with that template's fields — visible as named QLineEdits in the form. - passwordDialogCycleTemplateAdvancesToNext: Ctrl+T equivalent moves to the next alphabetical template (creditcard -> login). - passwordDialogCycleTemplateWrapsToFirst: cycling past the last template wraps back (login -> creditcard). - passwordDialogCycleTemplateNoOpWhenEmpty: cycleTemplate() with no templates registered is a no-op; no template fields appear. Build clean, 55/55 ui tests pass (was 46, +9). Plus three include additions for the widgets newly addressed by findChild<T*>: QCheckBox, QComboBox, QHash, QLabel, QSpinBox. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis change expands the ChangesPasswordDialog UI Test Suite
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
`PasswordDialog` had decent `setPassword`/`getPassword` round-trip coverage in `tst_ui.cpp` (4 tests + the 2 named `passwordDialog*` ones) but its other public API was largely untested. This PR fills that gap.
Tests added
Each test instantiates a real PasswordDialog (no Pass-singleton required — the dialog is independent of QtPassSettings::getPass), drives an input, and asserts on observable widget state via `findChild<T*>`.
Test plan
Includes
Added `QCheckBox`, `QComboBox`, `QHash`, `QLabel`, `QSpinBox` to the test file's include block for the newly addressed widget types.
🤖 Generated with Claude Code
Summary by CodeRabbit