1 /* 2 * Copyright (C) 2025 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 * http://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.android.compose.animation.scene 18 19 import androidx.compose.ui.geometry.Offset 20 import androidx.compose.ui.semantics.SemanticsNode 21 import androidx.compose.ui.unit.IntSize 22 import com.android.compose.animation.scene.DataPointTypes.scale 23 import com.android.compose.animation.scene.testing.lastAlphaForTesting 24 import com.android.compose.animation.scene.testing.lastOffsetForTesting 25 import com.android.compose.animation.scene.testing.lastScaleForTesting 26 import com.android.compose.animation.scene.testing.lastSizeForTesting 27 import platform.test.motion.compose.DataPointTypes.intSize 28 import platform.test.motion.compose.DataPointTypes.offset 29 import platform.test.motion.golden.DataPoint 30 import platform.test.motion.golden.DataPointTypes 31 import platform.test.motion.golden.FeatureCapture 32 33 /** 34 * [FeatureCapture] implementations to record animated state of [SceneTransitionLayout] [Element]. 35 */ 36 object FeatureCaptures { 37 38 val elementAlpha = <lambda>null39 FeatureCapture<SemanticsNode, Float>("alpha") { 40 DataPoint.of(it.lastAlphaForTesting, DataPointTypes.float) 41 } 42 43 val elementScale = <lambda>null44 FeatureCapture<SemanticsNode, Scale>("scale") { 45 DataPoint.of(it.lastScaleForTesting, scale) 46 } 47 48 val elementOffset = <lambda>null49 FeatureCapture<SemanticsNode, Offset>("offset") { 50 DataPoint.of(it.lastOffsetForTesting, offset) 51 } 52 53 val elementSize = <lambda>null54 FeatureCapture<SemanticsNode, IntSize>("size") { 55 DataPoint.of(it.lastSizeForTesting, intSize) 56 } 57 } 58