Skip to content

Expand MainWindow and TransformOperator coverage - #228

Merged
fernandotonon merged 4 commits into
masterfrom
codex/coverage-push-7
Mar 27, 2026
Merged

Expand MainWindow and TransformOperator coverage#228
fernandotonon merged 4 commits into
masterfrom
codex/coverage-push-7

Conversation

@fernandotonon

@fernandotonon fernandotonon commented Mar 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • add broader MainWindow coverage for drag/drop, recent files, MCP server state, and merge-animation enablement
  • add broader TransformOperator coverage for gizmo visibility, local/world orientation, selection averages, and tracked entity transforms
  • target larger uncovered logic blocks to move overall coverage more than the prior small increments

Testing

  • local configure in this worktree is still blocked on long external dependency bootstrap
  • GitHub Actions will be the authoritative validation for this batch

Summary by CodeRabbit

  • Bug Fixes / UI Behavior

    • Drag-and-drop now accepts copy actions and ignores unsupported file types.
    • Recent-files menu entries show basenames, full-path tooltips, and safely handle empty-invocation cases.
    • Merge-animations control enables/disables appropriately based on selection content.
    • Gizmo visibility and tracking now update correctly for translate/rotate/scale/select states and multi-selection scenarios.
  • Tests

    • Expanded automated tests covering gizmo visibility/positioning, selection scaling/rotation/orientation propagation, entity scale/orientation tracking, drag-and-drop behavior, recent-files handling, and server lifecycle edge cases.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Mar 27, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ff2e3c15-884a-4d56-9e0c-e3985c05609e

📥 Commits

Reviewing files that changed from the base of the PR and between b64a431 and 60ca91c.

📒 Files selected for processing (2)
  • src/TransformOperator_test.cpp
  • src/mainwindow_test.cpp
✅ Files skipped from review due to trivial changes (2)
  • src/TransformOperator_test.cpp
  • src/mainwindow_test.cpp

📝 Walkthrough

Walkthrough

Adds extensive unit tests to TransformOperator and MainWindow covering gizmo visibility and transform-state transitions, orientation/scale propagation for node/entity selections, drag-and-drop and recent-files UI behavior, MCP server lifecycle, and small test helpers with environment-based skips.

Changes

Cohort / File(s) Summary
TransformOperator tests
src/TransformOperator_test.cpp
Added expectVectorNear(...) and is*GizmoVisible(...) helpers; many TEST_F cases covering gizmo show/hide on transform-state changes, tracking enable flags, orientation propagation for single/multi selections in local/global spaces, updateGizmoPosition() signal emissions for entities, setter semantics for selected scale/orientation, and entity rotation accumulation. Tests conditionally skip entity-related checks when rendering/mesh loading is unavailable.
MainWindow tests
src/mainwindow_test.cpp
Added createAnimatedEntity(const char*) helper (returns nullptr when animated meshes unavailable); added dragEnter/drop tests ensuring accepted actions and filtering of unsupported URIs; recent-files tests for action label/tooltip/data and openRecentFile() no-sender behavior; MCP server set/start/stop lifecycle tests and persisted flag clearing; merge-animations button enablement scenarios with environment-based skips.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐇 I hopped through tests with nimble feet,
Gizmos danced and selections met — neat!
Scales averaged well, angles set straight,
Drops kept the good files, recent menus celebrate.
A rabbit's cheer for tests passing late!

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description covers the main areas of change and testing considerations, but lacks the structured template sections (Summary, Technical Details with subsections). Restructure the description to follow the template format with clear Summary and Technical Details sections, and categorize changes under Features or Bugfixes.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change—expanding test coverage for MainWindow and TransformOperator—which aligns with the file modifications.

