Skip to content

Commit 175fee3

Browse files
authored
Merge pull request #1075 from google/ben/compose1.2alpha5
Compose 1.2.0-alpha05
2 parents b9a44ab + 182891b commit 175fee3

File tree

8 files changed

+51
-20
lines changed

8 files changed

+51
-20
lines changed

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ systemProp.org.gradle.internal.http.socketTimeout=120000
3333

3434
GROUP=com.google.accompanist
3535
# !! No longer need to update this manually when using a Compose SNAPSHOT
36-
VERSION_NAME=0.24.4-SNAPSHOT
36+
VERSION_NAME=0.24.4-alpha
3737

3838
POM_DESCRIPTION=Utilities for Jetpack Compose
3939

gradle/libs.versions.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[versions]
2-
compose = "1.2.0-alpha04"
2+
compose = "1.2.0-alpha05"
33
composesnapshot = "-" # a single character = no snapshot
44

55
# gradlePlugin and lint need to be updated together
6-
gradlePlugin = "7.1.1"
6+
gradlePlugin = "7.1.2"
77
lint = "30.0.3"
88

99
ktlint = "0.42.1"
1010
kotlin = "1.6.10"
11-
coroutines = "1.5.2"
11+
coroutines = "1.6.0"
1212
okhttp = "3.12.13"
1313
coil = "1.3.2"
1414

navigation-material/src/androidTest/java/com/google/accompanist/navigation.material/SheetContentHostTest.kt

