Skip to content

Commit a33c495

Browse files
alexvanyoriggaroo
authored andcommitted
Updating DeviceConfigurationOverride snippet comment (#232)
(cherry picked from commit a84c80d)
1 parent 6eedaf3 commit a33c495

File tree

2 files changed

+78
-13
lines changed

2 files changed

+78
-13
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* Copyright 2024 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.example.compose.snippets.deviceconfigurationoverride
18+
19+
import androidx.compose.material3.Text
20+
import androidx.compose.ui.test.DeviceConfigurationOverride
21+
import androidx.compose.ui.test.FontScale
22+
import androidx.compose.ui.test.FontWeightAdjustment
23+
import androidx.compose.ui.test.ForcedSize
24+
import androidx.compose.ui.test.junit4.createComposeRule
25+
import androidx.compose.ui.test.then
26+
import androidx.compose.ui.unit.DpSize
27+
import androidx.compose.ui.unit.dp
28+
import com.example.compose.snippets.interop.MyScreen
29+
import org.junit.Ignore
30+
import org.junit.Rule
31+
import org.junit.Test
32+
33+
class DeviceConfigurationOverrideSnippetsTest {
34+
@get:Rule
35+
val composeTestRule = createComposeRule()
36+
37+
@Ignore("Snippet test")
38+
@Test
39+
fun forcedSize() {
40+
// [START android_compose_deviceconfigurationoverride_forcedsize]
41+
composeTestRule.setContent {
42+
DeviceConfigurationOverride(
43+
DeviceConfigurationOverride.ForcedSize(DpSize(1280.dp, 800.dp))
44+
) {
45+
MyScreen() // Will be rendered in the space for 1280dp by 800dp without clipping.
46+
}
47+
}
48+
// [END android_compose_deviceconfigurationoverride_forcedsize]
49+
}
50+
51+
@Ignore("Snippet test")
52+
@Test
53+
fun then() {
54+
// [START android_compose_deviceconfigurationoverride_then]
55+
composeTestRule.setContent {
56+
DeviceConfigurationOverride(
57+
DeviceConfigurationOverride.FontScale(1.5f) then
58+
DeviceConfigurationOverride.FontWeightAdjustment(200)
59+
) {
60+
Text(text = "text with increased scale and weight")
61+
}
62+
}
63+
// [END android_compose_deviceconfigurationoverride_then]
64+
}
65+
}

gradle/libs.versions.toml

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
[versions]
22
accompanist = "0.34.0"
33
androidGradlePlugin = "8.4.2"
4-
androidx-activity-compose = "1.9.1"
4+
androidx-activity-compose = "1.9.2"
55
androidx-appcompat = "1.7.0"
6-
androidx-compose-bom = "2024.06.00"
6+
androidx-compose-bom = "2024.09.00"
77
androidx-compose-ui-test = "1.7.0-alpha08"
88
androidx-constraintlayout = "2.1.4"
99
androidx-constraintlayout-compose = "1.0.1"
1010
androidx-coordinator-layout = "1.2.0"
1111
androidx-corektx = "1.13.1"
12-
androidx-emoji2-views = "1.4.0"
13-
androidx-fragment-ktx = "1.8.2"
12+
androidx-emoji2-views = "1.5.0"
13+
androidx-fragment-ktx = "1.8.3"
1414
androidx-glance-appwidget = "1.1.0"
15-
androidx-lifecycle-compose = "2.8.4"
16-
androidx-lifecycle-runtime-compose = "2.8.4"
17-
androidx-navigation = "2.8.0-rc01"
18-
androidx-paging = "3.3.1"
19-
androidx-test = "1.5.0"
15+
androidx-lifecycle-compose = "2.8.5"
16+
androidx-lifecycle-runtime-compose = "2.8.5"
17+
androidx-navigation = "2.8.0"
18+
androidx-paging = "3.3.2"
19+
androidx-test = "1.6.1"
2020
androidx-test-espresso = "3.5.1"
2121
androidx-window = "1.3.0"
2222
androidxHiltNavigationCompose = "1.2.0"
2323
coil = "2.6.0"
2424
# @keep
2525
compileSdk = "34"
2626
coreSplashscreen = "1.0.1"
27-
compose-latest = "1.7.0-beta06"
27+
compose-latest = "1.7.0"
2828
coroutines = "1.7.3"
2929
google-maps = "18.2.0"
3030
gradle-versions = "0.51.0"
@@ -37,8 +37,8 @@ kotlinxSerializationJson = "1.6.3"
3737
ksp = "1.8.0-1.0.9"
3838
maps-compose = "4.3.2"
3939
material = "1.4.0-beta01"
40-
material3-adaptive = "1.0.0-rc01"
41-
material3-adaptive-navigation-suite = "1.3.0-rc01"
40+
material3-adaptive = "1.0.0"
41+
material3-adaptive-navigation-suite = "1.3.0"
4242
media3 = "1.3.1"
4343
# @keep
4444
minSdk = "21"
@@ -49,7 +49,7 @@ targetSdk = "34"
4949
version-catalog-update = "0.8.3"
5050
wearComposeFoundation = "1.3.1"
5151
wearComposeMaterial = "1.3.1"
52-
composeUiTooling = "1.3.1"
52+
composeUiTooling = "1.4.0"
5353

5454
[libraries]
5555
accompanist-adaptive = { module = "com.google.accompanist:accompanist-adaptive", version.ref = "accompanist" }

0 commit comments

Comments
 (0)