From 116a93c0f40948b5e2d95f84ba89926161c82151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Alc=C3=A9rreca?= Date: Thu, 14 Oct 2021 14:32:06 +0000 Subject: [PATCH 1/5] Updates to Compose 1.0.4 and Kotlin 1.5.31 --- gradle/libs.versions.toml | 4 ++-- .../permissions/lint/PermissionsLaunchDetectorTest.kt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5f251d4e3..9459cbf83 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -compose = "1.0.3" +compose = "1.0.4" composesnapshot = "-" # a single character = no snapshot # gradlePlugin and lint need to be updated together @@ -7,7 +7,7 @@ gradlePlugin = "7.0.2" lint = "30.0.2" ktlint = "0.42.1" -kotlin = "1.5.30" +kotlin = "1.5.31" coroutines = "1.5.2" okhttp = "3.12.13" coil = "1.3.2" diff --git a/permissions-lint/src/test/java/com/google/accompanist/permissions/lint/PermissionsLaunchDetectorTest.kt b/permissions-lint/src/test/java/com/google/accompanist/permissions/lint/PermissionsLaunchDetectorTest.kt index 9b9f7bb0d..fc10f3a65 100644 --- a/permissions-lint/src/test/java/com/google/accompanist/permissions/lint/PermissionsLaunchDetectorTest.kt +++ b/permissions-lint/src/test/java/com/google/accompanist/permissions/lint/PermissionsLaunchDetectorTest.kt @@ -40,6 +40,7 @@ internal class PermissionsLaunchDetectorTest { ComposableStub, TestFiles.kt(fileToAdd) ) + .allowMissingSdk() .issues(PermissionsLaunchDetector.PermissionLaunchedDuringComposition) .run() } From 2a5154848376a23011df9c7aab24f2eb41507784 Mon Sep 17 00:00:00 2001 From: Nick Butcher Date: Mon, 4 Oct 2021 12:59:35 +0100 Subject: [PATCH 2/5] Fix tests for performGesture changes. --- .../com/google/accompanist/insets/ScaffoldTest.kt | 10 +++++----- .../pager/HorizontalPagerScrollingContentTest.kt | 2 +- .../kotlin/com/google/accompanist/pager/TestUtils.kt | 5 ++--- .../pager/VerticalPagerScrollingContentTest.kt | 2 +- .../accompanist/swiperefresh/SwipeRefreshTest.kt | 6 +++--- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/insets-ui/src/sharedTest/kotlin/com/google/accompanist/insets/ScaffoldTest.kt b/insets-ui/src/sharedTest/kotlin/com/google/accompanist/insets/ScaffoldTest.kt index 972039c2b..3c5ddf0cf 100644 --- a/insets-ui/src/sharedTest/kotlin/com/google/accompanist/insets/ScaffoldTest.kt +++ b/insets-ui/src/sharedTest/kotlin/com/google/accompanist/insets/ScaffoldTest.kt @@ -56,7 +56,7 @@ import androidx.compose.ui.test.captureToImage import androidx.compose.ui.test.junit4.ComposeContentTestRule import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithTag -import androidx.compose.ui.test.performGesture +import androidx.compose.ui.test.performTouchInput import androidx.compose.ui.test.swipeLeft import androidx.compose.ui.test.swipeRight import androidx.compose.ui.unit.Dp @@ -239,11 +239,11 @@ class ScaffoldTest { } } assertThat(drawerChildPosition.x).isLessThan(0f) - rule.onNodeWithTag(scaffoldTag).performGesture { + rule.onNodeWithTag(scaffoldTag).performTouchInput { swipeRight() } assertThat(drawerChildPosition.x).isLessThan(0f) - rule.onNodeWithTag(scaffoldTag).performGesture { + rule.onNodeWithTag(scaffoldTag).performTouchInput { swipeLeft() } assertThat(drawerChildPosition.x).isLessThan(0f) @@ -252,11 +252,11 @@ class ScaffoldTest { drawerGesturedEnabledState.value = true } - rule.onNodeWithTag(scaffoldTag).performGesture { + rule.onNodeWithTag(scaffoldTag).performTouchInput { swipeRight() } assertThat(drawerChildPosition.x).isEqualTo(0f) - rule.onNodeWithTag(scaffoldTag).performGesture { + rule.onNodeWithTag(scaffoldTag).performTouchInput { swipeLeft() } assertThat(drawerChildPosition.x).isLessThan(0f) diff --git a/pager/src/sharedTest/kotlin/com/google/accompanist/pager/HorizontalPagerScrollingContentTest.kt b/pager/src/sharedTest/kotlin/com/google/accompanist/pager/HorizontalPagerScrollingContentTest.kt index 4ea262c78..9c6077aaa 100644 --- a/pager/src/sharedTest/kotlin/com/google/accompanist/pager/HorizontalPagerScrollingContentTest.kt +++ b/pager/src/sharedTest/kotlin/com/google/accompanist/pager/HorizontalPagerScrollingContentTest.kt @@ -81,7 +81,7 @@ class HorizontalPagerScrollingContentTest { // Perform a very quick, high velocity scroll which will scroll the inner content to it's // opposite/end edge rule.onNodeWithTag(TestTag) - .swipeAcrossCenterWithVelocity(velocityPerSec = 5_000.dp, distancePercentageX = -0.5f) + .swipeAcrossCenterWithVelocity(velocityPerSec = 2_000.dp, distancePercentageX = -0.5f) // Wait for the flings to end rule.waitForIdle() diff --git a/pager/src/sharedTest/kotlin/com/google/accompanist/pager/TestUtils.kt b/pager/src/sharedTest/kotlin/com/google/accompanist/pager/TestUtils.kt index d56d6d5ce..784884d31 100644 --- a/pager/src/sharedTest/kotlin/com/google/accompanist/pager/TestUtils.kt +++ b/pager/src/sharedTest/kotlin/com/google/accompanist/pager/TestUtils.kt @@ -22,8 +22,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.test.SemanticsNodeInteraction import androidx.compose.ui.test.junit4.ComposeContentTestRule -import androidx.compose.ui.test.percentOffset -import androidx.compose.ui.test.performGesture +import androidx.compose.ui.test.performTouchInput import androidx.compose.ui.test.swipe import androidx.compose.ui.test.swipeWithVelocity import androidx.compose.ui.unit.Dp @@ -49,7 +48,7 @@ internal fun SemanticsNodeInteraction.swipeAcrossCenterWithVelocity( velocityPerSec: Dp, distancePercentageX: Float = 0f, distancePercentageY: Float = 0f, -): SemanticsNodeInteraction = performGesture { +): SemanticsNodeInteraction = performTouchInput { val startOffset = percentOffset( x = 0.5f - distancePercentageX / 2, y = 0.5f - distancePercentageY / 2 diff --git a/pager/src/sharedTest/kotlin/com/google/accompanist/pager/VerticalPagerScrollingContentTest.kt b/pager/src/sharedTest/kotlin/com/google/accompanist/pager/VerticalPagerScrollingContentTest.kt index 6e59e8273..a437e420b 100644 --- a/pager/src/sharedTest/kotlin/com/google/accompanist/pager/VerticalPagerScrollingContentTest.kt +++ b/pager/src/sharedTest/kotlin/com/google/accompanist/pager/VerticalPagerScrollingContentTest.kt @@ -80,7 +80,7 @@ class VerticalPagerScrollingContentTest { // Perform a very quick, high velocity scroll which will scroll the inner content to it's // opposite/end edge rule.onNodeWithTag(TestTag) - .swipeAcrossCenterWithVelocity(velocityPerSec = 5_000.dp, distancePercentageY = -0.5f) + .swipeAcrossCenterWithVelocity(velocityPerSec = 2_000.dp, distancePercentageY = -0.5f) // Wait for the flings to end rule.waitForIdle() diff --git a/swiperefresh/src/sharedTest/kotlin/com/google/accompanist/swiperefresh/SwipeRefreshTest.kt b/swiperefresh/src/sharedTest/kotlin/com/google/accompanist/swiperefresh/SwipeRefreshTest.kt index a7b1b4d7e..3bf555248 100644 --- a/swiperefresh/src/sharedTest/kotlin/com/google/accompanist/swiperefresh/SwipeRefreshTest.kt +++ b/swiperefresh/src/sharedTest/kotlin/com/google/accompanist/swiperefresh/SwipeRefreshTest.kt @@ -32,7 +32,7 @@ import androidx.compose.ui.test.assertIsNotDisplayed import androidx.compose.ui.test.getUnclippedBoundsInRoot import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithTag -import androidx.compose.ui.test.performGesture +import androidx.compose.ui.test.performTouchInput import androidx.compose.ui.test.swipeDown import androidx.test.ext.junit.runners.AndroidJUnit4 import com.google.common.truth.Truth.assertThat @@ -60,7 +60,7 @@ class SwipeRefreshTest { } // Swipe down on the swipe refresh - swipeRefreshNode.performGesture { swipeDown() } + swipeRefreshNode.performTouchInput { swipeDown() } // Assert that the onRefresh lambda was called once, and that we're refreshing assertThat(refreshCallCount).isEqualTo(1) @@ -116,7 +116,7 @@ class SwipeRefreshTest { val restingBounds = indicatorNode.getUnclippedBoundsInRoot() // Now swipe down. The indicator should react visually - swipeRefreshNode.performGesture { swipeDown() } + swipeRefreshNode.performTouchInput { swipeDown() } // Assert that the indicator returns back to it's 'resting' position assertThat(indicatorNode.getUnclippedBoundsInRoot()).isEqualTo(restingBounds) From 8d49a6e7a31f45fea7446605efc391a1de90b303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Alc=C3=A9rreca?= Date: Thu, 14 Oct 2021 14:38:01 +0000 Subject: [PATCH 3/5] Revert "Fix tests for performGesture changes." This reverts commit 72df5cb4f2b077895f26deee98b23b431a5da8ee. --- .../com/google/accompanist/insets/ScaffoldTest.kt | 10 +++++----- .../pager/HorizontalPagerScrollingContentTest.kt | 2 +- .../kotlin/com/google/accompanist/pager/TestUtils.kt | 5 +++-- .../pager/VerticalPagerScrollingContentTest.kt | 2 +- .../accompanist/swiperefresh/SwipeRefreshTest.kt | 6 +++--- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/insets-ui/src/sharedTest/kotlin/com/google/accompanist/insets/ScaffoldTest.kt b/insets-ui/src/sharedTest/kotlin/com/google/accompanist/insets/ScaffoldTest.kt index 3c5ddf0cf..972039c2b 100644 --- a/insets-ui/src/sharedTest/kotlin/com/google/accompanist/insets/ScaffoldTest.kt +++ b/insets-ui/src/sharedTest/kotlin/com/google/accompanist/insets/ScaffoldTest.kt @@ -56,7 +56,7 @@ import androidx.compose.ui.test.captureToImage import androidx.compose.ui.test.junit4.ComposeContentTestRule import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithTag -import androidx.compose.ui.test.performTouchInput +import androidx.compose.ui.test.performGesture import androidx.compose.ui.test.swipeLeft import androidx.compose.ui.test.swipeRight import androidx.compose.ui.unit.Dp @@ -239,11 +239,11 @@ class ScaffoldTest { } } assertThat(drawerChildPosition.x).isLessThan(0f) - rule.onNodeWithTag(scaffoldTag).performTouchInput { + rule.onNodeWithTag(scaffoldTag).performGesture { swipeRight() } assertThat(drawerChildPosition.x).isLessThan(0f) - rule.onNodeWithTag(scaffoldTag).performTouchInput { + rule.onNodeWithTag(scaffoldTag).performGesture { swipeLeft() } assertThat(drawerChildPosition.x).isLessThan(0f) @@ -252,11 +252,11 @@ class ScaffoldTest { drawerGesturedEnabledState.value = true } - rule.onNodeWithTag(scaffoldTag).performTouchInput { + rule.onNodeWithTag(scaffoldTag).performGesture { swipeRight() } assertThat(drawerChildPosition.x).isEqualTo(0f) - rule.onNodeWithTag(scaffoldTag).performTouchInput { + rule.onNodeWithTag(scaffoldTag).performGesture { swipeLeft() } assertThat(drawerChildPosition.x).isLessThan(0f) diff --git a/pager/src/sharedTest/kotlin/com/google/accompanist/pager/HorizontalPagerScrollingContentTest.kt b/pager/src/sharedTest/kotlin/com/google/accompanist/pager/HorizontalPagerScrollingContentTest.kt index 9c6077aaa..4ea262c78 100644 --- a/pager/src/sharedTest/kotlin/com/google/accompanist/pager/HorizontalPagerScrollingContentTest.kt +++ b/pager/src/sharedTest/kotlin/com/google/accompanist/pager/HorizontalPagerScrollingContentTest.kt @@ -81,7 +81,7 @@ class HorizontalPagerScrollingContentTest { // Perform a very quick, high velocity scroll which will scroll the inner content to it's // opposite/end edge rule.onNodeWithTag(TestTag) - .swipeAcrossCenterWithVelocity(velocityPerSec = 2_000.dp, distancePercentageX = -0.5f) + .swipeAcrossCenterWithVelocity(velocityPerSec = 5_000.dp, distancePercentageX = -0.5f) // Wait for the flings to end rule.waitForIdle() diff --git a/pager/src/sharedTest/kotlin/com/google/accompanist/pager/TestUtils.kt b/pager/src/sharedTest/kotlin/com/google/accompanist/pager/TestUtils.kt index 784884d31..d56d6d5ce 100644 --- a/pager/src/sharedTest/kotlin/com/google/accompanist/pager/TestUtils.kt +++ b/pager/src/sharedTest/kotlin/com/google/accompanist/pager/TestUtils.kt @@ -22,7 +22,8 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.test.SemanticsNodeInteraction import androidx.compose.ui.test.junit4.ComposeContentTestRule -import androidx.compose.ui.test.performTouchInput +import androidx.compose.ui.test.percentOffset +import androidx.compose.ui.test.performGesture import androidx.compose.ui.test.swipe import androidx.compose.ui.test.swipeWithVelocity import androidx.compose.ui.unit.Dp @@ -48,7 +49,7 @@ internal fun SemanticsNodeInteraction.swipeAcrossCenterWithVelocity( velocityPerSec: Dp, distancePercentageX: Float = 0f, distancePercentageY: Float = 0f, -): SemanticsNodeInteraction = performTouchInput { +): SemanticsNodeInteraction = performGesture { val startOffset = percentOffset( x = 0.5f - distancePercentageX / 2, y = 0.5f - distancePercentageY / 2 diff --git a/pager/src/sharedTest/kotlin/com/google/accompanist/pager/VerticalPagerScrollingContentTest.kt b/pager/src/sharedTest/kotlin/com/google/accompanist/pager/VerticalPagerScrollingContentTest.kt index a437e420b..6e59e8273 100644 --- a/pager/src/sharedTest/kotlin/com/google/accompanist/pager/VerticalPagerScrollingContentTest.kt +++ b/pager/src/sharedTest/kotlin/com/google/accompanist/pager/VerticalPagerScrollingContentTest.kt @@ -80,7 +80,7 @@ class VerticalPagerScrollingContentTest { // Perform a very quick, high velocity scroll which will scroll the inner content to it's // opposite/end edge rule.onNodeWithTag(TestTag) - .swipeAcrossCenterWithVelocity(velocityPerSec = 2_000.dp, distancePercentageY = -0.5f) + .swipeAcrossCenterWithVelocity(velocityPerSec = 5_000.dp, distancePercentageY = -0.5f) // Wait for the flings to end rule.waitForIdle() diff --git a/swiperefresh/src/sharedTest/kotlin/com/google/accompanist/swiperefresh/SwipeRefreshTest.kt b/swiperefresh/src/sharedTest/kotlin/com/google/accompanist/swiperefresh/SwipeRefreshTest.kt index 3bf555248..a7b1b4d7e 100644 --- a/swiperefresh/src/sharedTest/kotlin/com/google/accompanist/swiperefresh/SwipeRefreshTest.kt +++ b/swiperefresh/src/sharedTest/kotlin/com/google/accompanist/swiperefresh/SwipeRefreshTest.kt @@ -32,7 +32,7 @@ import androidx.compose.ui.test.assertIsNotDisplayed import androidx.compose.ui.test.getUnclippedBoundsInRoot import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithTag -import androidx.compose.ui.test.performTouchInput +import androidx.compose.ui.test.performGesture import androidx.compose.ui.test.swipeDown import androidx.test.ext.junit.runners.AndroidJUnit4 import com.google.common.truth.Truth.assertThat @@ -60,7 +60,7 @@ class SwipeRefreshTest { } // Swipe down on the swipe refresh - swipeRefreshNode.performTouchInput { swipeDown() } + swipeRefreshNode.performGesture { swipeDown() } // Assert that the onRefresh lambda was called once, and that we're refreshing assertThat(refreshCallCount).isEqualTo(1) @@ -116,7 +116,7 @@ class SwipeRefreshTest { val restingBounds = indicatorNode.getUnclippedBoundsInRoot() // Now swipe down. The indicator should react visually - swipeRefreshNode.performTouchInput { swipeDown() } + swipeRefreshNode.performGesture { swipeDown() } // Assert that the indicator returns back to it's 'resting' position assertThat(indicatorNode.getUnclippedBoundsInRoot()).isEqualTo(restingBounds) From a039063d0e9898ada054fb812feab97c74d6bf61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Alc=C3=A9rreca?= Date: Thu, 14 Oct 2021 15:20:27 +0000 Subject: [PATCH 4/5] Bumps other versions --- gradle/libs.versions.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9459cbf83..c415075d8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,14 +3,14 @@ compose = "1.0.4" composesnapshot = "-" # a single character = no snapshot # gradlePlugin and lint need to be updated together -gradlePlugin = "7.0.2" -lint = "30.0.2" +gradlePlugin = "7.0.3" +lint = "30.0.3" ktlint = "0.42.1" kotlin = "1.5.31" coroutines = "1.5.2" okhttp = "3.12.13" -coil = "1.3.2" +coil = "1.4.0" androidxtest = "1.4.0" androidxnavigation = "2.4.0-alpha10" @@ -51,7 +51,7 @@ coil-coil = { module = "io.coil-kt:coil", version.ref = "coil" } coil-gif = { module = "io.coil-kt:coil-gif", version.ref = "coil" } coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil" } -androidx-appcompat = "androidx.appcompat:appcompat:1.3.0" +androidx-appcompat = "androidx.appcompat:appcompat:1.3.1" androidx-core = "androidx.core:core-ktx:1.5.0" androidx-activity-compose = "androidx.activity:activity-compose:1.3.0" androidx-fragment = "androidx.fragment:fragment-ktx:1.3.0" From 013b89ba9856031a6a0cb4c8fa042a4b81cd517a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Alc=C3=A9rreca?= Date: Thu, 14 Oct 2021 16:11:33 +0000 Subject: [PATCH 5/5] Bumped coil too much --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c415075d8..a5f5c58b7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,7 +10,7 @@ ktlint = "0.42.1" kotlin = "1.5.31" coroutines = "1.5.2" okhttp = "3.12.13" -coil = "1.4.0" +coil = "1.3.2" androidxtest = "1.4.0" androidxnavigation = "2.4.0-alpha10"