+5-11
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import androidx.compose.runtime.mutableStateOf
3131
import androidx.compose.runtime.saveable.rememberSaveableStateHolder
3232
import androidx.compose.ui.Modifier
3333
import androidx.compose.ui.platform.testTag
34-
import androidx.compose.ui.test.TestMonotonicFrameClock
3534
import androidx.compose.ui.test.junit4.ComposeContentTestRule
3635
import androidx.compose.ui.test.junit4.createComposeRule
3736
import androidx.compose.ui.test.onNodeWithTag
@@ -43,11 +42,9 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
4342
import androidx.test.filters.LargeTest
4443
import com.google.common.truth.Truth.assertThat
4544
import com.google.common.truth.Truth.assertWithMessage
46-
import kotlinx.coroutines.CoroutineScope
4745
import kotlinx.coroutines.ExperimentalCoroutinesApi
4846
import kotlinx.coroutines.runBlocking
49-
import kotlinx.coroutines.test.TestCoroutineDispatcher
50-
import kotlinx.coroutines.test.runBlockingTest
47+
import kotlinx.coroutines.test.runTest
5148
import org.junit.Rule
5249
import org.junit.Test
5350
import org.junit.runner.RunWith
@@ -60,16 +57,13 @@ import org.junit.runner.RunWith
6057
ExperimentalMaterialNavigationApi::class
6158
)
6259
internal class SheetContentHostTest {
63-
64-
private val testDispatcher = TestCoroutineDispatcher()
65-
private val testClock = TestMonotonicFrameClock(CoroutineScope(testDispatcher))
6660
private val bodyContentTag = "testBodyContent"
6761

6862
@get:Rule
6963
val composeTestRule = createComposeRule()
7064

7165
@Test
72-
fun testSheetShownAndHidden() = runBlockingTest {
66+
fun testSheetShownAndHidden() = runTest {
7367
val backStackEntryState = mutableStateOf<NavBackStackEntry?>(null)
7468
val sheetState = ModalBottomSheetState(ModalBottomSheetValue.Hidden)
7569

@@ -94,7 +88,7 @@ internal class SheetContentHostTest {
9488
}
9589

9690
@Test
97-
fun testOnSheetDismissedCalled_ManualDismiss() = runBlockingTest(testClock) {
91+
fun testOnSheetDismissedCalled_ManualDismiss() = runTest {
9892
val sheetState = ModalBottomSheetState(ModalBottomSheetValue.Hidden)
9993
val backStackEntry = createBackStackEntry(sheetState)
10094

@@ -119,7 +113,7 @@ internal class SheetContentHostTest {
119113
}
120114

121115
@Test
122-
fun testOnSheetDismissedCalled_initiallyExpanded() = runBlockingTest(testClock) {
116+
fun testOnSheetDismissedCalled_initiallyExpanded() = runTest {
123117
val sheetState = ModalBottomSheetState(ModalBottomSheetValue.Expanded)
124118
val backStackEntry = createBackStackEntry(sheetState)
125119

@@ -144,7 +138,7 @@ internal class SheetContentHostTest {
144138
}
145139

146140
@Test
147-
fun testOnSheetShownCalled_onBackStackEntryEnter() = runBlockingTest(testClock) {
141+
fun testOnSheetShownCalled_onBackStackEntryEnter() = runTest {
148142
val sheetState = ModalBottomSheetState(ModalBottomSheetValue.Hidden)
149143
val backStackEntryState = mutableStateOf<NavBackStackEntry?>(null)
150144
val shownBackStackEntries = mutableListOf<NavBackStackEntry>()

pager/src/sharedTest/kotlin/com/google/accompanist/pager/PagerStateUnitTest.kt

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class PagerStateUnitTest {
4040

4141
@OptIn(ExperimentalCoroutinesApi::class)
4242
@Ignore // Not currently working after migration to Lazy
43+
@Suppress("DEPRECATION")
4344
@Test
4445
fun store_restore_state() = runBlockingTest {
4546
val stateRestoration = StateRestorationTester(composeTestRule)

permissions/src/androidTest/AndroidManifest.xml

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,14 @@
2121
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
2222

2323
<application>
24-
2524
<activity
2625
android:name=".PermissionsTestActivity"
2726
android:exported="true"
2827
android:theme="@android:style/Theme.Material.NoActionBar" />
28+
<activity
29+
android:name=".EmptyPermissionsTestActivity"
30+
android:exported="true"
31+
android:theme="@android:style/Theme.Material.NoActionBar" />
2932
</application>
3033

3134
</manifest>

permissions/src/androidTest/java/com/google/accompanist/permissions/MultiplePermissionsStateTest.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package com.google.accompanist.permissions
1919
import androidx.compose.ui.test.junit4.createAndroidComposeRule
2020
import androidx.test.filters.SdkSuppress
2121
import androidx.test.rule.GrantPermissionRule
22-
import com.google.accompanist.permissions.test.PermissionsTestActivity
22+
import com.google.accompanist.permissions.test.EmptyPermissionsTestActivity
2323
import com.google.common.truth.Truth.assertThat
2424
import org.junit.Rule
2525
import org.junit.Test
@@ -32,7 +32,7 @@ import org.junit.Test
3232
class MultiplePermissionsStateTest {
3333

3434
@get:Rule
35-
val composeTestRule = createAndroidComposeRule<PermissionsTestActivity>()
35+
val composeTestRule = createAndroidComposeRule<EmptyPermissionsTestActivity>()
3636

3737
@get:Rule
3838
val permissionRule: GrantPermissionRule = GrantPermissionRule.grant(

permissions/src/androidTest/java/com/google/accompanist/permissions/PermissionStateTest.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package com.google.accompanist.permissions
1919
import androidx.compose.ui.test.junit4.createAndroidComposeRule
2020
import androidx.test.filters.SdkSuppress
2121
import androidx.test.rule.GrantPermissionRule
22-
import com.google.accompanist.permissions.test.PermissionsTestActivity
22+
import com.google.accompanist.permissions.test.EmptyPermissionsTestActivity
2323
import com.google.common.truth.Truth.assertThat
2424
import org.junit.Rule
2525
import org.junit.Test
@@ -32,7 +32,7 @@ import org.junit.Test
3232
class PermissionStateTest {
3333

3434
@get:Rule
35-
val composeTestRule = createAndroidComposeRule<PermissionsTestActivity>()
35+
val composeTestRule = createAndroidComposeRule<EmptyPermissionsTestActivity>()
3636

3737
@get:Rule
3838
val permissionRule: GrantPermissionRule =
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright 2022 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.accompanist.permissions.test
18+
19+
import androidx.activity.ComponentActivity
20+
import com.google.accompanist.permissions.ExperimentalPermissionsApi
21+
22+
@OptIn(ExperimentalPermissionsApi::class)
23+
class EmptyPermissionsTestActivity : ComponentActivity() {
24+
25+
var shouldShowRequestPermissionRationale: Map<String, Boolean> = emptyMap()
26+
27+
override fun shouldShowRequestPermissionRationale(permission: String): Boolean {
28+
if (permission in shouldShowRequestPermissionRationale.keys) {
29+
return shouldShowRequestPermissionRationale[permission]!!
30+
}
31+
return super.shouldShowRequestPermissionRationale(permission)
32+
}
33+
}

0 commit comments

Comments
 (0)