test: add unit tests for PR#31 - #33
Merged
NullPointerDepressiveDisorder merged 3 commits intoDec 22, 2025
Merged
Conversation
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
NullPointerDepressiveDisorder
marked this pull request as ready for review
December 22, 2025 13:12
Copilot started reviewing on behalf of
NullPointerDepressiveDisorder
December 22, 2025 13:12
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive unit tests for the changes introduced in PR#31, focusing on testing core framework classes and managers. The tests cover singleton patterns, property access, and basic functionality verification for MultitouchFramework, PreferencesManager, MouseEventGenerator, AnalyticsManager, CrashReporter, and Log classes.
Key changes:
- Adds complete test suite for MultitouchFramework class covering singleton pattern, device availability, and device access methods
- Adds minor formatting fixes (final newlines) to three existing test files
Reviewed changes
Copilot reviewed 1 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| MiddleDragTests/MultitouchFrameworkTests.swift | New test file with 39 lines testing MultitouchFramework singleton, device availability, and device retrieval methods |
| MiddleDragTests/PreferencesManagerTests.swift | Adds final newline to conform to file formatting standards |
| MiddleDragTests/MouseEventGeneratorTests.swift | Adds final newline to conform to file formatting standards |
| MiddleDragTests/AnalyticsManagerTests.swift | Adds final newline to conform to file formatting standards |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Karan Mohindroo <96403086+NullPointerDepressiveDisorder@users.noreply.github.com>
Updated test to ensure isAvailable method does not crash and returns consistent results. Signed-off-by: Karan Mohindroo <96403086+NullPointerDepressiveDisorder@users.noreply.github.com>
NullPointerDepressiveDisorder
deleted the
ai-tests-for-pr31-1766403602
branch
December 22, 2025 18:09
NullPointerDepressiveDisorder
added a commit
that referenced
this pull request
Dec 27, 2025
* Add unit tests for Core and Utilities modules - Add MouseEventGeneratorTests.swift with 13 tests covering: - Initialization and property defaults - Drag state edge cases (cancel/end/update without active drag) - Static mouse location method - Add PreferencesManagerTests.swift with 9 tests covering: - Default preferences loading - Save/load roundtrip verification - Palm rejection preferences - Edge cases for sensitivity and exclusion zone values - Singleton pattern verification - Add AnalyticsManagerTests.swift with 15 tests covering: - Log category enum values - CrashReporter singleton pattern - Log function smoke tests for all levels - Default disabled states for crash/performance monitoring - Update project.pbxproj to include new test files in MiddleDragTests target Total test count increased from ~52 to 80 tests. * test: add unit tests for PR#31 (#33) * test: add unit tests for PR#31 * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Karan Mohindroo <96403086+NullPointerDepressiveDisorder@users.noreply.github.com> * Rename test and improve isAvailable validation Updated test to ensure isAvailable method does not crash and returns consistent results. Signed-off-by: Karan Mohindroo <96403086+NullPointerDepressiveDisorder@users.noreply.github.com> --------- Signed-off-by: Karan Mohindroo <96403086+NullPointerDepressiveDisorder@users.noreply.github.com> Co-authored-by: seer-by-sentry[bot] <157164994+seer-by-sentry[bot]@users.noreply.github.com> Co-authored-by: Karan Mohindroo <96403086+NullPointerDepressiveDisorder@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * test: Add unit tests for `LaunchAtLoginManager` and update the Xcode project file. * style: Reorder imports and fix minor whitespace issues in `LaunchAtLoginManagerTests.swift`. * build: add core and UI files from MiddleDragTests membership exceptions * feat: Configure test host and bundle loader for MiddleDragTests target and update file exceptions. * feat: Add Frameworks group, update macOS deployment target, and link MultitouchSupport and CoreFoundation frameworks. * test: modify getDefaultDevice test to only assert no crash instead of equality. * build: set MACOSX_DEPLOYMENT_TARGET to 15.0 and remove test host settings from test target. * feat: add tests for drag, click, and cancel operations to prevent crashes and verify basic sequences * test: add CrashReporter enable/disable and telemetry state tests * feat: Add `UserDefaults` dependency injection to `PreferencesManager` and refactor tests to use an isolated `UserDefaults` instance. * feat: add comprehensive unit tests for GestureRecognizer state transitions, tap, and drag detection. * test: add comprehensive tests for movement thresholds, smoothing effects, and drag state management. * feat(core): add TouchDeviceProviding protocol for dependency injection - Define protocol with delegate, start(), and stop() methods - Enables mocking of device monitoring for unit tests - Improves testability of MultitouchManager * refactor(DeviceMonitor): conform to TouchDeviceProviding protocol - Add TouchDeviceProviding protocol conformance - No logic changes - class already implements required methods * refactor(MultitouchManager): add factory-based dependency injection - Add deviceProviderFactory parameter to init for DI - Replace direct DeviceMonitor instantiation with factory call - Maintain backward compatibility with default factory - Enables injecting mocks for unit testing * test(mocks): add MockDeviceMonitor for unit testing - Implement TouchDeviceProviding protocol - Track start/stop call counts for verification - Add simulateTouches() helper for future integration tests * test(MultitouchManager): add mock-based lifecycle tests - Add 6 new tests using MockDeviceMonitor injection - Cover start/stop lifecycle, state transitions, toggle behavior - Previously untestable without hardware access * test(managers): improve DeviceMonitor and AnalyticsManager coverage - Add DeviceMonitorTests for basic lifecycle testing - Add Log.Category.crash and osLog property tests to AnalyticsManager * chore(xcode): update project with new test files - Add MockDeviceMonitor to membership exceptions - Add DeviceMonitorTests to project * chore: modify Codecov ignore pattern for test files * chore: Update Codecov ignore pattern to specifically exclude MiddleDragTests directory. * Update Sentry organization name * chore: update sentry dev-build token * feat: Make `DeviceMonitor` robust against global state interference and idempotent `stop` calls, with updated tests. * feat: Add Debug and Release xcconfig files and integrate them into the project build configurations. * refactor: Migrate xcconfig files to a synchronized Frameworks group in Xcode project. * test: improve Managers folder test coverage from 44% to 85% Add comprehensive tests for MultitouchManager: - GestureRecognizerDelegate state transition tests - Update dragging with movement variations - DeviceMonitor delegate when enabled/disabled - Edge cases: toggle/stop while dragging Add tests for DeviceMonitor: - Delegate handling (set, clear, weak reference) - Multiple instance ownership - Instance lifecycle All delegate callbacks and gesture handling now at 100% coverage. * chore: Ignore TestResults.xcresult in .gitignore * feat: Add unit tests for `AlertHelper` and `MenuBarController`. * fix: Ensure all registered devices are properly unregistered by tracking them in a class property. * test: Add DeviceMonitor tests for deinitialization, cleanup, and multi-instance resource management. * refactor: Adjust `DeviceMonitor` deinit and start/stop tests for CI compatibility. --------- Signed-off-by: Karan Mohindroo <96403086+NullPointerDepressiveDisorder@users.noreply.github.com> Co-authored-by: seer-by-sentry[bot] <157164994+seer-by-sentry[bot]@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test: add unit tests for PR#31
This PR adds comprehensive unit tests for the changes introduced in PR#31.
Changes:
Test coverage includes:
Test coverage includes:
Test coverage includes:
Test coverage includes: