Skip to content

Commit

Permalink
Merge pull request #1780 from google/bumptobeta
Browse files Browse the repository at this point in the history
Raise Compose version to 1.7.0-beta04
  • Loading branch information
bentrengrove authored Aug 22, 2024
2 parents 57907e1 + 9ef8273 commit 1745adc
Show file tree
Hide file tree
Showing 18 changed files with 117 additions and 90 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
# Allow tests to continue on other devices if they fail on one device.
fail-fast: false
matrix:
api-level: [ 22, 26, 29 ]
api-level: [ 22, 26, 30 ]
shard: [ 0, 1 ] # Need to update shard-count below if this changes

env:
Expand All @@ -96,6 +96,12 @@ jobs:
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Setup java
uses: actions/setup-java@v3
with:
Expand Down Expand Up @@ -126,7 +132,7 @@ jobs:
API_LEVEL: ${{ matrix.api-level }}
run: |
ARCH="x86"
if [ "$API_LEVEL" -ge "31" ]; then
if [ "$API_LEVEL" -ge "29" ]; then
ARCH="x86_64"
fi
echo "ARCH=$ARCH" >> $GITHUB_OUTPUT
Expand Down
18 changes: 18 additions & 0 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ open class LayoutTest {
size: Ref<IntSize>,
position: Ref<Offset>,
positionedLatch: CountDownLatch
): Modifier = this then onGloballyPositioned { coordinates ->
): Modifier = onGloballyPositioned { coordinates ->
size.value = IntSize(coordinates.size.width, coordinates.size.height)
position.value = coordinates.localToRoot(Offset(0f, 0f))
positionedLatch.countDown()
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ systemProp.org.gradle.internal.http.socketTimeout=120000

GROUP=com.google.accompanist
# !! No longer need to update this manually when using a Compose SNAPSHOT
VERSION_NAME=0.35.2-SNAPSHOT
VERSION_NAME=0.35.2-beta

POM_DESCRIPTION=Utilities for Jetpack Compose

Expand Down
31 changes: 15 additions & 16 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[versions]

compose = "1.7.0-alpha02"
compose = "1.7.0-beta07"
composeCompiler = "1.5.8"
composeMaterial3 = "1.0.1"
composesnapshot = "-" # a single character = no snapshot

dokka = "1.8.10"

# gradlePlugin and lint need to be updated together
gradlePlugin = "8.2.2"
gradlePlugin = "8.5.2"
lintMinCompose = "30.0.0"

ktlint = "0.45.2"
Expand All @@ -18,8 +18,8 @@ okhttp = "3.12.13"
coil = "1.3.2"

androidlint = "25.3.0"
androidxtest = "1.4.0"
androidxnavigation = "2.7.0-alpha01"
androidxtest = "1.6.1"
androidxnavigation = "2.7.7"
androidxWindow = "1.0.0"

metalava = "0.3.2"
Expand Down Expand Up @@ -68,8 +68,8 @@ coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil" }

androidx-appcompat = "androidx.appcompat:appcompat:1.4.2"
androidx-core = "androidx.core:core-ktx:1.8.0"
androidx-activity-compose = "androidx.activity:activity-compose:1.7.2"
androidx-fragment = "androidx.fragment:fragment-ktx:1.5.1"
androidx-activity-compose = "androidx.activity:activity-compose:1.9.0"
androidx-fragment = "androidx.fragment:fragment-ktx:1.8.1"
androidx-dynamicanimation = "androidx.dynamicanimation:dynamicanimation-ktx:1.0.0-alpha03"
androidx-lifecycle-runtime = "androidx.lifecycle:lifecycle-runtime-ktx:2.6.1"
androidx-lifecycle-viewmodel-compose = "androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1"
Expand All @@ -82,19 +82,18 @@ androidx-navigation-testing = { module = "androidx.navigation:navigation-testing

mdc = "com.google.android.material:material:1.8.0"

androidx-test-core = "androidx.test:core-ktx:1.5.0-alpha02"
androidx-test-runner = "androidx.test:runner:1.5.0-alpha04"
androidx-test-core = "androidx.test:core-ktx:1.6.1"
androidx-test-runner = "androidx.test:runner:1.6.1"
androidx-test-rules = { module = "androidx.test:rules", version.ref = "androidxtest" }
androidx-test-orchestrator = "androidx.test:orchestrator:1.4.1"
androidx-test-uiAutomator = "androidx.test.uiautomator:uiautomator:2.2.0"
androidx-test-orchestrator = "androidx.test:orchestrator:1.5.0"
androidx-test-uiAutomator = "androidx.test.uiautomator:uiautomator:2.3.0"

# alpha for robolectric x compose fix
androidx-test-espressoCore = "androidx.test.espresso:espresso-core:3.5.1"
androidx-test-espressoWeb = "androidx.test.espresso:espresso-web:3.5.1"
androidx-test-espressoCore = "androidx.test.espresso:espresso-core:3.6.1"
androidx-test-espressoWeb = "androidx.test.espresso:espresso-web:3.6.1"

junit = "junit:junit:4.13.2"
truth = "com.google.truth:truth:1.1.2"
robolectric = "org.robolectric:robolectric:4.9"
truth = "com.google.truth:truth:1.1.3"
robolectric = "org.robolectric:robolectric:4.12.1"

affectedmoduledetector = "com.dropbox.affectedmoduledetector:affectedmoduledetector:0.1.2"

Expand All @@ -103,7 +102,7 @@ android-tools-lint-lint = { module = "com.android.tools.lint:lint", version.ref
android-tools-lint-api = { module = "com.android.tools.lint:lint-api", version.ref = "lintMinCompose" }
android-tools-lint-tests = { module = "com.android.tools.lint:lint-tests", version.ref = "lintMinCompose" }

squareup-mockwebserver = "com.squareup.okhttp3:mockwebserver:4.9.3"
squareup-mockwebserver = "com.squareup.okhttp3:mockwebserver:4.10.0"

[plugins]
android-application = { id = "com.android.application", version.ref = "gradlePlugin" }
Expand Down
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Wed Jul 10 11:49:25 AEST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.State
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveableStateHolder
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.onPlaced
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.test.junit4.ComposeContentTestRule
import androidx.compose.ui.test.junit4.createComposeRule
Expand Down Expand Up @@ -174,10 +178,8 @@ internal class SheetContentHostTest {
onSheetDismissed: (NavBackStackEntry) -> Unit
) {
setContent {
var anchored by remember { mutableStateOf(false) }
val saveableStateHolder = rememberSaveableStateHolder()
LaunchedEffect(backStackEntry.value) {
if (backStackEntry.value == null) sheetState.hide() else sheetState.show()
}
ModalBottomSheetLayout(
sheetContent = {
SheetContentHost(
Expand All @@ -189,6 +191,7 @@ internal class SheetContentHostTest {
)
},
sheetState = sheetState,
modifier = Modifier.onPlaced { anchored = true },
content = {
Box(
Modifier
Expand All @@ -197,6 +200,12 @@ internal class SheetContentHostTest {
)
}
)

if (anchored) {
LaunchedEffect(backStackEntry.value) {
if (backStackEntry.value == null) sheetState.hide() else sheetState.show()
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion permissions/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application>
<activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class MultipleAndSinglePermissionsTest {
composeTestRule.setContent {
ComposableUnderTest(
listOf(
android.Manifest.permission.READ_EXTERNAL_STORAGE,
android.Manifest.permission.ACCESS_FINE_LOCATION,
android.Manifest.permission.CAMERA
)
)
Expand All @@ -181,7 +181,7 @@ class MultipleAndSinglePermissionsTest {
composeTestRule.setContent {
ComposableUnderTest(
listOf(
android.Manifest.permission.READ_EXTERNAL_STORAGE,
android.Manifest.permission.ACCESS_FINE_LOCATION,
android.Manifest.permission.CAMERA
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ class MultiplePermissionsStateTest {
@get:Rule
val permissionRule: GrantPermissionRule = GrantPermissionRule.grant(
"android.permission.CAMERA",
"android.permission.READ_EXTERNAL_STORAGE"
"android.permission.ACCESS_FINE_LOCATION"
)

@Test
fun permissionState_hasPermission() {
composeTestRule.setContent {
val state = rememberMultiplePermissionsState(
listOf(
android.Manifest.permission.READ_EXTERNAL_STORAGE,
android.Manifest.permission.ACCESS_FINE_LOCATION,
android.Manifest.permission.CAMERA
)
)
Expand All @@ -65,7 +65,7 @@ class MultiplePermissionsStateTest {
val state = rememberMultiplePermissionsState(
listOf(
android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
android.Manifest.permission.READ_EXTERNAL_STORAGE,
android.Manifest.permission.ACCESS_FINE_LOCATION,
android.Manifest.permission.CAMERA
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class PermissionStateTest {

@Test
fun permissionTest_shouldShowRationale() {
val permission = android.Manifest.permission.WRITE_EXTERNAL_STORAGE
val permission = android.Manifest.permission.ACCESS_FINE_LOCATION
composeTestRule.activity.shouldShowRequestPermissionRationale = mapOf(
permission to true
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class RequestMultiplePermissionsTest {
// This is cheating, I know, but the order in which the system request the permissions
// is unpredictable. Therefore, we need to grant both to make this test deterministic.
grantPermissionProgrammatically("android.permission.CAMERA")
grantPermissionProgrammatically("android.permission.READ_EXTERNAL_STORAGE")
grantPermissionProgrammatically("android.permission.ACCESS_FINE_LOCATION")
simulateAppComingFromTheBackground(composeTestRule)
composeTestRule.activityRule.scenario.onActivity {
it.setContent { ComposableUnderTest() }
Expand All @@ -119,7 +119,7 @@ class RequestMultiplePermissionsTest {
private fun ComposableUnderTest() {
val state = rememberMultiplePermissionsState(
listOf(
android.Manifest.permission.READ_EXTERNAL_STORAGE,
android.Manifest.permission.ACCESS_FINE_LOCATION,
android.Manifest.permission.CAMERA
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class RequestPermissionTest {
composeTestRule.onNodeWithText("No permission").assertIsDisplayed()
}

@SdkSuppress(minSdkVersion = 29) // Flaky below
@FlakyTest
@Test
fun permissionTest_grantInTheBackground() {
Expand All @@ -86,12 +87,14 @@ class RequestPermissionTest {
composeTestRule.onNodeWithText("No permission").assertIsDisplayed()

// This simulates the user going to the Settings screen and granting the permission
grantPermissionProgrammatically("android.permission.CAMERA")
grantPermissionProgrammatically(android.Manifest.permission.CAMERA)
simulateAppComingFromTheBackground(composeTestRule)
composeTestRule.activityRule.scenario.onActivity {
it.setContent { ComposableUnderTest() }
}

composeTestRule.waitForIdle()

composeTestRule.onNodeWithText("Granted").assertIsDisplayed()
}

Expand Down
Loading

0 comments on commit 1745adc

Please sign in to comment.