-
Notifications
You must be signed in to change notification settings - Fork 340
test(ui): add comprehensive tests for UI Editor components #609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add 22 new test files covering all UI Editor components: - Button: JButton, JButtonGroup, JIconButton, JToggleButton - Form: JDropdown, JFormField, JObjectField, JTextField, JToggle - Layout: JCard, JRow, JSection, JStack - Feedback: JLogView, JProgressBar, JStatusBar - Navigation: JBreadcrumb - Theming: JTheme, Tokens - Utilities: EnumHelpers, StyleSheetManager - Base: JComponent Coverage improved from 14% to 61.7% for UI.Editor package. Uses reflection for button click testing with graceful fallback. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net>
- Replace HashSet with List (no need for hash-based uniqueness) - Use ArrayPool for CloseAll() instead of allocating new array - Remove LINQ dependency (use direct list indexing) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net>
df169aa to
359fcae
Compare
Unity Test Results✅ EditMode: All tests passed Unity Version: 2022.3.55f1 ✅ All tests passed! The PR is ready for review. View workflow run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive test coverage for the UI Editor components, bringing coverage from 14% to 61.7%. It includes performance optimizations to the MessageBox class and updates the gitignore for code coverage reports.
Changes:
- Added 22 new test files covering all major UI Editor components (buttons, forms, layout, feedback, navigation, theming, and utilities)
- Optimized MessageBox for zero-allocation: replaced HashSet with List, used ArrayPool for temporary arrays, and removed LINQ usage
- Updated gitignore to exclude CodeCoverage folder and added code coverage configuration
Reviewed changes
Copilot reviewed 56 out of 57 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| MessageBox.cs | Performance optimization: HashSet→List, ArrayPool usage, LINQ removal |
| .gitignore | Added CodeCoverage folder exclusion |
| Settings.json | Code coverage configuration for UI packages |
| JEngine.UI.Editor.Tests.asmdef | Added JEngine.UI.Editor reference |
| 22 test files | Comprehensive tests for buttons, forms, layout, feedback, navigation, theming, utilities |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...ct/Packages/com.jasonxudeveloper.jengine.ui/Tests/Editor/Utilities/StyleSheetManagerTests.cs
Outdated
Show resolved
Hide resolved
...ct/Packages/com.jasonxudeveloper.jengine.ui/Tests/Editor/Utilities/StyleSheetManagerTests.cs
Outdated
Show resolved
Hide resolved
...ct/Packages/com.jasonxudeveloper.jengine.ui/Tests/Editor/Utilities/StyleSheetManagerTests.cs
Outdated
Show resolved
Hide resolved
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
Replace unused `first` variable assignments with discards `_` to satisfy static analysis. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auto-approved: Copilot review found no issues and Unity Tests passed (or were skipped for non-code changes).
Summary
Changes
UI Editor Tests (NEW)
JButtonTests.cs- 40+ tests for button variants, styling, chainingJIconButtonTests.cs- Tests for icon button sizing and tooltipsJToggleButtonTests.cs- Tests for toggle state and callbacksJButtonGroupTests.cs- Tests for button groupingJDropdownTests.cs- Tests for dropdown with generics and enumsJTextFieldTests.cs- Tests for text field validationJToggleTests.cs- Tests for toggle componentJObjectFieldTests.cs- Tests for Unity object fieldsJFormFieldTests.cs- Tests for form field layoutJStackTests.cs- Tests for stack layoutJCardTests.cs- Tests for card componentJRowTests.cs- Tests for row layoutJSectionTests.cs- Tests for section componentJProgressBarTests.cs- Tests for progress barJStatusBarTests.cs- Tests for status barJLogViewTests.cs- Tests for log viewJBreadcrumbTests.cs- Tests for breadcrumb navigationJThemeTests.cs- Tests for theming systemTokensTests.cs- Tests for design tokensEnumHelpersTests.cs- Tests for enum utilitiesStyleSheetManagerTests.cs- Tests for stylesheet managementJComponentTests.cs- Tests for base componentMessageBox Optimization
HashSetwithList(no need for hash-based uniqueness)ArrayPoolforCloseAll()instead of allocating new array[0]instead of.First())Test Coverage
Test plan
🤖 Generated with Claude Code