Skip to content
Draft
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
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,24 @@ Google reference devices (Pixels etc.) use their `id:` values automatically in c
@Preview(name = "Pixel 8", device = Google.PIXEL_8)
```

### Preview Groups (New!)

For comprehensive testing across entire device brands, use Preview Groups:

```kotlin
import se.premex.compose.preview.groups.PreviewGroups

// Get all Zebra devices programmatically
val zebraDevices = PreviewGroups.getZebraDevices()

// Access devices by category
import se.premex.compose.preview.groups.ZebraPreviewGroup
val handhelds = ZebraPreviewGroup.Categories.handhelds // MC series
val tablets = ZebraPreviewGroup.Categories.tablets // ET series
```

Perfect for enterprise apps targeting specific device fleets. See [Preview Groups documentation](android-compose-preview-ext/src/main/kotlin/se/premex/compose/preview/groups/README.md) for detailed usage examples.

## Supported Devices
A regenerated catalog lives here: [docs/devices/README.md](docs/devices/README.md). (If the link is empty, run the generator locally.)

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
// Generated Zebra Preview Group utility. Categories=6, Devices=76
package se.premex.compose.preview.groups

import kotlin.String
import kotlin.collections.List
import se.premex.compose.preview.device.catalog.android.Zebra

/**
* Zebra device preview group providing categorized access to Zebra's enterprise device catalog.
*
* This utility organizes 76 Zebra devices into logical categories based on their intended use
* cases,
* making it easier to target specific device types for enterprise application testing.
*/
public object ZebraPreviewGroup {
/**
* Device categories organized by Zebra product lines and use cases.
*/
public object Categories {
/**
* Mobile computers and handheld scanners (MC series) (11 devices)
*/
public val handhelds: List<String> = listOf(
Zebra.MC2200,
Zebra.MC2700,
Zebra.MC33,
Zebra.MC3300X,
Zebra.MC3300XC,
Zebra.MC33C,
Zebra.MC3400,
Zebra.MC93,
Zebra.MC93C,
Zebra.MC9400,
Zebra.MC9450
)

/**
* Touch computers and mobile devices (TC series) (35 devices)
*/
public val touchComputers: List<String> = listOf(
Zebra.TC15,
Zebra.TC20KB,
Zebra.TC20RD,
Zebra.TC20RT,
Zebra.TC21,
Zebra.TC22,
Zebra.TC25FM,
Zebra.TC26,
Zebra.TC27,
Zebra.TC51,
Zebra.TC51HC,
Zebra.TC52,
Zebra.TC52X,
Zebra.TC53,
Zebra.TC53E,
Zebra.TC55,
Zebra.TC56,
Zebra.TC57,
Zebra.TC57X,
Zebra.TC58,
Zebra.TC58E,
Zebra.TC70,
Zebra.TC70X,
Zebra.TC72,
Zebra.TC73,
Zebra.TC73T,
Zebra.TC75,
Zebra.TC75X,
Zebra.TC75XDF,
Zebra.TC77,
Zebra.TC78,
Zebra.TC78T,
Zebra.TC8000,
Zebra.TC83B0,
Zebra.TC83BH
)

/**
* Enterprise tablets (ET series) (15 devices)
*/
public val tablets: List<String> = listOf(
Zebra.ET40L,
Zebra.ET40S,
Zebra.ET45L,
Zebra.ET45S,
Zebra.ET50E,
Zebra.ET50T,
Zebra.ET51L,
Zebra.ET51S,
Zebra.ET55E,
Zebra.ET55T,
Zebra.ET56L,
Zebra.ET56S,
Zebra.ET60,
Zebra.ET65,
Zebra.L10AW
)

/**
* Vehicle-mounted computers (VC series) (3 devices)
*/
public val vehicleComputers: List<String> = listOf(
Zebra.VC80X,
Zebra.VC8308,
Zebra.VC8310
)

/**
* Wearable computers and devices (WT series) (2 devices)
*/
public val wearables: List<String> = listOf(
Zebra.WT63B0,
Zebra.WT6400
)

/**
* Other Zebra devices (10 devices)
*/
public val others: List<String> = listOf(
Zebra.CC605LN,
Zebra.CC610LC,
Zebra.CC610PC,
Zebra.EC30RT,
Zebra.EC50,
Zebra.EC55,
Zebra.EM45,
Zebra.KC50L,
Zebra.KC50S,
Zebra.PS20JP
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package se.premex.compose.preview

import org.junit.jupiter.api.Test
import se.premex.compose.preview.device.catalog.android.Zebra
import se.premex.compose.preview.groups.PreviewGroups
import se.premex.compose.preview.groups.ZebraPreviewGroup
import kotlin.test.assertEquals
import kotlin.test.assertTrue

class UsageExamplesTest {

Expand All @@ -16,4 +19,41 @@ class UsageExamplesTest {
assertEquals("spec:width=720px,height=1280px,dpi=320", Zebra.TC26)
}

@Test
fun `preview groups example - get all Zebra devices`() {
val zebraDevices = PreviewGroups.getZebraDevices()

// Should contain all 76 Zebra devices
assertEquals(76, zebraDevices.size)

// All should be proper device specifications
zebraDevices.forEach { device ->
assertTrue(device.startsWith("spec:"), "Device spec should start with 'spec:': $device")
}
}

@Test
fun `preview groups example - device categories`() {
val handhelds = ZebraPreviewGroup.Categories.handhelds
val tablets = ZebraPreviewGroup.Categories.tablets
val touchComputers = ZebraPreviewGroup.Categories.touchComputers
val vehicleComputers = ZebraPreviewGroup.Categories.vehicleComputers

// Each category should have some devices
assertTrue(handhelds.isNotEmpty(), "Handhelds should not be empty")
assertTrue(tablets.isNotEmpty(), "Tablets should not be empty")
assertTrue(touchComputers.isNotEmpty(), "Touch computers should not be empty")
assertTrue(vehicleComputers.isNotEmpty(), "Vehicle computers should not be empty")
}

@Test
fun `preview groups example - brand selection`() {
val zebraByName = PreviewGroups.getDevicesForBrand("zebra")
val zebraByNameCaps = PreviewGroups.getDevicesForBrand("ZEBRA")
val unknownBrand = PreviewGroups.getDevicesForBrand("unknown")

assertEquals(76, zebraByName.size)
assertEquals(zebraByName, zebraByNameCaps) // Case insensitive
assertTrue(unknownBrand.isEmpty()) // Unknown brand returns empty
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package se.premex.compose.preview.groups

import org.junit.jupiter.api.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue

/**
* Simple test to verify the API works after generation.
*/
class GeneratedAPITest {

@Test
fun `basic API test`() {
// Test that we can get Zebra devices
val zebraDevices = PreviewGroups.getZebraDevices()
assertTrue(zebraDevices.isNotEmpty(), "Should have Zebra devices")

// Test brand lookup
val brandZebra = PreviewGroups.getDevicesForBrand("zebra")
assertEquals(zebraDevices, brandZebra, "Brand lookup should match direct method")

// Test supported brands
val brands = PreviewGroups.getSupportedBrands()
assertTrue(brands.contains("zebra"), "Should support zebra")
assertTrue(brands.size > 1000, "Should have many brands")

println("✅ API tests passed:")
println(" Zebra devices: ${zebraDevices.size}")
println(" Total brands: ${brands.size}")
println(" First Zebra device: ${zebraDevices.firstOrNull()}")
println(" First few brands: ${brands.take(5)}")
}

@Test
fun `zebra categories test`() {
val handhelds = ZebraPreviewGroup.Categories.handhelds
val touchComputers = ZebraPreviewGroup.Categories.touchComputers
val tablets = ZebraPreviewGroup.Categories.tablets

assertTrue(handhelds.isNotEmpty(), "Should have handhelds")
assertTrue(touchComputers.isNotEmpty(), "Should have touch computers")
assertTrue(tablets.isNotEmpty(), "Should have tablets")

println("✅ Zebra categories test passed:")
println(" Handhelds: ${handhelds.size}")
println(" Touch computers: ${touchComputers.size}")
println(" Tablets: ${tablets.size}")
println(" First handheld: ${handhelds.firstOrNull()}")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package se.premex.compose.preview.generator
import se.premex.compose.preview.generator.fetcher.DeviceFetcher
import se.premex.compose.preview.generator.generator.DeviceCatalogGenerator
import se.premex.compose.preview.generator.generator.DeviceDocsGenerator
import se.premex.compose.preview.generator.generator.PreviewGroupsGenerator
import kotlinx.coroutines.runBlocking
import java.nio.file.Path
import java.nio.file.Paths
Expand Down Expand Up @@ -36,6 +37,7 @@ class DeviceGenerator {
private val deviceFetcher = DeviceFetcher()
private val combinedGenerator = DeviceCatalogGenerator()
private val docsGenerator = DeviceDocsGenerator()
private val previewGroupsGenerator = PreviewGroupsGenerator()

// Project paths
private val projectRoot = findProjectRoot()
Expand All @@ -53,6 +55,9 @@ class DeviceGenerator {
// Generate manufacturer extension files
combinedGenerator.generate(devices, librarySourcePath)

// Generate preview groups files
previewGroupsGenerator.generate(devices, librarySourcePath)

// Generate markdown documentation for devices
docsGenerator.generate(devices, projectRoot)

Expand Down
Loading