Skip to content

test: expand configdialog and keygendialog test suites#1501

Merged
annejan merged 4 commits into
mainfrom
test/configdialog-keygendialog-tests
May 17, 2026
Merged

test: expand configdialog and keygendialog test suites#1501
annejan merged 4 commits into
mainfrom
test/configdialog-keygendialog-tests

Conversation

@nogeenharrie
Copy link
Copy Markdown
Contributor

@nogeenharrie nogeenharrie commented May 17, 2026

Summary

  • tst_configdialog: 9 → 14 tests — covers the remaining public useX API: useTrayIcon (skips on headless), useQrencode, setPwgenPath (path value + empty disables checkbox), and setPasswordConfiguration/getPasswordConfiguration round-trip
  • tst_keygendialog: 6 → 10 tests — adds empty-passphrase no-protection mode path, second-passphrase change triggering button-box state update, clearing first passphrase disabling button-box, and simultaneous name+email template update

Test plan

  • make check passes locally — configdialog 15/15 (1 expected SKIP for no-system-tray), keygendialog 12/12
  • No source files modified — tests only

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Expanded configuration dialog widget tests covering tray icon and QR toggles, pwgen path behavior (line edit population, disabling the pwgen option) and password-configuration round-trip.
    • Enhanced GPG key parsing tests for empty input, missing user info, ignored orphan subkeys, and skipping malformed lines.
    • Added key-generation dialog tests for passphrase interactions and name/email template updates.
    • Improved store-model tests for store path updates, .gpg preservation, and filter behavior.

Review Change Stack

nogeenharrie and others added 2 commits May 17, 2026 01:30
gpgkeystate: 23 → 27 tests — adds edge cases not previously covered:
empty input returns an empty list; pub record without any uid record
is still included; orphan sub/ssb records without a pub parent are
ignored; short colon-separated lines (fewer than GPG_MIN_FIELDS) are
silently skipped.

storemodel: 31 → 34 tests — adds:
setStore() updates the value returned by getStore(); data() with
Qt::EditRole does not strip the .gpg suffix (only DisplayRole does);
a non-.gpg file whose name matches the regex filter is accepted by
filterAcceptsRow (documents that the model does not restrict to .gpg
only at the filter layer).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- tst_configdialog: 9 → 14 tests — adds coverage for useTrayIcon
  (skipped if no tray), useQrencode, setPwgenPath (value + empty-
  disables-checkbox), and setPasswordConfiguration/getPasswordConfiguration
  round-trip
- tst_keygendialog: 6 → 10 tests — adds empty-passphrase no-protection
  path, second-passphrase change triggering state update, clearing
  first passphrase disabling buttonBox, and simultaneous name+email
  template update

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 312434b7-7951-4f1b-bb5b-a6798d5429b9

📥 Commits

Reviewing files that changed from the base of the PR and between 513bde3 and 6906c0e.

📒 Files selected for processing (1)
  • tests/auto/model/tst_storemodel.cpp

📝 Walkthrough

Walkthrough

Adds 15 Qt test slots across four test suites: ConfigDialog UI/state and PasswordConfiguration round-trip tests; GpgKeyState parseGpgColonOutput edge-case tests; KeygenDialog passphrase and template tests; and StoreModel setter/data/filter tests. No production code changed.

Changes

Test Coverage Expansion

Layer / File(s) Summary
ConfigDialog UI state and configuration tests
tests/auto/configdialog/tst_configdialog.cpp
Adds Qt includes (QSpinBox, QSystemTrayIcon) and PasswordConfiguration header; introduces five tests for tray icon toggle (skipped if unavailable), qrencode toggle, pwgen path line edit behavior, empty pwgen path disabling checkBoxUsePwgen, and PasswordConfiguration set/get round-trip.
GpgKeyState parsing edge-case tests
tests/auto/gpgkeystate/tst_gpgkeystate.cpp
Adds four tests for parseGpgColonOutput: empty input returns empty list, pub without uid yields a UserInfo using pub fields, orphan sub/ssb records are ignored, and malformed short lines are skipped.
KeygenDialog passphrase and template tests
tests/auto/keygendialog/tst_keygendialog.cpp
Adds four tests validating passphrase field interactions that enable/disable the QDialogButtonBox and a test asserting that simultaneous name/email edits update Name-Real: and Name-Email: lines in the template.
StoreModel path, role, and filtering tests
tests/auto/model/tst_storemodel.cpp
Adds three tests: setStoreUpdatesPath() verifies setStore/getStore sync, dataEditRoleKeepsGpgExtension() checks .gpg is preserved for EditRole, and filterAcceptsNonGpgFileMatchingRegex() verifies filter accepts a non-.gpg filename per configured regex.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • IJHack/QtPass#1481: Expands tst_configdialog.cpp with tests around pwgen/pwgenPath and ConfigDialog UI toggles, overlapping this PR's ConfigDialog changes.
  • IJHack/QtPass#904: Introduced or extended parseGpgColonOutput tests that relate to the GpgKeyState parsing cases added here.
  • IJHack/QtPass#1476: Adds KeygenDialog widget tests similar to the passphrase and template tests in this PR.

Suggested labels

size:L

Suggested reviewers

  • annejan

Poem

🐰 New tests hop in, precise and neat,
Buttons and checkboxes pass each seat,
GPG lines parsed with careful art,
Templates updated — every part,
StoreModel, dialogs — all verified, sweet.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the primary change: expanding test suites for configdialog and keygendialog with new test cases covering public API methods and configuration round-trip validation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/configdialog-keygendialog-tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/auto/model/tst_storemodel.cpp`:
- Around line 559-585: Rename the test function
tst_storemodel::filterHidesNonGpgFile to a name that matches its behavior (for
example filterAcceptsNonGpgFileMatchingRegex or
filterDoesNotRestrictToGpgFilesOnly) and update its declaration/definition so
both the prototype and implementation use the new identifier (change the
function name at the definition shown and the corresponding declaration near the
top of the test file). Ensure any references in test registration or test macro
use the new name as well.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: d2af0521-941f-4b9f-8ba8-fee15616784c

📥 Commits

Reviewing files that changed from the base of the PR and between c163cb3 and 0a3b985.

📒 Files selected for processing (4)
  • tests/auto/configdialog/tst_configdialog.cpp
  • tests/auto/gpgkeystate/tst_gpgkeystate.cpp
  • tests/auto/keygendialog/tst_keygendialog.cpp
  • tests/auto/model/tst_storemodel.cpp

Comment thread tests/auto/model/tst_storemodel.cpp Outdated
@coveralls
Copy link
Copy Markdown

coveralls commented May 17, 2026

Coverage Status

Coverage is 55.418%test/configdialog-keygendialog-tests into main. No base build found for main.

Fix three clang-format violations introduced in the previous commit:
- tst_configdialog: collapse two short QVERIFY2 calls onto single lines
- tst_keygendialog: wrap an over-length QVERIFY2 message string

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • tests/auto/model/tst_storemodel.cpp

Commit: 6906c0e5002f1870eb3269e7e597a0c3375363b5

The changes have been pushed to the test/configdialog-keygendialog-tests branch.

Time taken: 1m 6s

Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
@annejan annejan merged commit d87ce31 into main May 17, 2026
24 of 25 checks passed
@annejan annejan deleted the test/configdialog-keygendialog-tests branch May 17, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants