Skip to content

test(api-demos): stabilize visual testing suite and fix rendering glitches#44

Open
dkhawk wants to merge 20 commits into
mainfrom
feat/catalogs-for-java-and-kotlin-views
Open

test(api-demos): stabilize visual testing suite and fix rendering glitches#44
dkhawk wants to merge 20 commits into
mainfrom
feat/catalogs-for-java-and-kotlin-views

Conversation

@dkhawk
Copy link
Copy Markdown
Collaborator

@dkhawk dkhawk commented May 20, 2026

Overview

This PR stabilizes and fixes the instrumented visual testing suites in both the Java and Kotlin View-based ApiDemos applications for the Maps 3D SDK. It resolves rendering errors, prompt discrepancies, lifecycle race conditions, and ensures 100% green test verification on physical connected devices.

Key Changes

  1. Endpoint Verification (visual-testing)

    • Unified GeminiVisualTestHelper.kt to use gemini-3.5-flash on Ktors v1beta` API endpoint, avoiding regional/version discrepancy errors.
  2. Denver Altitude Fix (PolygonsActivity.java)

    • Replaced UnitsKt.getMeters(1.0) with UnitsKt.getMiles(1.0) (which evaluates to ~1609 meters). This corrects the initial camera and museum polygon altitude which was previously set at ground/sea level (deep inside the Denver terrain), fixing the severe blueish-grey mesh rendering glitch.
    • Refactored Java PolygonsActivity initialization to utilize a robust, delayed Handler fallback pattern to let the 3D rendering engine stabilize before placing map camera or geometry.
  3. Visual Prompt Alignments (java-app and kotlin-app)

    • Markers: Aligned visual verification prompts in MarkersVisualTest (Java/Kotlin) to expect the NYC / Giant Ape marker on the Empire State Building and red/yellow pins instead of the outdated Devils Tower setup.
    • Popovers: Aligned prompts in PopoversVisualTest (Java/Kotlin) to locate the "Golden Gate Bridge" marker and assert on "The Golden Gate Bridge" popover title text.
  4. Kotlin App Fixes & Synchronization

    • HelloMap: Added standard camera initialization to HelloMapActivity.kt to center on Delicate Arch (38.743502, -109.499374), aligning it with the Java counterpart and allowing the visual test to successfully verify the Delicate Arch.
    • Popovers: Corrected a string template compilation/escaping bug inside Ktors lambda in PopoversVisualTest.kt` using standard string concatenation.
    • CameraControls: Added explicit setOnMapSteadyListener countdown latch synchronization inside CameraControlsActivityTest.testFlyAround to ensure the camera has fully settled at NYC coordinates before clicking "Fly Around". This avoids state leaks and coordinate mismatches from previous tests.

Testing

  • Java suite: Executed ./gradlew :Maps3DSamples:ApiDemos:java-app:connectedDebugAndroidTest on Pixel 6 -> All 9/9 tests passed.
  • Kotlin suite: Executed ./gradlew :Maps3DSamples:ApiDemos:kotlin-app:connectedDebugAndroidTest on Pixel 6 -> All 12/12 tests passed.

dkhawk added 18 commits April 22, 2026 11:35
…sh UI test baseline

- Created a centralized samples catalog at the repository root for better discoverability, integrating the PlacesUIKit3D sample.
- Created BasicComposeMapActivity from scratch to serve as a minimal pedagogical reference for Maps 3D Compose integration.
- Established a baseline of UI smoke tests across key activities in both advanced and PlacesUIKit3D modules to ensure stability.
Created ComposeDemos module with skeletons, tests, and automation script. Reorganized catalog into module-specific READMEs.
Enabled immersive mode in all implemented activities and updated screenshots in catalog.
Implemented Polygons, Models, and Markers samples in Compose with visual tests and updated catalog.
Implemented Camera Restrictions sample in Compose with visual test and updated catalog.
…log automation

- **Java App**: Fix `CameraControlsVisualTest` by searching for "Heading" after UI string update.
- **Kotlin App**: Add skeleton activities to `MainActivity` and add `:visual-testing` dependency.
- **Common**: Update `camera_state_format` to use "Heading:" instead of "Hdg:" to align with Kotlin.
- **Visual Testing**: Add blocking methods to `GeminiVisualTestHelper` for Java interop and update model to `gemini-2.5-pro`.
- **Automation**: Update `catalog_automation.py` to save screenshots to `screenshots/` instead of `assets/` to avoid bundling them in the APK.

This change brings the Java and Kotlin View samples into better alignment, fixes the failing camera controls test, and improves the automation infrastructure for generating documentation catalogs.
…tches

- Correct Gemini model endpoint configurations in GeminiVisualTestHelper.kt to use gemini-3.5-flash on the v1beta API endpoint for unified visual testing.
- Resolve Denver altitude rendering glitch in PolygonsActivity.java by switching from UnitsKt.getMeters(1.0) to UnitsKt.getMiles(1.0), preventing the camera and polygons from rendering deep underground.
- Refactor PolygonsActivity.java view lifecycle to utilize the robust delayed initialization fallback pattern for 3D renderer stability.
- Align prompts and expectations in MarkersVisualTest (Java and Kotlin) to verify the NYC / Giant Ape / custom pins configuration instead of the outdated Devils Tower setup.
- Align prompts and expected text in PopoversVisualTest (Java and Kotlin) to target the Golden Gate Bridge marker and check for its populated popover layout.
- Implement standard camera setup in HelloMapActivity.kt at the Delicate Arch to achieve full visual parity with the Java implementation.
- Resolve JSON substring extraction bug in PopoversVisualTest.kt by utilizing standard string concatenation.
- Integrate explicit setOnMapSteadyListener wait synchronization at the start of CameraControlsActivityTest.testFlyAround to prevent coordinate validation races.
@dkhawk dkhawk requested a review from kikoso May 20, 2026 20:50
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.

2 participants