✏️ 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 codex/coverage-push-7

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/mainwindow_test.cpp`:
- Around line 87-95: The helper createAnimatedEntity currently contains
EXPECT_NE(entity, nullptr) which can record a test failure before callers have a
chance to call GTEST_SKIP; remove that assertion from createAnimatedEntity so it
simply returns nullptr when mesh loading or createAnimatedTestEntity fails (the
helper already checks canLoadMeshFiles and returns nullptr). Update callers to
check the returned pointer and call GTEST_SKIP() (or perform the EXPECT_NE
assertion) after skipping logic, or alternatively centralize skip behavior
inside createAnimatedEntity by detecting nullptr and calling GTEST_SKIP() there
instead of asserting; use the function names createAnimatedEntity,
canLoadMeshFiles, and createAnimatedTestEntity to locate and change the code.

In `@src/TransformOperator_test.cpp`:
- Around line 459-470: The test TEST_F(TransformOperatorTests,
EntityQuaternionRotationAccumulatesTrackedEulerDelta) only applies one
rotateSelected(Ogre::Quaternion...) so it can’t prove accumulation; update the
test to either seed the tracked rotation to a non-zero value via
SelectionSet::getSingleton()->setEntityRotation(...) (or equivalent) before
calling op->rotateSelected, or call op->rotateSelected(...) twice with known
quaternion deltas, then read the tracked Euler via
SelectionSet::getSingleton()->getEntityRotation(entity) and assert the tracked.y
equals the sum of the applied deltas (with the same EXPECT_NEAR tolerance) to
verify accumulation rather than overwrite.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b4b53a1f-fd0a-42db-b028-20d627a1c46e

📥 Commits

Reviewing files that changed from the base of the PR and between b2de341 and b825a0a.

📒 Files selected for processing (2)
  • src/TransformOperator_test.cpp
  • src/mainwindow_test.cpp

Comment thread src/mainwindow_test.cpp Outdated
Comment thread src/TransformOperator_test.cpp

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/TransformOperator_test.cpp (1)

480-492: Consider adding assertions for x and z components.

The test now correctly proves accumulation by seeding an initial rotation value. For completeness, you could also verify that the x and z components remain unchanged (at their initial values) to ensure the Y-axis rotation doesn't leak into other axes.

♻️ Suggested enhancement
     const Ogre::Vector3 tracked = SelectionSet::getSingleton()->getEntityRotation(entity);
+    EXPECT_NEAR(tracked.x, 0.0f, 0.5f);
     EXPECT_NEAR(tracked.y, 30.0f, 0.5f);
+    EXPECT_NEAR(tracked.z, 0.0f, 0.5f);
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/TransformOperator_test.cpp` around lines 480 - 492, Add assertions to
verify x and z components remain unchanged after Y-axis rotation in the TEST_F
TransformOperatorTests::EntityQuaternionRotationAccumulatesTrackedEulerDelta
test: after calling SelectionSet::getSingleton()->setEntityRotation(...) and
op->rotateSelected(...), check the tracked vector from
SelectionSet::getSingleton()->getEntityRotation(entity) and add EXPECT_NEAR
checks for tracked.x and tracked.z to be 0.0f (use the same tolerance as the
existing y check, e.g., 0.5f) so the test ensures no unintended rotation leakage
into X or Z.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/TransformOperator_test.cpp`:
- Around line 480-492: Add assertions to verify x and z components remain
unchanged after Y-axis rotation in the TEST_F
TransformOperatorTests::EntityQuaternionRotationAccumulatesTrackedEulerDelta
test: after calling SelectionSet::getSingleton()->setEntityRotation(...) and
op->rotateSelected(...), check the tracked vector from
SelectionSet::getSingleton()->getEntityRotation(entity) and add EXPECT_NEAR
checks for tracked.x and tracked.z to be 0.0f (use the same tolerance as the
existing y check, e.g., 0.5f) so the test ensures no unintended rotation leakage
into X or Z.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9e0a8b26-9415-4a61-a736-241bdb63d873

📥 Commits

Reviewing files that changed from the base of the PR and between c402114 and b64a431.

📒 Files selected for processing (1)
  • src/TransformOperator_test.cpp

@sonarqubecloud

Copy link
Copy Markdown

@fernandotonon
fernandotonon merged commit f6a4e03 into master Mar 27, 2026
18 checks passed
@fernandotonon
fernandotonon deleted the codex/coverage-push-7 branch March 27, 2026 20:59
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.

1 participant