Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .agents/skills/android-maps-testing/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ dependencies {

Use `withTestMap { ... }` to spin up a measured, laid-out, initialized `GoogleMap` in one line and assert state with `com.google.maps.android.robolectric.truth.assertThat`:

Reference: `// [START maps_robolectric_demo_test]` in [`MapDemoTest.kt`](../../../app/src/test/java/com/example/androidmapsrobolectric/MapDemoTest.kt#L36-L83)
Reference: `// [START maps_robolectric_demo_test]` in [`MapDemoTest.kt`](../../../app/src/test/java/com/google/maps/android/testing/sample/MapDemoTest.kt#L36-L83)

```kotlin
// [START maps_robolectric_demo_test]
Expand Down Expand Up @@ -288,7 +288,7 @@ Reference: `// [START maps_robolectric_power_assert]` in [`LazyAssertionsCompari

Pass the test `GoogleMap` from `createTestMap()` directly into your production controller (`StoreLocatorMapManager`), or locate an embedded `MapView` inside an `Activity` or Jetpack Compose screen via `requireMapView()`:

Reference: `// [START maps_robolectric_manager_test]` in [`StoreLocatorMapManagerTest.kt`](../../../app/src/test/java/com/example/androidmapsrobolectric/manager/StoreLocatorMapManagerTest.kt#L37-L129)
Reference: `// [START maps_robolectric_manager_test]` in [`StoreLocatorMapManagerTest.kt`](../../../app/src/test/java/com/google/maps/android/testing/sample/manager/StoreLocatorMapManagerTest.kt#L37-L129)

```kotlin
// [START maps_robolectric_manager_test]
Expand Down Expand Up @@ -406,7 +406,7 @@ Reference: `// [START robolectric_view_hierarchy_lookup]` in [`ShadowMapViewKotl

### Paradigm 1D: Comprehensive Java Headless JVM Testing (`:robolectric-testing`)

Reference: `// [START maps_robolectric_java_demo_test]` in [`MapViewDemoTest.java`](../../../app/src/test/java/com/example/androidmapsrobolectric/MapViewDemoTest.java#L86-L152)
Reference: `// [START maps_robolectric_java_demo_test]` in [`MapViewDemoTest.java`](../../../app/src/test/java/com/google/maps/android/testing/sample/MapViewDemoTest.java#L86-L152)

```java
// [START maps_robolectric_java_demo_test]
Expand Down Expand Up @@ -620,7 +620,7 @@ Reference: `// [START golden_diff_artifacts_and_record]` in [`GoldenImageDiffTes

Extend `BaseVisualTest` and call `verifyScreenshotWithGoldenFallback(...)`. On clean emulators or CI, `BaseVisualTest` checks bundled test APK assets (`src/androidTest/assets/goldens/<testName>.png`) first for an instant zero-quota fast pass, and only consults Gemini Vision when no baseline exists yet or pixel diff exceeds `tolerancePercent`:

Reference: `// [START maps_visual_test_sample]` in [`VisualMapSampleTest.kt`](../../../app/src/androidTest/java/com/example/androidmapsrobolectric/VisualMapSampleTest.kt#L28-L72)
Reference: `// [START maps_visual_test_sample]` in [`VisualMapSampleTest.kt`](../../../app/src/androidTest/java/com/google/maps/android/testing/sample/VisualMapSampleTest.kt#L28-L72)

```kotlin
// [START maps_visual_test_sample]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Reference: `// [START maps_visual_golden_fallback]` in [`BaseVisualTest.kt`](../

## 5. End-to-End Instrumented Test

Reference: `// [START maps_visual_test_sample]` in [`VisualMapSampleTest.kt`](../../../../app/src/androidTest/java/com/example/androidmapsrobolectric/VisualMapSampleTest.kt#L28-L72)
Reference: `// [START maps_visual_test_sample]` in [`VisualMapSampleTest.kt`](../../../../app/src/androidTest/java/com/google/maps/android/testing/sample/VisualMapSampleTest.kt#L28-L72)

```kotlin
// [START maps_visual_test_sample]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ flowchart TD

## 4. Production Map Controller Implementation

Reference: `// [START maps_robolectric_manager]` in [`StoreLocatorMapManager.kt`](../../../../app/src/main/java/com/example/androidmapsrobolectric/manager/StoreLocatorMapManager.kt#L31-L157)
Reference: `// [START maps_robolectric_manager]` in [`StoreLocatorMapManager.kt`](../../../../app/src/main/java/com/google/maps/android/testing/sample/manager/StoreLocatorMapManager.kt#L31-L157)

```kotlin
// [START maps_robolectric_manager]
Expand Down Expand Up @@ -231,7 +231,7 @@ class StoreLocatorMapManager(

## 5. Testing the Controller on JVM with `createTestMap` & Domain Assertions

Reference: `// [START maps_robolectric_manager_test]` in [`StoreLocatorMapManagerTest.kt`](../../../../app/src/test/java/com/example/androidmapsrobolectric/manager/StoreLocatorMapManagerTest.kt#L37-L129)
Reference: `// [START maps_robolectric_manager_test]` in [`StoreLocatorMapManagerTest.kt`](../../../../app/src/test/java/com/google/maps/android/testing/sample/manager/StoreLocatorMapManagerTest.kt#L37-L129)

```kotlin
// [START maps_robolectric_manager_test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Annotate your test class with `@EnableMapsShadows`, `@RunWith(RobolectricTestRun

Instead of manually constructing an `Activity`, measuring/laying out a `MapView`, and idling `ShadowLooper`, use `withTestMap { ... }` or `createTestMap()` from `com.google.maps.android.robolectric.ktx`:

Reference: `// [START maps_robolectric_demo_test]` in [`MapDemoTest.kt`](../../../../app/src/test/java/com/example/androidmapsrobolectric/MapDemoTest.kt#L36-L83)
Reference: `// [START maps_robolectric_demo_test]` in [`MapDemoTest.kt`](../../../../app/src/test/java/com/google/maps/android/testing/sample/MapDemoTest.kt#L36-L83)

```kotlin
// [START maps_robolectric_demo_test]
Expand Down Expand Up @@ -334,7 +334,7 @@ Reference: `// [START robolectric_view_hierarchy_lookup]` in [`ShadowMapViewKotl

`ShadowMapView` integrates Mercator projection mathematics to render overlays directly onto an Android `Bitmap` / `Canvas` in memory:

Reference: `// [START maps_robolectric_java_demo_test]` in [`MapViewDemoTest.java`](../../../../app/src/test/java/com/example/androidmapsrobolectric/MapViewDemoTest.java#L86-L152)
Reference: `// [START maps_robolectric_java_demo_test]` in [`MapViewDemoTest.java`](../../../../app/src/test/java/com/google/maps/android/testing/sample/MapViewDemoTest.java#L86-L152)

```java
// [START maps_robolectric_java_demo_test]
Expand Down
4 changes: 2 additions & 2 deletions .agents/skills/maps-robolectric-testing/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Annotate your test class with:

### A. 1-Liner KTX Test Harness (`withTestMap`) & Unified Google Truth (`assertThat(map)`)

Reference: `// [START maps_robolectric_demo_test]` in [`MapDemoTest.kt`](../../../app/src/test/java/com/example/androidmapsrobolectric/MapDemoTest.kt#L36-L83)
Reference: `// [START maps_robolectric_demo_test]` in [`MapDemoTest.kt`](../../../app/src/test/java/com/google/maps/android/testing/sample/MapDemoTest.kt#L36-L83)

```kotlin
// [START maps_robolectric_demo_test]
Expand Down Expand Up @@ -156,7 +156,7 @@ Reference: `// [START maps_robolectric_power_assert]` in [`LazyAssertionsCompari

### C. Testing Production Map Controllers (`createTestMap`)

Reference: `// [START maps_robolectric_manager_test]` in [`StoreLocatorMapManagerTest.kt`](../../../app/src/test/java/com/example/androidmapsrobolectric/manager/StoreLocatorMapManagerTest.kt#L37-L129)
Reference: `// [START maps_robolectric_manager_test]` in [`StoreLocatorMapManagerTest.kt`](../../../app/src/test/java/com/google/maps/android/testing/sample/manager/StoreLocatorMapManagerTest.kt#L37-L129)

```kotlin
// [START maps_robolectric_manager_test]
Expand Down
2 changes: 1 addition & 1 deletion .agents/skills/maps-visual-testing/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ dependencies {

## 3. End-to-End Sample Test

Reference: `// [START maps_visual_test_sample]` in [`VisualMapSampleTest.kt`](../../../app/src/androidTest/java/com/example/androidmapsrobolectric/VisualMapSampleTest.kt#L28-L72)
Reference: `// [START maps_visual_test_sample]` in [`VisualMapSampleTest.kt`](../../../app/src/androidTest/java/com/google/maps/android/testing/sample/VisualMapSampleTest.kt#L28-L72)

```kotlin
// [START maps_visual_test_sample]
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ powerAssert {
}

android {
namespace = "com.example.androidmapsrobolectric"
namespace = "com.google.maps.android.testing.sample"
compileSdk = 37
val secretsFile = rootProject.file("secrets.properties")
val props = Properties()
Expand All @@ -51,7 +51,7 @@ android {
val geminiKey = props.getProperty("GEMINI_API_KEY")

defaultConfig {
applicationId = "com.example.androidmapsrobolectric"
applicationId = "com.google.maps.android.testing.sample"
minSdk = 24
targetSdk = 36
versionCode = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.example.androidmapsrobolectric
package com.google.maps.android.testing.sample

import android.content.Intent
import androidx.test.ext.junit.runners.AndroidJUnit4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
* limitations under the License.
*/

package com.example.androidmapsrobolectric.ui.main
package com.google.maps.android.testing.sample.ui.main

import androidx.activity.ComponentActivity
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
import com.example.androidmapsrobolectric.model.Store
import com.google.android.gms.maps.model.LatLng
import com.google.maps.android.testing.sample.model.Store
import org.junit.Before
import org.junit.Rule
import org.junit.Test

/** UI tests for [com.example.androidmapsrobolectric.ui.main.MainScreen]. */
/** UI tests for [com.google.maps.android.testing.sample.ui.main.MainScreen]. */
class MainScreenTest {

@get:Rule val composeTestRule = createAndroidComposeRule<ComponentActivity>()
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:windowSoftInputMode="adjustResize"
android:theme="@style/Theme.AndroidMapsRobolectric">
android:theme="@style/Theme.MapsTestingSample">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${MAPS_API_KEY}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.example.androidmapsrobolectric
package com.google.maps.android.testing.sample

import android.os.Bundle
import androidx.activity.ComponentActivity
Expand All @@ -24,15 +24,15 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier
import com.example.androidmapsrobolectric.theme.AndroidMapsRobolectricTheme
import com.google.maps.android.testing.sample.theme.MapsTestingSampleTheme

class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

enableEdgeToEdge()
setContent {
AndroidMapsRobolectricTheme { Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) { MainNavigation() } }
MapsTestingSampleTheme { Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) { MainNavigation() } }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.example.androidmapsrobolectric
package com.google.maps.android.testing.sample

import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawingPadding
Expand All @@ -24,7 +24,7 @@ import androidx.compose.ui.unit.dp
import androidx.navigation3.runtime.entryProvider
import androidx.navigation3.runtime.rememberNavBackStack
import androidx.navigation3.ui.NavDisplay
import com.example.androidmapsrobolectric.ui.main.MainScreen
import com.google.maps.android.testing.sample.ui.main.MainScreen

@Composable
fun MainNavigation() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.example.androidmapsrobolectric
package com.google.maps.android.testing.sample

import androidx.navigation3.runtime.NavKey
import kotlinx.serialization.Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

package com.example.androidmapsrobolectric.data
package com.google.maps.android.testing.sample.data

import com.example.androidmapsrobolectric.model.Store
import com.google.android.gms.maps.model.LatLng
import com.google.maps.android.testing.sample.model.Store
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
* limitations under the License.
*/

package com.example.androidmapsrobolectric.manager
package com.google.maps.android.testing.sample.manager

import android.graphics.Color
import com.example.androidmapsrobolectric.model.Store
import com.google.android.gms.maps.CameraUpdateFactory
import com.google.android.gms.maps.GoogleMap
import com.google.android.gms.maps.model.BitmapDescriptorFactory
Expand All @@ -27,6 +26,7 @@ import com.google.android.gms.maps.model.LatLng
import com.google.android.gms.maps.model.LatLngBounds
import com.google.android.gms.maps.model.Marker
import com.google.android.gms.maps.model.MarkerOptions
import com.google.maps.android.testing.sample.model.Store

// [START maps_robolectric_manager]
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.example.androidmapsrobolectric.model
package com.google.maps.android.testing.sample.model

import com.google.android.gms.maps.model.LatLng

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.example.androidmapsrobolectric.theme
package com.google.maps.android.testing.sample.theme

import androidx.compose.ui.graphics.Color

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.example.androidmapsrobolectric.theme
package com.google.maps.android.testing.sample.theme

import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
Expand Down Expand Up @@ -46,7 +46,7 @@ private val LightColorScheme =
)

@Composable
fun AndroidMapsRobolectricTheme(
fun MapsTestingSampleTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
// Dynamic color is available on Android 12+
dynamicColor: Boolean = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.example.androidmapsrobolectric.theme
package com.google.maps.android.testing.sample.theme

import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.example.androidmapsrobolectric.ui.main
package com.google.maps.android.testing.sample.ui.main

import android.os.Bundle
import androidx.compose.foundation.layout.Box
Expand Down Expand Up @@ -42,10 +42,10 @@ import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation3.runtime.NavKey
import com.example.androidmapsrobolectric.data.DefaultDataRepository
import com.example.androidmapsrobolectric.manager.StoreLocatorMapManager
import com.example.androidmapsrobolectric.model.Store
import com.google.android.gms.maps.MapView
import com.google.maps.android.testing.sample.data.DefaultDataRepository
import com.google.maps.android.testing.sample.manager.StoreLocatorMapManager
import com.google.maps.android.testing.sample.model.Store

@Composable
fun MainScreen(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* limitations under the License.
*/

package com.example.androidmapsrobolectric.ui.main
package com.google.maps.android.testing.sample.ui.main

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.androidmapsrobolectric.data.DataRepository
import com.example.androidmapsrobolectric.model.Store
import com.example.androidmapsrobolectric.ui.main.MainScreenUiState.Success
import com.google.maps.android.testing.sample.data.DataRepository
import com.google.maps.android.testing.sample.model.Store
import com.google.maps.android.testing.sample.ui.main.MainScreenUiState.Success
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.catch
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
-->

<resources>
<string name="app_name">AndroidMapsRobolectric</string>
<string name="app_name">Maps Testing Sample</string>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@

<resources>

<style name="Theme.AndroidMapsRobolectric" parent="android:Theme.Material.Light.NoActionBar" />
<style name="Theme.MapsTestingSample" parent="android:Theme.Material.Light.NoActionBar" />
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.example.androidmapsrobolectric
package com.google.maps.android.testing.sample

import android.graphics.Color
import com.google.android.gms.maps.CameraUpdateFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.example.androidmapsrobolectric;
package com.google.maps.android.testing.sample;

import static com.google.common.truth.Truth.assertThat;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
* limitations under the License.
*/

package com.example.androidmapsrobolectric.manager
package com.google.maps.android.testing.sample.manager

import com.example.androidmapsrobolectric.model.Store
import com.google.android.gms.maps.CameraUpdateFactory
import com.google.android.gms.maps.GoogleMap
import com.google.android.gms.maps.model.LatLng
Expand All @@ -40,6 +39,7 @@ import com.google.maps.android.robolectric.truth.assertThat
import com.google.maps.android.robolectric.truth.distanceTo
import com.google.maps.android.robolectric.truth.kilometers
import com.google.maps.android.robolectric.truth.meters
import com.google.maps.android.testing.sample.model.Store
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
Expand Down
Loading
Loading