Skip to content

[ai-glasses] add in projected unit tests#856

Open
trambui09 wants to merge 4 commits intoandroid:mainfrom
trambui09:tb/projected-tests
Open

[ai-glasses] add in projected unit tests#856
trambui09 wants to merge 4 commits intoandroid:mainfrom
trambui09:tb/projected-tests

Conversation

@trambui09
Copy link
Copy Markdown
Contributor

@trambui09 trambui09 commented Mar 27, 2026

Add in ProjectedTestRules coverage, testing:

  • basic projected device setup
  • projected device disconnection
  • empty capabilities

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces testing infrastructure for XR projected features, including new dependencies in the version catalog and a dedicated test class. The reviewer suggested upgrading the Mockito Kotlin version for better compatibility, renaming the test core-ktx dependency to avoid confusion with the standard core-ktx library, and ensuring the test file name matches the class name.

material3-adaptive-navigation-suite = "1.4.0"
media3 = "1.9.2"
media3Ui = "1.9.2"
mockitoKotlin = "4.1.0"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The version of mockito-kotlin being added (4.1.0) is quite outdated, released in November 2021. The latest version is 5.3.1. It's highly recommended to use a more recent version to benefit from bug fixes, new features, and improved compatibility with newer Kotlin versions.

Suggested change
mockitoKotlin = "4.1.0"
mockitoKotlin = "5.3.1"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trambui09 The version 6.3 is already out, can we switch it here? https://github.com/mockito/mockito-kotlin/releases/tag/v6.3.0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolving from conversation. will keep it to "5.3.1"

coil-kt-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil" }
compose-foundation = { module = "androidx.wear.compose:compose-foundation", version.ref = "wearComposeFoundation" }
compose-ui-tooling = { module = "androidx.wear.compose:compose-ui-tooling", version.ref = "composeUiTooling" }
core-ktx = { module = "androidx.test:core-ktx", version.ref = "coreKtx" }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The alias core-ktx for androidx.test:core-ktx can be easily confused with the existing androidx-core-ktx alias for androidx.core:core-ktx. To improve clarity and prevent potential mix-ups, consider a more descriptive name for the test dependency, such as androidx-test-core-ktx.

This would involve:

  1. Renaming the version alias on line 48 from coreKtx to something like androidxTestCoreKtx.
  2. Renaming this library alias to androidx-test-core-ktx and updating its version.ref.
  3. Updating xr/build.gradle.kts to use libs.androidx.test.core.ktx.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trambui09 Can you address this one?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been addressed.

@RunWith(AndroidJUnit4::class)
@Config(sdk = [Build.VERSION_CODES.UPSIDE_DOWN_CAKE])
@OptIn(ExperimentalProjectedApi::class)
class ProjectedFeatureTest {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The class name is ProjectedFeatureTest, but the file name is ProjectedFeatureTests.kt. According to Kotlin coding conventions, the file name should usually match the name of the top-level class it contains. Consider renaming the file to ProjectedFeatureTest.kt for consistency.

@trambui09 trambui09 changed the title add in projected unit tests [ai-glasses] add in projected unit tests Mar 28, 2026
@trambui09 trambui09 force-pushed the tb/projected-tests branch from 8a0f973 to 9743407 Compare March 28, 2026 00:10
@trambui09 trambui09 marked this pull request as ready for review March 30, 2026 16:16
@trambui09 trambui09 requested review from a team, kkuan2011 and yrezgui as code owners March 30, 2026 16:16
@snippet-bot
Copy link
Copy Markdown

snippet-bot bot commented Mar 30, 2026

Here is the summary of changes.

You are about to add 3 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@trambui09 trambui09 force-pushed the tb/projected-tests branch from 9a61daf to e857d2e Compare March 30, 2026 16:17
Copy link
Copy Markdown
Contributor

@kkuan2011 kkuan2011 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from snippets repo perspective

Copy link
Copy Markdown
Contributor

@vad710 vad710 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments in the internal doc. Mostly around null and connection state checks.

@polpetta86
Copy link
Copy Markdown

Hello everyone,

First of all, I'd like to express my appreciation for the outstanding work you have done — it is much valued.

I would like to kindly ask whether it would be possible to provide some basic documentation on the simulator configuration. I have been able to compile the code without issues, however I am unable to obtain any results within the simulator and I believe some configuration steps may be missing on my end.

Thank you in advance for any support you can offer.

@yrezgui yrezgui enabled auto-merge (squash) April 2, 2026 11:40
@trambui09 trambui09 requested a review from vad710 April 2, 2026 16:06
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.

5 participants