Skip to content

Conversation

@ReenigneArcher
Copy link
Member

@ReenigneArcher ReenigneArcher commented Dec 25, 2025

Description

This PR adds screenshots to tests. The goal is to be able to easily review what the tray icon looks like in different states.

TODO:

  • fix sonar warnings
  • post images in PR comment and/or github step summary
    • secondary workflow to:
      • download artifacts from first job
      • publish images to a screenshot branch
      • comment on PR
        • compare master branch images to PR images, make obvious if images are mismatched (need to remove date/time for reliable comparison)
  • specific tray region for screenshots
  • capture more states/events of tray
  • minimize all windows before tests (on windows)
  • use gnome/default DE on linux?
  • ensure icons are actually used in our tests
  • improve test coverage

Screenshot

Issues Fixed or Closed

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

@codecov
Copy link

codecov bot commented Dec 25, 2025

Codecov Report

❌ Patch coverage is 45.45455% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.50%. Comparing base (09c5784) to head (4b989ab).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/tray_darwin.m 0.00% 17 Missing ⚠️
src/tray_linux.c 90.90% 0 Missing and 1 partial ⚠️

❗ There is a different number of reports uploaded between BASE (09c5784) and HEAD (4b989ab). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (09c5784) HEAD (4b989ab)
macOS 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #86      +/-   ##
==========================================
- Coverage   62.01%   56.50%   -5.51%     
==========================================
  Files           4        4              
  Lines         337      361      +24     
  Branches       63       67       +4     
==========================================
- Hits          209      204       -5     
- Misses         92      123      +31     
+ Partials       36       34       -2     
Flag Coverage Δ
Linux 58.62% <90.90%> (+9.56%) ⬆️
Windows 68.34% <100.00%> (+11.64%) ⬆️
libappindicator3-dev 58.62% <90.90%> (+9.56%) ⬆️
libayatana-appindicator3-dev 58.62% <90.90%> (?)
macOS ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/tray_windows.c 77.27% <100.00%> (+12.94%) ⬆️
src/tray_linux.c 73.11% <90.90%> (+10.46%) ⬆️
src/tray_darwin.m 0.00% <0.00%> (-83.93%) ⬇️

@ReenigneArcher ReenigneArcher force-pushed the test/add-screenshots branch 8 times, most recently from e10b0fe to 2e7f594 Compare December 25, 2025 04:18
Significantly expanded unit tests in test_tray.cpp to cover menu callbacks, submenu structures, notifications, tooltips, context pointers, checkbox states, icon updates, and platform-specific icon caching. Improved test setup to ensure screenshot tooling and icon files are available, and refactored test logic for better coverage and maintainability.
@ReenigneArcher ReenigneArcher force-pushed the test/add-screenshots branch 4 times, most recently from 2c64fbf to 4689406 Compare December 28, 2025 00:14
Adds a step to enable all tray icons on Windows runners and increases the test timeout from 1 to 3 minutes. Also updates output redirection syntax for better compatibility.
Introduces the tray_show_menu function for all supported platforms, allowing the tray menu to be shown programmatically (primarily for testing). Updates unit tests to verify this functionality and adds a delay in screenshot capture to ensure UI elements are rendered before capture.
Introduces tray_get_hwnd() to retrieve the tray window handle on Windows. Updates unit tests to use this accessor for posting messages and synchronizing menu interactions. This improves test reliability and enables direct window manipulation in tests.
Improves code consistency by adjusting spacing in type casts, reordering standard includes, and updating comment formatting in unit tests. No functional changes were made.
Updated test_tray.cpp to simulate ESC key events for dismissing the tray menu on macOS using CoreGraphics. Also changed Windows-specific preprocessor checks to use TRAY_WINAPI macro for consistency.
Added a conditional to skip the TestTooltipUpdate test on macOS platforms where tooltips are not supported.
Updated the Windows CI workflow to enable all tray icons and disable Do Not Disturb mode before running tests. This ensures that notification and tray icon related tests run in a consistent environment.
Added a conditional to skip the TestCheckboxStates test on macOS using GTEST_SKIP, as checkboxes are not supported on this platform.
Replaces the reg add command with Set-ItemProperty for disabling Do Not Disturb, adds setting the Profile to Unrestricted, and restarts notification services to ensure changes take effect.
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
44 New issues
44 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.

2 participants