Skip to content

Commit

Permalink
Add Row
Browse files Browse the repository at this point in the history
  • Loading branch information
gpeal committed Dec 29, 2023
1 parent 392bfe3 commit a44c4ed
Showing 1 changed file with 33 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package com.airbnb.lottie.snapshots.tests

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.size
import androidx.compose.material.Text
import androidx.compose.runtime.getValue
Expand Down Expand Up @@ -39,7 +42,7 @@ class ComposeScaleTypesTestCase : SnapshotTestCase {
{ 1f },
renderMode = renderMode,
modifier = Modifier
.size(720.dp, 1280.dp)
.size(720.dp, 1280.dp),
)
}

Expand All @@ -50,7 +53,7 @@ class ComposeScaleTypesTestCase : SnapshotTestCase {
renderMode = renderMode,
modifier = Modifier
.size(300.dp, 300.dp)
.scale(2f)
.scale(2f),
)
}

Expand All @@ -61,7 +64,7 @@ class ComposeScaleTypesTestCase : SnapshotTestCase {
renderMode = renderMode,
modifier = Modifier
.size(300.dp, 300.dp)
.scale(4f)
.scale(4f),
)
}

Expand All @@ -72,7 +75,7 @@ class ComposeScaleTypesTestCase : SnapshotTestCase {
contentScale = ContentScale.Crop,
renderMode = renderMode,
modifier = Modifier
.size(300.dp, 300.dp)
.size(300.dp, 300.dp),
)
}

Expand All @@ -83,7 +86,7 @@ class ComposeScaleTypesTestCase : SnapshotTestCase {
contentScale = ContentScale.Inside,
renderMode = renderMode,
modifier = Modifier
.size(300.dp, 300.dp)
.size(300.dp, 300.dp),
)
}

Expand All @@ -94,7 +97,7 @@ class ComposeScaleTypesTestCase : SnapshotTestCase {
contentScale = ContentScale.FillBounds,
renderMode = renderMode,
modifier = Modifier
.size(300.dp, 300.dp)
.size(300.dp, 300.dp),
)
}

Expand All @@ -106,7 +109,7 @@ class ComposeScaleTypesTestCase : SnapshotTestCase {
renderMode = renderMode,
modifier = Modifier
.size(300.dp, 300.dp)
.scale(2f)
.scale(2f),
)
}

Expand All @@ -118,7 +121,7 @@ class ComposeScaleTypesTestCase : SnapshotTestCase {
renderMode = renderMode,
modifier = Modifier
.size(300.dp, 300.dp)
.scale(2f)
.scale(2f),
)
}

Expand All @@ -129,7 +132,7 @@ class ComposeScaleTypesTestCase : SnapshotTestCase {
contentScale = ContentScale.Inside,
renderMode = renderMode,
modifier = Modifier
.size(600.dp, 600.dp)
.size(600.dp, 600.dp),
)
}

Expand All @@ -140,7 +143,7 @@ class ComposeScaleTypesTestCase : SnapshotTestCase {
contentScale = ContentScale.FillBounds,
renderMode = renderMode,
modifier = Modifier
.size(600.dp, 600.dp)
.size(600.dp, 600.dp),
)
}

Expand All @@ -151,7 +154,7 @@ class ComposeScaleTypesTestCase : SnapshotTestCase {
contentScale = ContentScale.Fit,
renderMode = renderMode,
modifier = Modifier
.size(600.dp, 600.dp)
.size(600.dp, 600.dp),
)
}

Expand All @@ -162,19 +165,19 @@ class ComposeScaleTypesTestCase : SnapshotTestCase {
contentScale = ContentScale.FillBounds,
renderMode = renderMode,
modifier = Modifier
.size(300.dp, 600.dp)
.size(300.dp, 600.dp),
)
}

val largeSquareComposition = loadCompositionFromAssetsSync("Tests/LargeSquare.json")
snapshotComposable("Compose fill max width", "Large square", renderHardwareAndSoftware = true) { renderMode ->
snapshotComposable("Compose constrained size", "Column", renderHardwareAndSoftware = true) { renderMode ->
Column(verticalArrangement = Arrangement.spacedBy(24.dp)) {
LottieAnimation(
composition = largeSquareComposition,
progress = { 1f },
contentScale = ContentScale.FillWidth,
renderMode = renderMode,
modifier = Modifier.fillMaxWidth()
modifier = Modifier.fillMaxWidth(),
)
Text(
modifier = Modifier.fillMaxWidth(),
Expand All @@ -183,5 +186,21 @@ class ComposeScaleTypesTestCase : SnapshotTestCase {
)
}
}

snapshotComposable("Compose constrained size", "Row", renderHardwareAndSoftware = true) { renderMode ->
Row(
horizontalArrangement = Arrangement.spacedBy(24.dp),
modifier = Modifier
.height(128.dp),
) {
val progress by animateLottieCompositionAsState(composition, iterations = LottieConstants.IterateForever)
LottieAnimation(
composition = largeSquareComposition,
progress = { progress },
modifier = Modifier.fillMaxHeight(),
)
Text("Other content")
}
}
}
}

0 comments on commit a44c4ed

Please sign in to comment.