Skip to content

Add test suite#140

Merged
slimbuck merged 1 commit intoplaycanvas:mainfrom
slimbuck:test-dev
Jan 14, 2026
Merged

Add test suite#140
slimbuck merged 1 commit intoplaycanvas:mainfrom
slimbuck:test-dev

Conversation

@slimbuck
Copy link
Member

Add comprehensive test suite for format conversions and transformations

Implements a complete test suite using Node.js built-in test runner to validate all input/output formats and transformation operations.

Changes

Test Infrastructure

  • Add test/helpers/summary-compare.mjs - Utilities for comparing DataTable summaries with configurable tolerance
  • Add test/helpers/test-utils.mjs - Test data creation helpers and PLY binary encoding
  • Add test/fixtures/generator.mjs - Deterministic 4x4 grid splat generator for reproducible tests
  • Add test/fixtures/create-fixtures.mjs - Script to synthesize minimal binary test fixtures

Binary Test Fixtures

  • minimal.splat - 4 splats in antimatter15 format (128 bytes)
  • minimal.ksplat - 4 splats in mkkellogg format, compression mode 0
  • minimal.spz - 4 splats in Niantic SPZ version 2 format

Format Tests (test/formats.test.mjs)

  • PLY round-trip (lossless)
  • Compressed PLY round-trip (lossy, tolerance-based)
  • SOG bundled round-trip (lossy, tolerance-based)
  • SOG unbundled round-trip (lossy, tolerance-based)
  • SPLAT, KSPLAT, SPZ input reading
  • CSV output validation
  • MJS generator validation

HTML Output Tests (test/html-output.test.mjs)

  • Bundled and unbundled HTML viewer generation
  • Viewer settings JSON support

Transformation Tests (test/transforms.test.mjs)

  • Translate, rotate, scale operations
  • Filter box, sphere, by value, NaN, SH bands
  • Chained transforms, summary, and LOD actions

Package Updates

  • Add test script: node --test test/*.test.mjs
  • Add test:fixtures script for regenerating binary fixtures

Validation Approach

Tests use computeSummary() to verify data correctness. Lossless formats use exact comparison; lossy formats use tolerance-based summary comparison.

Test Results

37 tests across 21 suites, all passing.

@slimbuck slimbuck requested review from a team and Copilot January 14, 2026 16:05
@slimbuck slimbuck self-assigned this Jan 14, 2026
@slimbuck slimbuck added the enhancement New feature or request label Jan 14, 2026
Copy link
Contributor

Copilot AI left a 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 a comprehensive test suite for the splat-transform library using Node.js built-in test runner. The suite validates format conversions (PLY, Compressed PLY, SOG, SPLAT, KSPLAT, SPZ, CSV, MJS), HTML viewer generation, and data transformation operations (translate, rotate, scale, filters).

Changes:

  • Added test infrastructure with comparison utilities and test data generators
  • Created binary test fixtures for input-only formats (SPLAT, KSPLAT, SPZ)
  • Implemented 37 tests across 21 suites covering all major functionality
  • Added test scripts to package.json

Reviewed changes

Copilot reviewed 8 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/helpers/summary-compare.mjs Utilities for comparing DataTable summaries with configurable tolerance
test/helpers/test-utils.mjs Test data creation helpers and PLY binary encoding
test/fixtures/generator.mjs Deterministic 4x4 grid splat generator for reproducible tests
test/fixtures/create-fixtures.mjs Script to synthesize minimal binary test fixtures
test/fixtures/splat/minimal.splat Binary test fixture with 4 splats in antimatter15 format
test/fixtures/splat/minimal.ksplat Binary test fixture with 4 splats in mkkellogg format
test/fixtures/splat/minimal.spz Binary test fixture with 4 splats in Niantic SPZ format
test/formats.test.mjs Format conversion and round-trip tests
test/html-output.test.mjs HTML viewer generation tests
test/transforms.test.mjs Transformation and filter operation tests
package.json Added test and test:fixtures scripts

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@slimbuck slimbuck merged commit 2e691bd into playcanvas:main Jan 14, 2026
8 checks passed
@slimbuck slimbuck deleted the test-dev branch January 14, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants