test: expand PS1PLY and PS1TMD coverage#540
Conversation
Cover remaining TMD primitive modes (0x20/0x24/0x34/0x2d/0x3c/0x3d), export edge cases, and Psy-Q PLY quad import, face colors/materials, and export error paths. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds 615 lines of test coverage to ChangesPS1 PLY and TMD Import/Export Test Coverage
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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 `@src/PS1/PS1PLY_test.cpp`:
- Around line 795-800: The test
PS1PLYOgreTest::ExportPsyqPlyFromEntity_NullEntityReturnsFalse uses a hardcoded
Unix path "/tmp/x.ply"; change the test to construct a platform-agnostic
temporary path (e.g., using QDir::tempPath() combined with a filename) when
calling PS1PLY::exportPsyqPlyFromEntity(nullptr, ...), so the test runs on
Windows, Linux and macOS while keeping the same assertions.
- Around line 802-818: The test uses a Linux-only path in badPath; replace that
with a cross-platform unwritable target and update the test to create it at
runtime (modify TEST_F
PS1PLYOgreTest::ExportPsyqPlyFromEntity_UnwritablePathSetsError). Use
QTemporaryDir/QTemporaryFile (or create a temp dir) and then make the target
unwritable (e.g., create a temp file and call QFile::setPermissions to remove
write permission, or pass the temp directory path as the export target) and
assign that path to badPath before calling PS1PLY::exportPsyqPlyFromEntity; this
ensures the export fails and err is set on Windows/macOS/Linux without
hardcoding /proc.
In `@src/PS1/PS1TMD_test.cpp`:
- Around line 1215-1260: The new Ogre-dependent tests (e.g.,
ImportMode24LitTexturedTriangle_HasUvs, ImportMode20FlatLitTriangle,
ImportMode34GouraudTexturedTriangle, ImportMode2dNoLightTexturedQuad,
ImportMode3cGouraudTexturedQuad, ImportMode3dGouraudTexturedQuadNoLight) must
fail fast when Ogre prerequisites are missing; update the test fixture SetUp to
assert prerequisites by calling ASSERT_TRUE(tryInitOgre()) and
ASSERT_TRUE(canLoadMeshFiles()) (instead of silently skipping), so add those two
ASSERT_TRUE checks in the fixture SetUp used by these TEST_F cases (where
tryInitOgre and canLoadMeshFiles are defined) to ensure CI fails loudly when
mesh-file support is unavailable.
- Around line 1233-1236: The test dereferences getSubMesh(0)->vertexData without
ensuring the mesh has any submeshes; before accessing mesh->getSubMesh(0) assert
mesh->getNumSubMeshes() > 0 (or ASSERT_NE(mesh->getNumSubMeshes(), 0)) to guard
the access. In the PS1TMD_test.cpp block around the PS1TMD::importTmd(...)
usage, add an assertion on mesh->getNumSubMeshes() and only then grab const
Ogre::VertexData* vd = mesh->getSubMesh(0)->vertexData to prevent crashes when
no submeshes exist.
🪄 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: 8fd7b23e-3605-485b-9041-cc01c349be34
📒 Files selected for processing (2)
src/PS1/PS1PLY_test.cppsrc/PS1/PS1TMD_test.cpp
Use QDir::tempPath() for export error tests instead of /tmp and /proc. Assert canLoadMeshFiles() in PS1TMDTest::SetUp and guard submesh access in mode 0x24 UV test. Co-authored-by: Cursor <cursoragent@cursor.com>
|



Summary
importPsyqPlyWithFaceColors, unlit_nlmaterial suffix via face materials, andexportPsyqPlyFromEntityerror handling.Test plan
xvfb-run ./build_local/bin/UnitTests --gtest_filter="PS1PLY*:PS1TMDTest.*"— 39 passed locallyunit-tests-linuxMade with Cursor
Summary by CodeRabbit