Removal of Px usages part 5 of n
Relnote: "Replaced usage of Px class in various
compose classes as part of the large
refactoring effort to only rely on Dp
and primitive types for pixel parameters"
Bug: 156681014
Test: re-ran compose tests
Change-Id: Id343458210b56a9a4cdae4ef3d0f97ea79004942
diff --git a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/text/ParagraphMethodBenchmark.kt b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/text/ParagraphMethodBenchmark.kt
index 0c211b1..f26c660 100644
--- a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/text/ParagraphMethodBenchmark.kt
+++ b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/text/ParagraphMethodBenchmark.kt
@@ -21,7 +21,6 @@
import androidx.test.filters.LargeTest
import androidx.ui.unit.Density
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import androidx.ui.unit.sp
import androidx.ui.integration.test.RandomTextGenerator
import androidx.ui.integration.test.TextBenchmarkTestRule
@@ -165,7 +164,7 @@
fun getOffsetForPosition() {
textBenchmarkRule.generator { generator ->
val paragraph = paragraph(generator)
- val centerPosition = PxPosition((paragraph.width / 2).px, (paragraph.height / 2).px)
+ val centerPosition = PxPosition((paragraph.width / 2), (paragraph.height / 2))
benchmarkRule.measureRepeated {
paragraph.getOffsetForPosition(centerPosition)
}
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/AnimatableSeekBarDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/AnimatableSeekBarDemo.kt
index 526b28e..3adf558 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/AnimatableSeekBarDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/AnimatableSeekBarDemo.kt
@@ -99,13 +99,13 @@
val dragObserver = object : DragObserver {
override fun onDrag(dragDistance: PxPosition): PxPosition {
- animValue.snapTo(animValue.targetValue + dragDistance.x.value)
+ animValue.snapTo(animValue.targetValue + dragDistance.x)
return dragDistance
}
}
val onPress: (PxPosition) -> Unit = { position ->
- animValue.animateTo(position.x.value,
+ animValue.animateTo(position.x,
TweenBuilder<Float>().apply {
duration = 400
})
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/FancyScrollingDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/FancyScrollingDemo.kt
index b1c28da..5d4356d 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/FancyScrollingDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/FancyScrollingDemo.kt
@@ -55,7 +55,7 @@
val gesture = Modifier.rawDragGestureFilter(dragObserver = object : DragObserver {
override fun onDrag(dragDistance: PxPosition): PxPosition {
// Snap to new drag position
- animScroll.snapTo(animScroll.value + dragDistance.x.value)
+ animScroll.snapTo(animScroll.value + dragDistance.x)
return dragDistance
}
@@ -64,7 +64,7 @@
// Uses default decay animation to calculate where the fling will settle,
// and adjust that position as needed. The target animation will be used for
// animating to the adjusted target.
- animScroll.fling(velocity.x.value, adjustTarget = { target ->
+ animScroll.fling(velocity.x, adjustTarget = { target ->
// Adjust the target position to center align the item
val animation = PhysicsBuilder<Float>(dampingRatio = 2.0f, stiffness = 100f)
var rem = target % itemWidth.value
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SpringBackScrollingDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SpringBackScrollingDemo.kt
index 4fb5d83..128778a 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SpringBackScrollingDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SpringBackScrollingDemo.kt
@@ -55,13 +55,13 @@
val isFlinging = state { false }
val gesture = Modifier.rawDragGestureFilter(dragObserver = object : DragObserver {
override fun onDrag(dragDistance: PxPosition): PxPosition {
- animScroll.snapTo(animScroll.targetValue + dragDistance.x.value)
+ animScroll.snapTo(animScroll.targetValue + dragDistance.x)
return dragDistance
}
override fun onStop(velocity: PxPosition) {
isFlinging.value = true
- animScroll.fling(velocity.x.value, _, _, _ ->
+ animScroll.fling(velocity.x, _, _, _ ->
isFlinging.value = false
})
}
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateBasedRippleDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateBasedRippleDemo.kt
index 1218d2a..800f557 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateBasedRippleDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateBasedRippleDemo.kt
@@ -50,8 +50,8 @@
val toState = state { ButtonStatus.Initial }
val rippleTransDef = remember { createTransDef(radius) }
val onPress: (PxPosition) -> Unit = { position ->
- down.x = position.x.value
- down.y = position.y.value
+ down.x = position.x
+ down.y = position.y
toState.value = ButtonStatus.Pressed
}
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SwipeToDismissDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SwipeToDismissDemo.kt
index 01d75cd..91df541 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SwipeToDismissDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SwipeToDismissDemo.kt
@@ -84,7 +84,7 @@
}
override fun onDrag(dragDistance: PxPosition): PxPosition {
- itemBottom.snapTo(itemBottom.targetValue + dragDistance.y.value)
+ itemBottom.snapTo(itemBottom.targetValue + dragDistance.y)
return dragDistance
}
@@ -107,9 +107,9 @@
override fun onStop(velocity: PxPosition) {
isFlinging.value = true
- itemBottom.fling(velocity.y.value,
+ itemBottom.fling(velocity.y,
ExponentialDecay(3.0f),
- adjustTarget(velocity.y.value),
+ adjustTarget(velocity.y),
endReason, final, _ ->
isFlinging.value = false
if (endReason != AnimationEndReason.Interrupted && final == 0f) {
diff --git a/ui/ui-animation/src/main/java/androidx/ui/animation/PropertyKeys.kt b/ui/ui-animation/src/main/java/androidx/ui/animation/PropertyKeys.kt
index e985914..03c260c 100644
--- a/ui/ui-animation/src/main/java/androidx/ui/animation/PropertyKeys.kt
+++ b/ui/ui-animation/src/main/java/androidx/ui/animation/PropertyKeys.kt
@@ -183,8 +183,8 @@
*/
val PxPositionToVectorConverter: TwoWayConverter<PxPosition, AnimationVector2D> =
TwoWayConverter(
- convertToVector = { AnimationVector2D(it.x.value, it.y.value) },
- convertFromVector = { PxPosition(it.v1.px, it.v2.px) }
+ convertToVector = { AnimationVector2D(it.x, it.y) },
+ convertFromVector = { PxPosition(it.v1, it.v2) }
)
/**
diff --git a/ui/ui-animation/src/test/java/androidx/ui/animation/ConverterTest.kt b/ui/ui-animation/src/test/java/androidx/ui/animation/ConverterTest.kt
index c3445c1..cc245b4 100644
--- a/ui/ui-animation/src/test/java/androidx/ui/animation/ConverterTest.kt
+++ b/ui/ui-animation/src/test/java/androidx/ui/animation/ConverterTest.kt
@@ -73,9 +73,9 @@
fun testPxPositionConverter() {
val x = Random.nextFloat()
val y = Random.nextFloat()
- assertEquals(PxPosition(x.px, y.px),
+ assertEquals(PxPosition(x, y),
PxPositionToVectorConverter.convertFromVector(AnimationVector2D(x, y)))
assertEquals(AnimationVector2D(x, y),
- PxPositionToVectorConverter.convertToVector(PxPosition(x.px, y.px)))
+ PxPositionToVectorConverter.convertToVector(PxPosition(x, y)))
}
}
\ No newline at end of file
diff --git a/ui/ui-core/api/0.1.0-dev14.txt b/ui/ui-core/api/0.1.0-dev14.txt
index 58c582b..1151dec 100644
--- a/ui/ui-core/api/0.1.0-dev14.txt
+++ b/ui/ui-core/api/0.1.0-dev14.txt
@@ -769,7 +769,7 @@
method public static boolean changedToUpIgnoreConsumed(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumeAllChanges(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumeDownChange(androidx.ui.core.PointerInputChange);
- method public static androidx.ui.core.PointerInputChange consumePositionChange-3EnrK0w(androidx.ui.core.PointerInputChange, float consumedDx, float consumedDy);
+ method public static androidx.ui.core.PointerInputChange consumePositionChange(androidx.ui.core.PointerInputChange, float consumedDx, float consumedDy);
method public static androidx.ui.unit.PxPosition positionChange(androidx.ui.core.PointerInputChange);
method public static androidx.ui.unit.PxPosition positionChangeIgnoreConsumed(androidx.ui.core.PointerInputChange);
method public static boolean positionChanged(androidx.ui.core.PointerInputChange);
diff --git a/ui/ui-core/api/current.txt b/ui/ui-core/api/current.txt
index 58c582b..1151dec 100644
--- a/ui/ui-core/api/current.txt
+++ b/ui/ui-core/api/current.txt
@@ -769,7 +769,7 @@
method public static boolean changedToUpIgnoreConsumed(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumeAllChanges(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumeDownChange(androidx.ui.core.PointerInputChange);
- method public static androidx.ui.core.PointerInputChange consumePositionChange-3EnrK0w(androidx.ui.core.PointerInputChange, float consumedDx, float consumedDy);
+ method public static androidx.ui.core.PointerInputChange consumePositionChange(androidx.ui.core.PointerInputChange, float consumedDx, float consumedDy);
method public static androidx.ui.unit.PxPosition positionChange(androidx.ui.core.PointerInputChange);
method public static androidx.ui.unit.PxPosition positionChangeIgnoreConsumed(androidx.ui.core.PointerInputChange);
method public static boolean positionChanged(androidx.ui.core.PointerInputChange);
diff --git a/ui/ui-core/api/public_plus_experimental_0.1.0-dev14.txt b/ui/ui-core/api/public_plus_experimental_0.1.0-dev14.txt
index b56ebcc..66b69a3 100644
--- a/ui/ui-core/api/public_plus_experimental_0.1.0-dev14.txt
+++ b/ui/ui-core/api/public_plus_experimental_0.1.0-dev14.txt
@@ -771,7 +771,7 @@
method public static boolean changedToUpIgnoreConsumed(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumeAllChanges(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumeDownChange(androidx.ui.core.PointerInputChange);
- method public static androidx.ui.core.PointerInputChange consumePositionChange-3EnrK0w(androidx.ui.core.PointerInputChange, float consumedDx, float consumedDy);
+ method public static androidx.ui.core.PointerInputChange consumePositionChange(androidx.ui.core.PointerInputChange, float consumedDx, float consumedDy);
method public static androidx.ui.unit.PxPosition positionChange(androidx.ui.core.PointerInputChange);
method public static androidx.ui.unit.PxPosition positionChangeIgnoreConsumed(androidx.ui.core.PointerInputChange);
method public static boolean positionChanged(androidx.ui.core.PointerInputChange);
diff --git a/ui/ui-core/api/public_plus_experimental_current.txt b/ui/ui-core/api/public_plus_experimental_current.txt
index b56ebcc..66b69a3 100644
--- a/ui/ui-core/api/public_plus_experimental_current.txt
+++ b/ui/ui-core/api/public_plus_experimental_current.txt
@@ -771,7 +771,7 @@
method public static boolean changedToUpIgnoreConsumed(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumeAllChanges(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumeDownChange(androidx.ui.core.PointerInputChange);
- method public static androidx.ui.core.PointerInputChange consumePositionChange-3EnrK0w(androidx.ui.core.PointerInputChange, float consumedDx, float consumedDy);
+ method public static androidx.ui.core.PointerInputChange consumePositionChange(androidx.ui.core.PointerInputChange, float consumedDx, float consumedDy);
method public static androidx.ui.unit.PxPosition positionChange(androidx.ui.core.PointerInputChange);
method public static androidx.ui.unit.PxPosition positionChangeIgnoreConsumed(androidx.ui.core.PointerInputChange);
method public static boolean positionChanged(androidx.ui.core.PointerInputChange);
diff --git a/ui/ui-core/api/restricted_0.1.0-dev14.txt b/ui/ui-core/api/restricted_0.1.0-dev14.txt
index 2212b66..8d478ee 100644
--- a/ui/ui-core/api/restricted_0.1.0-dev14.txt
+++ b/ui/ui-core/api/restricted_0.1.0-dev14.txt
@@ -825,7 +825,7 @@
method public static boolean changedToUpIgnoreConsumed(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumeAllChanges(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumeDownChange(androidx.ui.core.PointerInputChange);
- method public static androidx.ui.core.PointerInputChange consumePositionChange-3EnrK0w(androidx.ui.core.PointerInputChange, float consumedDx, float consumedDy);
+ method public static androidx.ui.core.PointerInputChange consumePositionChange(androidx.ui.core.PointerInputChange, float consumedDx, float consumedDy);
method public static androidx.ui.unit.PxPosition positionChange(androidx.ui.core.PointerInputChange);
method public static androidx.ui.unit.PxPosition positionChangeIgnoreConsumed(androidx.ui.core.PointerInputChange);
method public static boolean positionChanged(androidx.ui.core.PointerInputChange);
diff --git a/ui/ui-core/api/restricted_current.txt b/ui/ui-core/api/restricted_current.txt
index 2212b66..8d478ee 100644
--- a/ui/ui-core/api/restricted_current.txt
+++ b/ui/ui-core/api/restricted_current.txt
@@ -825,7 +825,7 @@
method public static boolean changedToUpIgnoreConsumed(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumeAllChanges(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumeDownChange(androidx.ui.core.PointerInputChange);
- method public static androidx.ui.core.PointerInputChange consumePositionChange-3EnrK0w(androidx.ui.core.PointerInputChange, float consumedDx, float consumedDy);
+ method public static androidx.ui.core.PointerInputChange consumePositionChange(androidx.ui.core.PointerInputChange, float consumedDx, float consumedDy);
method public static androidx.ui.unit.PxPosition positionChange(androidx.ui.core.PointerInputChange);
method public static androidx.ui.unit.PxPosition positionChangeIgnoreConsumed(androidx.ui.core.PointerInputChange);
method public static boolean positionChanged(androidx.ui.core.PointerInputChange);
diff --git a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/autofill/ExplicitAutofillTypesDemo.kt b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/autofill/ExplicitAutofillTypesDemo.kt
index 3c1a799..bba3ab4 100644
--- a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/autofill/ExplicitAutofillTypesDemo.kt
+++ b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/autofill/ExplicitAutofillTypesDemo.kt
@@ -113,9 +113,9 @@
private fun LayoutCoordinates.boundingBox() = localToGlobal(PxPosition.Origin).run {
Rect(
- x.value.toInt(),
- y.value.toInt(),
- x.value.toInt() + size.width.value.toInt(),
- y.value.toInt() + size.height.value.toInt()
+ x.toInt(),
+ y.toInt(),
+ x.toInt() + size.width.value,
+ y.toInt() + size.height.value
)
}
\ No newline at end of file
diff --git a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/NestedScrollingDemo.kt b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/NestedScrollingDemo.kt
index 404da75..5408a9a 100644
--- a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/NestedScrollingDemo.kt
+++ b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/NestedScrollingDemo.kt
@@ -44,8 +44,7 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
-import androidx.ui.unit.px
-import androidx.ui.unit.round
+import kotlin.math.roundToInt
/**
* Demonstration for how multiple DragGestureDetectors interact.
@@ -79,22 +78,22 @@
*/
@Composable
private fun Draggable(children: @Composable () -> Unit) {
- val offset = state { 0.px }
- val maxOffset = state { 0.px }
+ val offset = state { 0f }
+ val maxOffset = state { 0f }
val dragObserver = object : DragObserver {
override fun onDrag(dragDistance: PxPosition): PxPosition {
val resultingOffset = offset.value + dragDistance.y
val dyToConsume =
- if (resultingOffset > 0.px) {
- 0.px - offset.value
+ if (resultingOffset > 0f) {
+ 0f - offset.value
} else if (resultingOffset < maxOffset.value) {
maxOffset.value - offset.value
} else {
dragDistance.y
}
offset.value = offset.value + dyToConsume
- return PxPosition(0.px, dyToConsume)
+ return PxPosition(0f, dyToConsume)
}
}
@@ -114,10 +113,10 @@
measurables.first()
.measure(constraints.copy(minHeight = 0.ipx, maxHeight = IntPx.Infinity))
- maxOffset.value = constraints.maxHeight.value.px - placeable.height
+ maxOffset.value = (constraints.maxHeight.value - placeable.height.value).toFloat()
layout(constraints.maxWidth, constraints.maxHeight) {
- placeable.place(0.ipx, offset.value.round())
+ placeable.place(0.ipx, offset.value.roundToInt().ipx)
}
})
}
diff --git a/ui/ui-core/src/androidTest/java/androidx/ui/core/AndroidPointerInputTest.kt b/ui/ui-core/src/androidTest/java/androidx/ui/core/AndroidPointerInputTest.kt
index b2208ce..ac5ba57 100644
--- a/ui/ui-core/src/androidTest/java/androidx/ui/core/AndroidPointerInputTest.kt
+++ b/ui/ui-core/src/androidTest/java/androidx/ui/core/AndroidPointerInputTest.kt
@@ -35,7 +35,6 @@
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.PxPosition
import androidx.ui.unit.ipx
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.never
@@ -211,7 +210,7 @@
// we expect it to first remeasure and only then process
androidComposeView.dispatchTouchEvent(motionEvent)
- assertThat(consumedDownPosition).isEqualTo(PxPosition(15.px, 15.px))
+ assertThat(consumedDownPosition).isEqualTo(PxPosition(15f, 15f))
}
}
@@ -294,7 +293,10 @@
bounds: IntPxSize
) =
if (consumeMovement) {
- changes.map { it.consumePositionChange(it.positionChange().x, it.positionChange().y) }
+ changes.map { it.consumePositionChange(
+ it.positionChange().x,
+ it.positionChange().y)
+ }
} else {
changes
}
diff --git a/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/TouchSlopDragGestureFilterTest.kt b/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/TouchSlopDragGestureFilterTest.kt
index 67a5185..f26061c1 100644
--- a/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/TouchSlopDragGestureFilterTest.kt
+++ b/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/TouchSlopDragGestureFilterTest.kt
@@ -28,7 +28,6 @@
import androidx.ui.layout.Stack
import androidx.ui.unit.PxPosition
import androidx.ui.unit.ipx
-import androidx.ui.unit.px
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.inOrder
import com.nhaarman.mockitokotlin2.spy
@@ -239,7 +238,7 @@
view.dispatchTouchEvent(move)
}
- verify(dragObserver, times(2)).onDrag(PxPosition(movement.px, 0.px))
+ verify(dragObserver, times(2)).onDrag(PxPosition(movement.toFloat(), 0.0f))
}
private fun setup(startDragImmediately: Boolean) {
diff --git a/ui/ui-core/src/androidTest/java/androidx/ui/core/pointerinput/MotionEventAdapterTest.kt b/ui/ui-core/src/androidTest/java/androidx/ui/core/pointerinput/MotionEventAdapterTest.kt
index 424f045..1e59127 100644
--- a/ui/ui-core/src/androidTest/java/androidx/ui/core/pointerinput/MotionEventAdapterTest.kt
+++ b/ui/ui-core/src/androidTest/java/androidx/ui/core/pointerinput/MotionEventAdapterTest.kt
@@ -1447,6 +1447,6 @@
val pointerInputData = actual.pointerInputData
assertThat(actual.id).isEqualTo(id)
assertThat(pointerInputData.down).isEqualTo(isDown)
- assertThat(pointerInputData.position!!.x.value).isEqualTo(x)
- assertThat(pointerInputData.position!!.y.value).isEqualTo(y)
+ assertThat(pointerInputData.position!!.x).isEqualTo(x)
+ assertThat(pointerInputData.position!!.y).isEqualTo(y)
}
\ No newline at end of file
diff --git a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/DrawLayerTest.kt b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/DrawLayerTest.kt
index 0afe069..2b0aedd6 100644
--- a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/DrawLayerTest.kt
+++ b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/DrawLayerTest.kt
@@ -80,13 +80,13 @@
assertTrue(positionLatch.await(1, TimeUnit.SECONDS))
activity.runOnUiThread {
- assertEquals(PxPosition(10.px, 10.px), layoutCoordinates.positionInRoot)
+ assertEquals(PxPosition(10f, 10f), layoutCoordinates.positionInRoot)
val bounds = layoutCoordinates.boundsInRoot
assertEquals(PxBounds(10.px, 10.px, 40.px, 40.px), bounds)
val global = layoutCoordinates.globalBounds
val position = layoutCoordinates.globalPosition
- assertEquals(position.x, global.left)
- assertEquals(position.y, global.top)
+ assertEquals(position.x, global.left.value)
+ assertEquals(position.y, global.top.value)
assertEquals(30.px, global.width)
assertEquals(30.px, global.height)
}
@@ -110,7 +110,7 @@
activity.runOnUiThread {
val bounds = layoutCoordinates.boundsInRoot
assertEquals(PxBounds(5.px, 0.px, 25.px, 30.px), bounds)
- assertEquals(PxPosition(5.px, 0.px), layoutCoordinates.positionInRoot)
+ assertEquals(PxPosition(5f, 0f), layoutCoordinates.positionInRoot)
}
}
@@ -132,7 +132,7 @@
activity.runOnUiThread {
val bounds = layoutCoordinates.boundsInRoot
assertEquals(PxBounds(0.px, 10.px, 30.px, 20.px), bounds)
- assertEquals(PxPosition(30.px, 10.px), layoutCoordinates.positionInRoot)
+ assertEquals(PxPosition(30f, 10f), layoutCoordinates.positionInRoot)
}
}
@@ -155,7 +155,7 @@
activity.runOnUiThread {
val bounds = layoutCoordinates.boundsInRoot
assertEquals(PxBounds(20.px, 10.px, 30.px, 20.px), bounds)
- assertEquals(PxPosition(30.px, 10.px), layoutCoordinates.positionInRoot)
+ assertEquals(PxPosition(30f, 10f), layoutCoordinates.positionInRoot)
}
}
@@ -178,7 +178,7 @@
activity.runOnUiThread {
val bounds = layoutCoordinates.boundsInRoot
assertEquals(PxBounds(15.px, 18.px, 25.px, 28.px), bounds)
- assertEquals(PxPosition(15.px, 18.px), layoutCoordinates.positionInRoot)
+ assertEquals(PxPosition(15f, 18f), layoutCoordinates.positionInRoot)
}
}
@@ -203,7 +203,7 @@
val bounds = layoutCoordinates.boundsInRoot
assertEquals(PxBounds(10.px, 10.px, 20.px, 20.px), bounds)
// Positions aren't clipped
- assertEquals(PxPosition(5.px, 10.px), layoutCoordinates.positionInRoot)
+ assertEquals(PxPosition(5f, 10f), layoutCoordinates.positionInRoot)
}
}
diff --git a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/LayerTouchTransformTest.kt b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/LayerTouchTransformTest.kt
index 4a7e807..b222ede 100644
--- a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/LayerTouchTransformTest.kt
+++ b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/LayerTouchTransformTest.kt
@@ -41,7 +41,6 @@
import androidx.ui.test.doPartialGesture
import androidx.ui.test.findByTag
import androidx.ui.test.sendDown
-import androidx.ui.unit.Px
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
@@ -123,7 +122,7 @@
// however, after transformations, this point will be within
// its bounds
- val mappedPosition = PxPosition(Px(342.0f), Px(168.0f))
+ val mappedPosition = PxPosition(342.0f, 168.0f)
val node = findByTag(testTag).doPartialGesture { sendDown(mappedPosition) }
latch = CountDownLatch(1).apply {
@@ -134,8 +133,8 @@
Assert.assertEquals(
Color.Red.toArgb(),
getPixel(
- mappedPosition.x.value.toInt(),
- mappedPosition.y.value.toInt()
+ mappedPosition.x.toInt(),
+ mappedPosition.y.toInt()
)
)
}
diff --git a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/OnPositionedTest.kt b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/OnPositionedTest.kt
index 6c2cb50d..f1ce65a 100644
--- a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/OnPositionedTest.kt
+++ b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/OnPositionedTest.kt
@@ -77,7 +77,7 @@
minWidth = size,
minHeight = size,
modifier = Modifier.onPositioned { coordinates ->
- wrap1Position = coordinates.globalPosition.x
+ wrap1Position = coordinates.globalPosition.x.px
latch.countDown()
}
)
@@ -86,7 +86,7 @@
minWidth = size,
minHeight = size,
modifier = Modifier.onPositioned { coordinates ->
- wrap2Position = coordinates.globalPosition.x
+ wrap2Position = coordinates.globalPosition.x.px
latch.countDown()
}
)
@@ -148,7 +148,7 @@
@Test
fun callbackCalledForChildWhenParentMoved() {
var position by mutableStateOf(0.ipx)
- var childGlobalPosition = PxPosition(0.px, 0.px)
+ var childGlobalPosition = PxPosition(0f, 0f)
var latch = CountDownLatch(1)
rule.runOnUiThreadIR {
activity.setContent {
@@ -185,7 +185,7 @@
}
assertTrue(latch.await(1, TimeUnit.SECONDS))
- assertEquals(PxPosition(10.px, 0.px), childGlobalPosition)
+ assertEquals(PxPosition(10f, 0f), childGlobalPosition)
}
@Test
@@ -259,7 +259,7 @@
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
rule.runOnUiThread {
- assertEquals(PxPosition(5.px, 5.px), coordinates!!.positionInParent)
+ assertEquals(PxPosition(5f, 5f), coordinates!!.positionInParent)
var root = coordinates!!
while (root.parentCoordinates != null) {
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/LayerWrapper.kt b/ui/ui-core/src/main/java/androidx/ui/core/LayerWrapper.kt
index 5be6042..1ec5dcc9 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/LayerWrapper.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/LayerWrapper.kt
@@ -21,7 +21,6 @@
import androidx.ui.graphics.Canvas
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
internal class LayerWrapper(
wrapped: LayoutNodeWrapper,
@@ -110,8 +109,8 @@
* and untransformed position.
*/
private fun mapPointsFromMatrix(matrix: Matrix, position: PxPosition): PxPosition {
- val x = position.x.value
- val y = position.y.value
+ val x = position.x
+ val y = position.y
val cache = positionCache
val point = if (cache != null) {
cache[0] = x
@@ -121,7 +120,7 @@
floatArrayOf(x, y).also { positionCache = it }
}
matrix.mapPoints(point)
- return PxPosition(point[0].px, point[1].px)
+ return PxPosition(point[0], point[1])
}
override fun rectInParent(bounds: RectF) {
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/LayoutCoordinates.kt b/ui/ui-core/src/main/java/androidx/ui/core/LayoutCoordinates.kt
index 7254dfe..881107a 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/LayoutCoordinates.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/LayoutCoordinates.kt
@@ -123,10 +123,10 @@
val rootPosition = root.localToGlobal(PxPosition.Origin)
val bounds = root.childBoundingBox(this)
return PxBounds(
- left = bounds.left + rootPosition.x,
- top = bounds.top + rootPosition.y,
- right = bounds.right + rootPosition.x,
- bottom = bounds.bottom + rootPosition.y
+ left = bounds.left + rootPosition.x.px,
+ top = bounds.top + rootPosition.y.px,
+ right = bounds.right + rootPosition.x.px,
+ bottom = bounds.bottom + rootPosition.y.px
)
}
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/LayoutNode.kt b/ui/ui-core/src/main/java/androidx/ui/core/LayoutNode.kt
index d8235d5..bcb2b78 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/LayoutNode.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/LayoutNode.kt
@@ -32,6 +32,7 @@
import androidx.ui.unit.Density
import androidx.ui.unit.IntPx
import androidx.ui.unit.PxPosition
+import androidx.ui.unit.px
import androidx.ui.unit.round
import androidx.ui.util.fastForEach
import kotlin.math.sign
@@ -740,7 +741,7 @@
wrapper = wrapper.wrappedBy!!
}
pos = wrapper.toParentPosition(pos)
- return if (line is HorizontalAlignmentLine) pos.y.round() else pos.x.round()
+ return if (line is HorizontalAlignmentLine) pos.y.px.round() else pos.x.px.round()
}
/**
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/LayoutNodeWrapper.kt b/ui/ui-core/src/main/java/androidx/ui/core/LayoutNodeWrapper.kt
index 4bf2605..cb16418 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/LayoutNodeWrapper.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/LayoutNodeWrapper.kt
@@ -99,10 +99,10 @@
// TODO(shepshapard): Right now globalToLocal has to traverse the tree all the way back up
// so calling this is expensive. Would be nice to cache data such that this is cheap.
val localPointerPosition = globalToLocal(globalPointerPosition)
- return localPointerPosition.x.value >= 0 &&
- localPointerPosition.x < measuredSize.width &&
- localPointerPosition.y.value >= 0 &&
- localPointerPosition.y < measuredSize.height
+ return localPointerPosition.x >= 0 &&
+ localPointerPosition.x < measuredSize.width.value &&
+ localPointerPosition.y >= 0 &&
+ localPointerPosition.y < measuredSize.height.value
}
/**
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/PointerInput.kt b/ui/ui-core/src/main/java/androidx/ui/core/PointerInput.kt
index deec36c..cbf43de 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/PointerInput.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/PointerInput.kt
@@ -19,10 +19,8 @@
import androidx.compose.Immutable
import androidx.compose.Stable
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.Px
import androidx.ui.unit.PxPosition
import androidx.ui.unit.Uptime
-import androidx.ui.unit.px
/**
* Describes a change that has occurred for a particular pointer, as well as how much of the change
@@ -213,7 +211,7 @@
val offset =
if (previousPosition == null || currentPosition == null) {
- PxPosition(0.px, 0.px)
+ PxPosition(0.0f, 0.0f)
} else {
currentPosition - previousPosition
}
@@ -231,7 +229,7 @@
* True if any of this [PointerInputChange]'s movement has been consumed.
*/
fun PointerInputChange.anyPositionChangeConsumed() =
- consumed.positionChange.x.value != 0f || consumed.positionChange.y.value != 0f
+ consumed.positionChange.x != 0f || consumed.positionChange.y != 0f
/**
* True if any aspect of this [PointerInputChange] has been consumed.
@@ -262,8 +260,8 @@
* @param consumedDy The amount of position change on the y axis to consume.
*/
fun PointerInputChange.consumePositionChange(
- consumedDx: Px,
- consumedDy: Px
+ consumedDx: Float,
+ consumedDy: Float
): PointerInputChange {
val newConsumedDx = consumedDx + consumed.positionChange.x
val newConsumedDy = consumedDy + consumed.positionChange.y
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/gesture/DragSlopExceededGestureFilter.kt b/ui/ui-core/src/main/java/androidx/ui/core/gesture/DragSlopExceededGestureFilter.kt
index 5652019..c75d811 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/gesture/DragSlopExceededGestureFilter.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/gesture/DragSlopExceededGestureFilter.kt
@@ -155,7 +155,7 @@
val sizeAsFloat = changes.size.toFloat()
// TODO(b/148980115): Once PxPosition is removed, sum will be an Offset, and this line can
// just be straight division.
- return Offset(sum.x.value / sizeAsFloat, sum.y.value / sizeAsFloat)
+ return Offset(sum.x / sizeAsFloat, sum.y / sizeAsFloat)
}
/**
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/gesture/GestureUtils.kt b/ui/ui-core/src/main/java/androidx/ui/core/gesture/GestureUtils.kt
index 9269531..61b9d59 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/gesture/GestureUtils.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/gesture/GestureUtils.kt
@@ -35,10 +35,10 @@
fun List<PointerInputChange>.anyPointersInBounds(bounds: IntPxSize) =
fastAny {
it.current.down &&
- it.current.position!!.x.value >= 0 &&
- it.current.position.x < bounds.width &&
- it.current.position.y.value >= 0 &&
- it.current.position.y < bounds.height
+ it.current.position!!.x >= 0 &&
+ it.current.position.x < bounds.width.value &&
+ it.current.position.y >= 0 &&
+ it.current.position.y < bounds.height.value
}
internal class PointerInputModifierImpl(override val pointerInputFilter: PointerInputFilter) :
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/gesture/RawDragGestureFilter.kt b/ui/ui-core/src/main/java/androidx/ui/core/gesture/RawDragGestureFilter.kt
index d5f3593..4a38933 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/gesture/RawDragGestureFilter.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/gesture/RawDragGestureFilter.kt
@@ -33,7 +33,6 @@
import androidx.ui.core.positionChange
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import androidx.ui.util.fastAny
import androidx.ui.util.fastForEach
@@ -266,8 +265,8 @@
var totalDy = 0f
movedChanges.fastForEach {
- totalDx += it.positionChange().x.value
- totalDy += it.positionChange().y.value
+ totalDx += it.positionChange().x
+ totalDy += it.positionChange().y
}
if (totalDx != 0f || totalDy != 0f) {
@@ -284,8 +283,8 @@
val consumed = dragObserver.onDrag(
PxPosition(
- (totalDx / changesToReturn.size).px,
- (totalDy / changesToReturn.size).px
+ totalDx / changesToReturn.size,
+ totalDy / changesToReturn.size
)
)
@@ -313,8 +312,8 @@
}
private fun Iterable<PxPosition>.averagePosition(): PxPosition {
- var x = 0.px
- var y = 0.px
+ var x = 0f
+ var y = 0f
forEach {
x += it.x
y += it.y
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/gesture/ScaleUtil.kt b/ui/ui-core/src/main/java/androidx/ui/core/gesture/ScaleUtil.kt
index 037721f..c7cb8ad 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/gesture/ScaleUtil.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/gesture/ScaleUtil.kt
@@ -60,16 +60,16 @@
internal fun List<PointerInputChange>.calculateAllDimensionInformation() =
AllDimensionData(
map {
- it.previous.position!!.x.value
+ it.previous.position!!.x
}.calculateDimensionInformation(),
map {
- it.previous.position!!.y.value
+ it.previous.position!!.y
}.calculateDimensionInformation(),
map {
- it.previous.position!!.x.value + it.positionChange().x.value
+ it.previous.position!!.x + it.positionChange().x
}.calculateDimensionInformation(),
map {
- it.previous.position!!.y.value + it.positionChange().y.value
+ it.previous.position!!.y + it.positionChange().y
}.calculateDimensionInformation()
)
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/gesture/util/VelocityTracker.kt b/ui/ui-core/src/main/java/androidx/ui/core/gesture/util/VelocityTracker.kt
index d634ce8..c2c45bc 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/gesture/util/VelocityTracker.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/gesture/util/VelocityTracker.kt
@@ -21,7 +21,6 @@
import androidx.ui.unit.Uptime
import androidx.ui.unit.Velocity
import androidx.ui.unit.inMilliseconds
-import androidx.ui.unit.px
import kotlin.math.absoluteValue
private const val AssumePointerMoveStoppedMilliseconds: Int = 40
@@ -112,8 +111,8 @@
oldestSample = sample
val position: PxPosition = sample.point
- x.add(position.x.value)
- y.add(position.y.value)
+ x.add(position.x)
+ y.add(position.y)
time.add(-age)
index = (if (index == 0) HistorySize else index) - 1
@@ -133,8 +132,8 @@
return VelocityEstimate(
pixelsPerSecond = PxPosition(
// Convert from pixels/ms to pixels/s
- (xSlope * 1000).px,
- (ySlope * 1000).px
+ (xSlope * 1000),
+ (ySlope * 1000)
),
confidence = xFit.confidence * yFit.confidence,
duration = newestSample.time - oldestSample.time,
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/pointerinput/MotionEventAdapter.kt b/ui/ui-core/src/main/java/androidx/ui/core/pointerinput/MotionEventAdapter.kt
index cc70698..310ecf9 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/pointerinput/MotionEventAdapter.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/pointerinput/MotionEventAdapter.kt
@@ -28,7 +28,6 @@
import androidx.ui.unit.NanosecondsPerMillisecond
import androidx.ui.unit.PxPosition
import androidx.ui.unit.Uptime
-import androidx.ui.unit.px
/**
* Converts Android framework [MotionEvent]s into Compose [PointerInputEvent]s.
@@ -145,7 +144,7 @@
): PointerInputData {
val pointerCoords = MotionEvent.PointerCoords()
motionEvent.getPointerCoords(index, pointerCoords)
- val offset = PxPosition(pointerCoords.x.px, pointerCoords.y.px)
+ val offset = PxPosition(pointerCoords.x, pointerCoords.y)
return PointerInputData(
timestamp,
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/selection/SelectionContainer.kt b/ui/ui-core/src/main/java/androidx/ui/core/selection/SelectionContainer.kt
index 8d371c3..9621cd8 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/selection/SelectionContainer.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/selection/SelectionContainer.kt
@@ -44,6 +44,7 @@
import androidx.ui.unit.ipx
import androidx.ui.unit.isFinite
import androidx.ui.unit.max
+import androidx.ui.unit.px
import androidx.ui.unit.round
/**
@@ -133,7 +134,7 @@
} else {
if (isStartHandle) Alignment.TopStart else Alignment.TopEnd
},
- offset = IntPxPosition(offset.x.round(), offset.y.round())
+ offset = IntPxPosition(offset.x.px.round(), offset.y.px.round())
) {
val drag = Modifier.dragGestureFilter(
dragObserver = manager.handleDragObserver(isStartHandle = isStartHandle)
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/selection/SelectionManager.kt b/ui/ui-core/src/main/java/androidx/ui/core/selection/SelectionManager.kt
index 3acc691..6693f76 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/selection/SelectionManager.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/selection/SelectionManager.kt
@@ -33,11 +33,10 @@
import androidx.ui.text.AnnotatedString
import androidx.ui.text.length
import androidx.ui.text.subSequence
-import androidx.ui.unit.Px
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.max
-import androidx.ui.unit.min
import androidx.ui.unit.px
+import kotlin.math.max
+import kotlin.math.min
/**
* A bridge class between user interaction to the text composables for text selection.
@@ -310,16 +309,16 @@
var startTop = localLayoutCoordinates.childToLocal(
startLayoutCoordinates,
PxPosition(
- Px.Zero,
- selection.start.selectable.getBoundingBox(selection.start.offset).top.px
+ 0f,
+ selection.start.selectable.getBoundingBox(selection.start.offset).top
)
)
var endTop = localLayoutCoordinates.childToLocal(
endLayoutCoordinates,
PxPosition(
- Px.Zero,
- selection.end.selectable.getBoundingBox(selection.end.offset).top.px
+ 0.0f,
+ selection.end.selectable.getBoundingBox(selection.end.offset).top
)
)
@@ -327,13 +326,13 @@
endTop = localLayoutCoordinates.localToRoot(endTop)
val top = min(startTop.y, endTop.y)
- val bottom = max(startOffset.y, endOffset.y) + (HANDLE_HEIGHT.value * 4.0).px
+ val bottom = max(startOffset.y, endOffset.y) + (HANDLE_HEIGHT.value * 4.0).px.value
return Rect(
- left.value,
- top.value,
- right.value,
- bottom.value
+ left,
+ top,
+ right,
+ bottom
)
}
return Rect.zero
@@ -344,8 +343,8 @@
// Call mergeSelections with an out of boundary input to inform all text widgets to
// cancel their individual selection.
mergeSelections(
- startPosition = PxPosition((-1).px, (-1).px),
- endPosition = PxPosition((-1).px, (-1).px),
+ startPosition = PxPosition(-1f, -1f),
+ endPosition = PxPosition(-1f, -1f),
previousSelection = selection
)
if (selection != null) onSelectionChange(null)
@@ -399,7 +398,7 @@
* hit current line, move up this y coordinates by 1 pixel.
*/
private fun getAdjustedCoordinates(position: PxPosition): PxPosition {
- return PxPosition(position.x, position.y - 1.px)
+ return PxPosition(position.x, position.y - 1f)
}
fun handleDragObserver(isStartHandle: Boolean): DragObserver {
diff --git a/ui/ui-core/src/main/java/androidx/ui/node/PointerInteropUtils.kt b/ui/ui-core/src/main/java/androidx/ui/node/PointerInteropUtils.kt
index 8c2da8c..8d23589 100644
--- a/ui/ui-core/src/main/java/androidx/ui/node/PointerInteropUtils.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/node/PointerInteropUtils.kt
@@ -60,9 +60,9 @@
val pointerCoords =
map {
if (it.changedToUpIgnoreConsumed()) {
- PointerCoords(it.previous.position!!.x.value, it.previous.position.y.value)
+ PointerCoords(it.previous.position!!.x, it.previous.position.y)
} else {
- PointerCoords(it.current.position!!.x.value, it.current.position.y.value)
+ PointerCoords(it.current.position!!.x, it.current.position.y)
}
}.toTypedArray()
@@ -95,9 +95,9 @@
val pointerCoords =
map {
if (it.changedToUpIgnoreConsumed()) {
- PointerCoords(it.previous.position!!.x.value, it.previous.position.y.value)
+ PointerCoords(it.previous.position!!.x, it.previous.position.y)
} else {
- PointerCoords(it.current.position!!.x.value, it.current.position.y.value)
+ PointerCoords(it.current.position!!.x, it.current.position.y)
}
}.toTypedArray()
diff --git a/ui/ui-core/src/main/java/androidx/ui/testutils/PointerInputTestUtil.kt b/ui/ui-core/src/main/java/androidx/ui/testutils/PointerInputTestUtil.kt
index 6512c43..f6fa05c 100644
--- a/ui/ui-core/src/main/java/androidx/ui/testutils/PointerInputTestUtil.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/testutils/PointerInputTestUtil.kt
@@ -28,7 +28,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.Uptime
import androidx.ui.unit.ipx
-import androidx.ui.unit.px
// TODO(shepshapard): Document.
@@ -40,7 +39,7 @@
): PointerInputChange =
PointerInputChange(
PointerId(id),
- PointerInputData(Uptime.Boot + duration, PxPosition(x.px, y.px), true),
+ PointerInputData(Uptime.Boot + duration, PxPosition(x, y), true),
PointerInputData(null, null, false),
ConsumedData(PxPosition.Origin, false)
)
@@ -48,7 +47,7 @@
fun PointerInputChange.moveTo(duration: Duration, x: Float = 0f, y: Float = 0f) =
copy(
previous = current,
- current = PointerInputData(Uptime.Boot + duration, PxPosition(x.px, y.px), true),
+ current = PointerInputData(Uptime.Boot + duration, PxPosition(x, y), true),
consumed = ConsumedData()
)
@@ -57,7 +56,7 @@
previous = current,
current = PointerInputData(
current.uptime!! + duration,
- PxPosition(current.position!!.x + dx.px, current.position.y + dy.px),
+ PxPosition(current.position!!.x + dx, current.position.y + dy),
true
),
consumed = ConsumedData()
@@ -74,8 +73,8 @@
copy(
consumed = consumed.copy(
positionChange = PxPosition(
- consumed.positionChange.x + dx.px,
- consumed.positionChange.y + dy.px
+ consumed.positionChange.x + dx,
+ consumed.positionChange.y + dy
), downChange = consumed.downChange || downChange
)
)
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/LayoutNodeTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/LayoutNodeTest.kt
index 1874f09..977a5c9 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/LayoutNodeTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/LayoutNodeTest.kt
@@ -22,8 +22,6 @@
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.PxPosition
import androidx.ui.unit.ipx
-import androidx.ui.unit.px
-import androidx.ui.unit.toPx
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.anyOrNull
import com.nhaarman.mockitokotlin2.doReturn
@@ -345,10 +343,10 @@
node0.place(x0, y0)
node1.place(x1, y1)
- val globalPosition = PxPosition(250.px, 300.px)
+ val globalPosition = PxPosition(250f, 300f)
- val expectedX = globalPosition.x - x0.toPx() - x1.toPx()
- val expectedY = globalPosition.y - y0.toPx() - y1.toPx()
+ val expectedX = globalPosition.x - x0.value.toFloat() - x1.value.toFloat()
+ val expectedY = globalPosition.y - y0.value.toFloat() - y1.value.toFloat()
val expectedPosition = PxPosition(expectedX, expectedY)
val result = node1.coordinates.globalToLocal(globalPosition)
@@ -370,10 +368,10 @@
node0.place(x0, y0)
node1.place(x1, y1)
- val globalPosition = PxPosition(250.ipx, 300.ipx)
+ val globalPosition = PxPosition(250f, 300f)
- val expectedX = globalPosition.x - x0 - x1
- val expectedY = globalPosition.y - y0 - y1
+ val expectedX = globalPosition.x - x0.value.toFloat() - x1.value.toFloat()
+ val expectedY = globalPosition.y - y0.value.toFloat() - y1.value.toFloat()
val expectedPosition = PxPosition(expectedX, expectedY)
val result = node1.coordinates.globalToLocal(globalPosition)
@@ -395,10 +393,10 @@
node0.place(x0, y0)
node1.place(x1, y1)
- val localPosition = PxPosition(5.px, 15.px)
+ val localPosition = PxPosition(5f, 15f)
- val expectedX = localPosition.x + x0.toPx() + x1.toPx()
- val expectedY = localPosition.y + y0.toPx() + y1.toPx()
+ val expectedX = localPosition.x + x0.value.toFloat() + x1.value.toFloat()
+ val expectedY = localPosition.y + y0.value.toFloat() + y1.value.toFloat()
val expectedPosition = PxPosition(expectedX, expectedY)
val result = node1.coordinates.localToGlobal(localPosition)
@@ -422,8 +420,8 @@
val localPosition = PxPosition(5.ipx, 15.ipx)
- val expectedX = localPosition.x + x0 + x1
- val expectedY = localPosition.y + y0 + y1
+ val expectedX = localPosition.x + x0.value.toFloat() + x1.value.toFloat()
+ val expectedY = localPosition.y + y0.value.toFloat() + y1.value.toFloat()
val expectedPosition = PxPosition(expectedX, expectedY)
val result = node1.coordinates.localToGlobal(localPosition)
@@ -439,7 +437,7 @@
val result = node.coordinates.localToGlobal(PxPosition.Origin)
- assertEquals(PxPosition(120.px, 30.px), result)
+ assertEquals(PxPosition(120f, 30f), result)
}
@Test
@@ -465,10 +463,10 @@
node0.place(100.ipx, 10.ipx)
node1.place(x1, y1)
- val localPosition = PxPosition(5.px, 15.px)
+ val localPosition = PxPosition(5f, 15f)
- val expectedX = localPosition.x + x1.toPx()
- val expectedY = localPosition.y + y1.toPx()
+ val expectedX = localPosition.x + x1.value.toFloat()
+ val expectedY = localPosition.y + y1.value.toFloat()
val expectedPosition = PxPosition(expectedX, expectedY)
val result = node0.coordinates.childToLocal(node1.coordinates, localPosition)
@@ -487,7 +485,7 @@
thrown.expect(IllegalStateException::class.java)
- node2.coordinates.childToLocal(node1.coordinates, PxPosition(5.px, 15.px))
+ node2.coordinates.childToLocal(node1.coordinates, PxPosition(5f, 15f))
}
@Test
@@ -500,14 +498,14 @@
thrown.expect(IllegalStateException::class.java)
- node1.coordinates.childToLocal(node0.coordinates, PxPosition(5.px, 15.px))
+ node1.coordinates.childToLocal(node0.coordinates, PxPosition(5f, 15f))
}
@Test
fun testChildToLocalTheSameNode() {
val node = LayoutNode()
node.attach(mockOwner())
- val position = PxPosition(5.px, 15.px)
+ val position = PxPosition(5f, 15f)
val result = node.coordinates.childToLocal(node.coordinates, position)
@@ -552,7 +550,7 @@
val actual = parent.coordinates.childToLocal(child.coordinates, PxPosition.Origin)
- assertEquals(PxPosition(50.px, 80.px), actual)
+ assertEquals(PxPosition(50f, 80f), actual)
}
@Test
@@ -569,7 +567,7 @@
val actual = grandParent.coordinates.childToLocal(child.coordinates, PxPosition.Origin)
- assertEquals(PxPosition(20.px, -2.px), actual)
+ assertEquals(PxPosition(20f, -2f), actual)
}
// LayoutNode shouldn't allow adding beyond the count
@@ -791,9 +789,9 @@
}
val offset = when (numberOfChildrenHit) {
- 3 -> PxPosition(250.px, 250.px)
- 2 -> PxPosition(150.px, 150.px)
- 1 -> PxPosition(50.px, 50.px)
+ 3 -> PxPosition(250f, 250f)
+ 2 -> PxPosition(150f, 150f)
+ 1 -> PxPosition(50f, 50f)
else -> throw IllegalStateException()
}
@@ -879,8 +877,8 @@
attach(mockOwner())
}
- val offset1 = PxPosition(25.px, 25.px)
- val offset2 = PxPosition(75.px, 75.px)
+ val offset1 = PxPosition(25f, 25f)
+ val offset2 = PxPosition(75f, 75f)
val hit1 = mutableListOf<PointerInputFilter>()
val hit2 = mutableListOf<PointerInputFilter>()
@@ -956,9 +954,9 @@
attach(mockOwner())
}
- val offset1 = PxPosition(25.px, 25.px)
- val offset2 = PxPosition(75.px, 75.px)
- val offset3 = PxPosition(125.px, 125.px)
+ val offset1 = PxPosition(25f, 25f)
+ val offset2 = PxPosition(75f, 75f)
+ val offset3 = PxPosition(125f, 125f)
val hit1 = mutableListOf<PointerInputFilter>()
val hit2 = mutableListOf<PointerInputFilter>()
@@ -1018,9 +1016,9 @@
attach(mockOwner())
}
- val offset1 = PxPosition(50.px, 25.px)
- val offset2 = PxPosition(50.px, 75.px)
- val offset3 = PxPosition(50.px, 125.px)
+ val offset1 = PxPosition(50f, 25f)
+ val offset2 = PxPosition(50f, 75f)
+ val offset3 = PxPosition(50f, 125f)
val hit1 = mutableListOf<PointerInputFilter>()
val hit2 = mutableListOf<PointerInputFilter>()
@@ -1080,9 +1078,9 @@
attach(mockOwner())
}
- val offset1 = PxPosition(25.px, 50.px)
- val offset2 = PxPosition(75.px, 50.px)
- val offset3 = PxPosition(125.px, 50.px)
+ val offset1 = PxPosition(25f, 50f)
+ val offset2 = PxPosition(75f, 50f)
+ val offset3 = PxPosition(125f, 50f)
val hit1 = mutableListOf<PointerInputFilter>()
val hit2 = mutableListOf<PointerInputFilter>()
@@ -1166,21 +1164,21 @@
attach(mockOwner())
}
- val offsetThatHits1 = PxPosition(1.px, 1.px)
- val offsetThatHits2 = PxPosition(3.px, 1.px)
- val offsetThatHits3 = PxPosition(1.px, 3.px)
- val offsetThatHits4 = PxPosition(3.px, 3.px)
+ val offsetThatHits1 = PxPosition(1f, 1f)
+ val offsetThatHits2 = PxPosition(3f, 1f)
+ val offsetThatHits3 = PxPosition(1f, 3f)
+ val offsetThatHits4 = PxPosition(3f, 3f)
val offsetsThatMiss =
listOf(
- PxPosition(1.px, 0.px),
- PxPosition(3.px, 0.px),
- PxPosition(0.px, 1.px),
- PxPosition(4.px, 1.px),
- PxPosition(0.px, 3.px),
- PxPosition(4.px, 3.px),
- PxPosition(1.px, 4.px),
- PxPosition(3.px, 4.px)
+ PxPosition(1f, 0f),
+ PxPosition(3f, 0f),
+ PxPosition(0f, 1f),
+ PxPosition(4f, 1f),
+ PxPosition(0f, 3f),
+ PxPosition(4f, 3f),
+ PxPosition(1f, 4f),
+ PxPosition(3f, 4f)
)
val hit1 = mutableListOf<PointerInputFilter>()
@@ -1246,14 +1244,14 @@
attach(mockOwner(IntPxPosition(1.ipx, 1.ipx)))
}
- val offsetThatHits1 = PxPosition(2.px, 2.px)
- val offsetThatHits2 = PxPosition(2.px, 1.px)
- val offsetThatHits3 = PxPosition(1.px, 2.px)
+ val offsetThatHits1 = PxPosition(2f, 2f)
+ val offsetThatHits2 = PxPosition(2f, 1f)
+ val offsetThatHits3 = PxPosition(1f, 2f)
val offsetsThatMiss =
listOf(
- PxPosition(0.px, 0.px),
- PxPosition(0.px, 1.px),
- PxPosition(1.px, 0.px)
+ PxPosition(0f, 0f),
+ PxPosition(0f, 1f),
+ PxPosition(1f, 0f)
)
val hit1 = mutableListOf<PointerInputFilter>()
@@ -1305,7 +1303,7 @@
attach(mockOwner())
}
- val offset1 = PxPosition(50.px, 75.px)
+ val offset1 = PxPosition(50f, 75f)
val hit = mutableListOf<PointerInputFilter>()
@@ -1349,7 +1347,7 @@
}.apply {
attach(mockOwner())
}
- val offset1 = PxPosition(499.px, 499.px)
+ val offset1 = PxPosition(499f, 499f)
val hit = mutableListOf<PointerInputFilter>()
@@ -1404,7 +1402,7 @@
attach(mockOwner())
}
- val offset1 = PxPosition(499.px, 499.px)
+ val offset1 = PxPosition(499f, 499f)
val hit = mutableListOf<PointerInputFilter>()
@@ -1449,7 +1447,7 @@
attach(mockOwner())
}
- val offset = PxPosition(50.px, 50.px)
+ val offset = PxPosition(50f, 50f)
val hit = mutableListOf<PointerInputFilter>()
@@ -1521,7 +1519,7 @@
// Act.
- parent.hitTest(PxPosition(1.px, 1.px), hit)
+ parent.hitTest(PxPosition(1f, 1f), hit)
// Assert.
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/PointerInputTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/PointerInputTest.kt
index 1ae62d6..e82abb5 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/PointerInputTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/PointerInputTest.kt
@@ -20,7 +20,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.Uptime
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.core.IsEqual.equalTo
import org.junit.Assert.assertThat
@@ -196,7 +195,7 @@
createPointerInputChange(8f, 16f, true, 2f, 4f, true, 0f, 0f, false)
assertThat(
pointerInputChange.positionChange(),
- `is`(equalTo(PxPosition(6.px, 12.px)))
+ `is`(equalTo(PxPosition(6f, 12f)))
)
}
@@ -206,7 +205,7 @@
createPointerInputChange(8f, 16f, true, 2f, 4f, true, 5f, 9f, false)
assertThat(
pointerInputChange.positionChange(),
- `is`(equalTo(PxPosition(1.px, 3.px)))
+ `is`(equalTo(PxPosition(1f, 3f)))
)
}
@@ -236,7 +235,7 @@
createPointerInputChange(8f, 16f, true, 2f, 4f, true, 0f, 0f, false)
assertThat(
pointerInputChange.positionChangeIgnoreConsumed(),
- `is`(equalTo(PxPosition(6.px, 12.px)))
+ `is`(equalTo(PxPosition(6f, 12f)))
)
}
@@ -246,7 +245,7 @@
createPointerInputChange(8f, 16f, true, 2f, 4f, true, 5f, 9f, false)
assertThat(
pointerInputChange.positionChangeIgnoreConsumed(),
- `is`(equalTo(PxPosition(6.px, 12.px)))
+ `is`(equalTo(PxPosition(6f, 12f)))
)
}
@@ -256,7 +255,7 @@
createPointerInputChange(8f, 16f, true, 2f, 4f, true, 6f, 12f, false)
assertThat(
pointerInputChange.positionChangeIgnoreConsumed(),
- `is`(equalTo(PxPosition(6.px, 12.px)))
+ `is`(equalTo(PxPosition(6f, 12f)))
)
}
@@ -419,7 +418,7 @@
val pointerInputChange1 =
createPointerInputChange(8f, 16f, true, 2f, 4f, true, 0f, 0f, false)
- val pointerInputChangeResult1 = pointerInputChange1.consumePositionChange(0.px, 0.px)
+ val pointerInputChangeResult1 = pointerInputChange1.consumePositionChange(0f, 0f)
assertThat(pointerInputChangeResult1, `is`(equalTo(pointerInputChange1)))
}
@@ -429,9 +428,9 @@
val pointerInputChange1 =
createPointerInputChange(8f, 16f, true, 2f, 4f, true, 0f, 0f, false)
- val pointerInputChangeResult1 = pointerInputChange1.consumePositionChange(5.px, 0.px)
- val pointerInputChangeResult2 = pointerInputChange1.consumePositionChange(0.px, 3.px)
- val pointerInputChangeResult3 = pointerInputChange1.consumePositionChange(5.px, 3.px)
+ val pointerInputChangeResult1 = pointerInputChange1.consumePositionChange(5f, 0f)
+ val pointerInputChangeResult2 = pointerInputChange1.consumePositionChange(0f, 3f)
+ val pointerInputChangeResult3 = pointerInputChange1.consumePositionChange(5f, 3f)
assertThat(
pointerInputChangeResult1,
@@ -452,9 +451,9 @@
val pointerInputChange1 =
createPointerInputChange(8f, 16f, true, 2f, 4f, true, 0f, 0f, false)
- val pointerInputChangeResult1 = pointerInputChange1.consumePositionChange(6.px, 0.px)
- val pointerInputChangeResult2 = pointerInputChange1.consumePositionChange(0.px, 12.px)
- val pointerInputChangeResult3 = pointerInputChange1.consumePositionChange(6.px, 12.px)
+ val pointerInputChangeResult1 = pointerInputChange1.consumePositionChange(6f, 0f)
+ val pointerInputChangeResult2 = pointerInputChange1.consumePositionChange(0f, 12f)
+ val pointerInputChangeResult3 = pointerInputChange1.consumePositionChange(6f, 12f)
assertThat(
pointerInputChangeResult1,
@@ -475,9 +474,9 @@
val pointerInputChange1 =
createPointerInputChange(8f, 16f, true, 2f, 4f, true, 1f, 5f, false)
- val pointerInputChangeResult1 = pointerInputChange1.consumePositionChange(2.px, 0.px)
- val pointerInputChangeResult2 = pointerInputChange1.consumePositionChange(0.px, 3.px)
- val pointerInputChangeResult3 = pointerInputChange1.consumePositionChange(2.px, 3.px)
+ val pointerInputChangeResult1 = pointerInputChange1.consumePositionChange(2f, 0f)
+ val pointerInputChangeResult2 = pointerInputChange1.consumePositionChange(0f, 3f)
+ val pointerInputChangeResult3 = pointerInputChange1.consumePositionChange(2f, 3f)
assertThat(
pointerInputChangeResult1,
@@ -584,15 +583,15 @@
PointerId(0),
PointerInputData(
Uptime.Boot + 100.milliseconds,
- PxPosition(currentX.px, currentY.px),
+ PxPosition(currentX, currentY),
currentDown
),
PointerInputData(
Uptime.Boot + 0.milliseconds,
- PxPosition(previousX.px, previousY.px),
+ PxPosition(previousX, previousY),
previousDown
),
- ConsumedData(PxPosition(consumedX.px, consumedY.px), consumedDown)
+ ConsumedData(PxPosition(consumedX, consumedY), consumedDown)
)
}
}
\ No newline at end of file
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/gesture/DoubleTapGestureFilterTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/gesture/DoubleTapGestureFilterTest.kt
index 99bc41f..f7c77ed 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/gesture/DoubleTapGestureFilterTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/gesture/DoubleTapGestureFilterTest.kt
@@ -30,7 +30,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.ipx
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.mock
@@ -543,7 +542,7 @@
filter::onPointerInput.invokeOverAllPasses(move2)
filter::onPointerInput.invokeOverAllPasses(up2)
- verify(onDoubleTap).invoke(PxPosition(3.px, 5.px))
+ verify(onDoubleTap).invoke(PxPosition(3f, 5f))
}
@Test
@@ -566,7 +565,7 @@
filter::onPointerInput.invokeOverAllPasses(up2A, move2B2)
filter::onPointerInput.invokeOverAllPasses(up2B)
- verify(onDoubleTap).invoke(PxPosition((7).px, (11).px))
+ verify(onDoubleTap).invoke(PxPosition(7f, 11f))
}
// Tests that verify correct consumption behavior
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/gesture/DragSlopExceededGestureFilterTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/gesture/DragSlopExceededGestureFilterTest.kt
index ae0a325..cd4a7fc 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/gesture/DragSlopExceededGestureFilterTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/gesture/DragSlopExceededGestureFilterTest.kt
@@ -28,7 +28,6 @@
import androidx.ui.testutils.up
import androidx.ui.unit.Duration
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test
@@ -786,8 +785,8 @@
// Assert
assertThat(result.consumed.downChange).isFalse()
- assertThat(result.consumed.positionChange.x).isEqualTo(0.px)
- assertThat(result.consumed.positionChange.y).isEqualTo(0.px)
+ assertThat(result.consumed.positionChange.x).isEqualTo(0f)
+ assertThat(result.consumed.positionChange.y).isEqualTo(0f)
}
@Test
@@ -802,8 +801,8 @@
// Assert
assertThat(result.consumed.downChange).isFalse()
- assertThat(result.consumed.positionChange.x).isEqualTo(0.px)
- assertThat(result.consumed.positionChange.y).isEqualTo(0.px)
+ assertThat(result.consumed.positionChange.x).isEqualTo(0f)
+ assertThat(result.consumed.positionChange.y).isEqualTo(0f)
}
@Test
@@ -821,8 +820,8 @@
// Assert
assertThat(result.consumed.downChange).isFalse()
- assertThat(result.consumed.positionChange.x).isEqualTo(0.px)
- assertThat(result.consumed.positionChange.y).isEqualTo(0.px)
+ assertThat(result.consumed.positionChange.x).isEqualTo(0f)
+ assertThat(result.consumed.positionChange.y).isEqualTo(0f)
}
@Test
@@ -838,8 +837,8 @@
// Assert
assertThat(result.consumed.downChange).isFalse()
- assertThat(result.consumed.positionChange.x).isEqualTo(0.px)
- assertThat(result.consumed.positionChange.y).isEqualTo(0.px)
+ assertThat(result.consumed.positionChange.x).isEqualTo(0f)
+ assertThat(result.consumed.positionChange.y).isEqualTo(0f)
}
@Test
@@ -858,8 +857,8 @@
// Assert
assertThat(result.consumed.downChange).isFalse()
- assertThat(result.consumed.positionChange.x).isEqualTo(0.px)
- assertThat(result.consumed.positionChange.y).isEqualTo(0.px)
+ assertThat(result.consumed.positionChange.x).isEqualTo(0f)
+ assertThat(result.consumed.positionChange.y).isEqualTo(0f)
}
// Verification that TouchSlopExceededGestureDetector resets after up correctly.
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/gesture/LongPressGestureFilterTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/gesture/LongPressGestureFilterTest.kt
index 909cea1..d4b6d4a 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/gesture/LongPressGestureFilterTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/gesture/LongPressGestureFilterTest.kt
@@ -30,7 +30,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.ipx
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.mock
@@ -277,7 +276,7 @@
filter::onPointerInput.invokeOverAllPasses(down)
testContext.advanceTimeBy(100, TimeUnit.MILLISECONDS)
- verify(onLongPress).invoke(PxPosition(13.px, 17.px))
+ verify(onLongPress).invoke(PxPosition(13f, 17f))
}
@Test
@@ -290,7 +289,7 @@
filter::onPointerInput.invokeOverAllPasses(move)
testContext.advanceTimeBy(50, TimeUnit.MILLISECONDS)
- verify(onLongPress).invoke(PxPosition((7).px, 5.px))
+ verify(onLongPress).invoke(PxPosition(7f, 5f))
}
@Test
@@ -305,7 +304,7 @@
filter::onPointerInput.invokeOverAllPasses(move0, down1)
testContext.advanceTimeBy(50, TimeUnit.MILLISECONDS)
- verify(onLongPress).invoke(PxPosition(13.px, 17.px))
+ verify(onLongPress).invoke(PxPosition(13f, 17f))
}
@Test
@@ -325,7 +324,7 @@
filter::onPointerInput.invokeOverAllPasses(up0, move1)
testContext.advanceTimeBy(25, TimeUnit.MILLISECONDS)
- verify(onLongPress).invoke(PxPosition(11.px, 19.px))
+ verify(onLongPress).invoke(PxPosition(11f, 19f))
}
@Test
@@ -340,7 +339,7 @@
filter::onPointerInput.invokeOverAllPasses(move0, down1)
testContext.advanceTimeBy(50, TimeUnit.MILLISECONDS)
- verify(onLongPress).invoke(PxPosition(27.px, 29.px))
+ verify(onLongPress).invoke(PxPosition(27f, 29f))
}
@Test
@@ -360,7 +359,7 @@
filter::onPointerInput.invokeOverAllPasses(up0, move1)
testContext.advanceTimeBy(50, TimeUnit.MILLISECONDS)
- verify(onLongPress).invoke(PxPosition(27.px, 23.px))
+ verify(onLongPress).invoke(PxPosition(27f, 23f))
}
// Tests that verify that consumption behavior
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/gesture/PressIndicatorGestureFilterTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/gesture/PressIndicatorGestureFilterTest.kt
index f5ac282..42153bb 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/gesture/PressIndicatorGestureFilterTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/gesture/PressIndicatorGestureFilterTest.kt
@@ -29,7 +29,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.ipx
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.inOrder
import com.nhaarman.mockitokotlin2.mock
@@ -449,7 +448,7 @@
fun onPointerInput_down_downPositionIsCorrect() {
filter::onPointerInput
.invokeOverAllPasses(down(0, 0.milliseconds, x = 13f, y = 17f))
- verify(filter.onStart!!).invoke(PxPosition(13.px, 17f.px))
+ verify(filter.onStart!!).invoke(PxPosition(13f, 17f))
}
// Verification of correct consumption behavior.
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawDragGestureFilterTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawDragGestureFilterTest.kt
index 92c4c4e..7ef81c0 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawDragGestureFilterTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawDragGestureFilterTest.kt
@@ -31,7 +31,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.ipx
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test
@@ -220,8 +219,8 @@
assertThat(onDragLog).hasSize(2)
// OnDrags get's called twice each time because RawDragGestureDetector calls it on both
// PostUp and PostDown and the distance is not consumed by PostUp.
- assertThat(onDragLog[0].pxPosition).isEqualTo(PxPosition(5.px, (-2).px))
- assertThat(onDragLog[1].pxPosition).isEqualTo(PxPosition(5.px, (-2).px))
+ assertThat(onDragLog[0].pxPosition).isEqualTo(PxPosition(5f, -2f))
+ assertThat(onDragLog[1].pxPosition).isEqualTo(PxPosition(5f, -2f))
}
@Test
@@ -240,10 +239,10 @@
change = change.moveBy(100.milliseconds, -3f, 7f)
filter::onPointerInput.invokeOverAllPasses(change)
change = change.moveBy(100.milliseconds, 11f, 13f)
- .consumePositionChange(5.px, 3.px)
+ .consumePositionChange(5f, 3f)
filter::onPointerInput.invokeOverAllPasses(change)
change = change.moveBy(100.milliseconds, -13f, -11f)
- .consumePositionChange((-3).px, (-5).px)
+ .consumePositionChange(-3f, -5f)
filter::onPointerInput.invokeOverAllPasses(change)
// Assert
@@ -252,14 +251,14 @@
assertThat(onDragLog).hasSize(8)
// OnDrags get's called twice each time because RawDragGestureDetector calls it on both
// PostUp and PostDown and the distance is not consumed by PostUp.
- assertThat(onDragLog[0].pxPosition).isEqualTo(PxPosition(3.px, (-5).px))
- assertThat(onDragLog[1].pxPosition).isEqualTo(PxPosition(3.px, (-5).px))
- assertThat(onDragLog[2].pxPosition).isEqualTo(PxPosition((-3).px, 7.px))
- assertThat(onDragLog[3].pxPosition).isEqualTo(PxPosition((-3).px, 7.px))
- assertThat(onDragLog[4].pxPosition).isEqualTo(PxPosition(6.px, 10.px))
- assertThat(onDragLog[5].pxPosition).isEqualTo(PxPosition(6.px, 10.px))
- assertThat(onDragLog[6].pxPosition).isEqualTo(PxPosition((-10).px, (-6).px))
- assertThat(onDragLog[7].pxPosition).isEqualTo(PxPosition((-10).px, (-6).px))
+ assertThat(onDragLog[0].pxPosition).isEqualTo(PxPosition(3f, -5f))
+ assertThat(onDragLog[1].pxPosition).isEqualTo(PxPosition(3f, -5f))
+ assertThat(onDragLog[2].pxPosition).isEqualTo(PxPosition(-3f, 7f))
+ assertThat(onDragLog[3].pxPosition).isEqualTo(PxPosition(-3f, 7f))
+ assertThat(onDragLog[4].pxPosition).isEqualTo(PxPosition(6f, 10f))
+ assertThat(onDragLog[5].pxPosition).isEqualTo(PxPosition(6f, 10f))
+ assertThat(onDragLog[6].pxPosition).isEqualTo(PxPosition(-10f, -6f))
+ assertThat(onDragLog[7].pxPosition).isEqualTo(PxPosition(-10f, -6f))
}
@Test
@@ -288,16 +287,10 @@
// 2 onDrags because RawDragGestureDetector calls onDrag on both PostUp and PostDown and the
// distance is never consumed.
assertThat(onDragLog[0].pxPosition).isEqualTo(
- PxPosition(
- 3.px,
- (-4).px
- )
+ PxPosition(3f, -4f)
)
assertThat(onDragLog[1].pxPosition).isEqualTo(
- PxPosition(
- 3.px,
- (-4).px
- )
+ PxPosition(3f, -4f)
)
}
@@ -398,8 +391,8 @@
val loggedStops = log.filter { it.methodName == "onStop" }
assertThat(loggedStops).hasSize(1)
val velocity = loggedStops[0].pxPosition!!
- assertThat(velocity.x.value).isWithin(.01f).of(expectedPxPerSecondDx)
- assertThat(velocity.y.value).isWithin(.01f).of(expectedPxPerSecondDy)
+ assertThat(velocity.x).isWithin(.01f).of(expectedPxPerSecondDx)
+ assertThat(velocity.y).isWithin(.01f).of(expectedPxPerSecondDy)
}
// Verification that callbacks occur in the correct order
@@ -527,8 +520,8 @@
PointerEventPass.PostDown
)
- assertThat(result.consumed.positionChange.x.value).isEqualTo(7f)
- assertThat(result.consumed.positionChange.y.value).isEqualTo(-11f)
+ assertThat(result.consumed.positionChange.x).isEqualTo(7f)
+ assertThat(result.consumed.positionChange.y).isEqualTo(-11f)
}
@Test
@@ -559,7 +552,7 @@
filter::onPointerInput.invokeOverAllPasses(move)
assertThat(log.first { it.methodName == "onStart" }.pxPosition)
- .isEqualTo(PxPosition(3.px, 4.px))
+ .isEqualTo(PxPosition(3f, 4f))
}
@Test
@@ -580,7 +573,7 @@
assertThat(log.first { it.methodName == "onStart" }.pxPosition)
// average position
- .isEqualTo(PxPosition(3.px, 4.px))
+ .isEqualTo(PxPosition(3f, 4f))
}
// Tests that verify when onCancel should not be called.
@@ -637,7 +630,7 @@
filter::onPointerInput.invokeOverAllPasses(move)
assertThat(log.first { it.methodName == "onStart" }.pxPosition)
- .isEqualTo(PxPosition(7.px, 11.px))
+ .isEqualTo(PxPosition(7f, 11f))
}
@Test
@@ -680,8 +673,8 @@
val loggedStops = log.filter { it.methodName == "onStop" }
assertThat(loggedStops).hasSize(1)
val velocity = loggedStops[0].pxPosition!!
- assertThat(velocity.x.value).isWithin(.01f).of(100f)
- assertThat(velocity.y.value).isWithin(.01f).of(100f)
+ assertThat(velocity.x).isWithin(.01f).of(100f)
+ assertThat(velocity.y).isWithin(.01f).of(100f)
}
data class LogItem(
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawPressStartGestureFilterTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawPressStartGestureFilterTest.kt
index bf25a8a..40cec62 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawPressStartGestureFilterTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawPressStartGestureFilterTest.kt
@@ -28,7 +28,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.ipx
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.never
@@ -144,7 +143,7 @@
@Test
fun onPointerInput_down_downPositionIsCorrect() {
filter::onPointerInput.invokeOverAllPasses(down(0, x = 13f, y = 17f))
- verify(filter.onPressStart).invoke(PxPosition(13.px, 17f.px))
+ verify(filter.onPressStart).invoke(PxPosition(13f, 17f))
}
// Verification of correct consumption behavior.
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawScaleGestureFilterTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawScaleGestureFilterTest.kt
index 5da5cfd..86cfa61 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawScaleGestureFilterTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawScaleGestureFilterTest.kt
@@ -28,7 +28,6 @@
import androidx.ui.testutils.up
import androidx.ui.unit.PxPosition
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test
@@ -665,9 +664,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(-1.px, 0.px))
+ .isEqualTo(PxPosition(-1f, 0f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(1.px, 0.px))
+ .isEqualTo(PxPosition(1f, 0f))
}
@Test
@@ -699,9 +698,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(0.px, -1.px))
+ .isEqualTo(PxPosition(0f, -1f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(0.px, 1.px))
+ .isEqualTo(PxPosition(0f, 1f))
}
@Test
@@ -717,9 +716,9 @@
val result = filter::onPointerInput.invokeOverAllPasses(change1, change2)
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(-1.px, -1.px))
+ .isEqualTo(PxPosition(-1f, -1f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(1.px, 1.px))
+ .isEqualTo(PxPosition(1f, 1f))
}
@Test
@@ -751,9 +750,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(1.px, 0.px))
+ .isEqualTo(PxPosition(1f, 0f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(-1.px, 0.px))
+ .isEqualTo(PxPosition(-1f, 0f))
}
@Test
@@ -785,9 +784,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(0.px, 1.px))
+ .isEqualTo(PxPosition(0f, 1f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(0.px, -1.px))
+ .isEqualTo(PxPosition(0f, -1f))
}
@Test
@@ -802,8 +801,8 @@
change2 = change2.moveTo(10.milliseconds, 6f, 6f)
val result = filter::onPointerInput.invokeOverAllPasses(change1, change2)
- assertThat(result[0].consumed.positionChange).isEqualTo(PxPosition(2.px, 2.px))
- assertThat(result[1].consumed.positionChange).isEqualTo(PxPosition(-2.px, -2.px))
+ assertThat(result[0].consumed.positionChange).isEqualTo(PxPosition(2f, 2f))
+ assertThat(result[1].consumed.positionChange).isEqualTo(PxPosition(-2f, -2f))
}
@Test
@@ -837,9 +836,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(-1.px, 0.px))
+ .isEqualTo(PxPosition(-1f, 0f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(1.px, 0.px))
+ .isEqualTo(PxPosition(1f, 0f))
}
@Test
@@ -871,9 +870,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(0.px, -1.px))
+ .isEqualTo(PxPosition(0f, -1f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(0.px, 1.px))
+ .isEqualTo(PxPosition(0f, 1f))
}
@Test
@@ -905,9 +904,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(1.px, 0.px))
+ .isEqualTo(PxPosition(1f, 0f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(-1.px, 0.px))
+ .isEqualTo(PxPosition(-1f, 0f))
}
@Test
@@ -939,9 +938,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(0.px, 1.px))
+ .isEqualTo(PxPosition(0f, 1f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(0.px, -1.px))
+ .isEqualTo(PxPosition(0f, -1f))
}
@Test
@@ -973,9 +972,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(.5.px, -1.5.px))
+ .isEqualTo(PxPosition(.5f, -1.5f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(-.5.px, 1.5.px))
+ .isEqualTo(PxPosition(-.5f, 1.5f))
}
@Test
@@ -1007,9 +1006,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(2.px, -1.px))
+ .isEqualTo(PxPosition(2f, -1f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(-2.px, 1.px))
+ .isEqualTo(PxPosition(-2f, 1f))
}
@Test
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/gesture/TapGestureFilterTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/gesture/TapGestureFilterTest.kt
index bef0477..7024b0e 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/gesture/TapGestureFilterTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/gesture/TapGestureFilterTest.kt
@@ -31,7 +31,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.ipx
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.never
@@ -194,7 +193,7 @@
filter::onPointerInput.invokeOverAllPasses(down)
filter::onPointerInput.invokeOverAllPasses(up)
- verify(filter.onTap).invoke(PxPosition(123.px, 456.px))
+ verify(filter.onTap).invoke(PxPosition(123f, 456f))
}
@Test
@@ -207,7 +206,7 @@
filter::onPointerInput.invokeOverAllPasses(move)
filter::onPointerInput.invokeOverAllPasses(up)
- verify(filter.onTap).invoke(PxPosition(321.px, 654.px))
+ verify(filter.onTap).invoke(PxPosition(321f, 654f))
}
@Test
@@ -227,7 +226,7 @@
filter::onPointerInput.invokeOverAllPasses(upA, moveB)
filter::onPointerInput.invokeOverAllPasses(upB)
- verify(filter.onTap).invoke(PxPosition(321.px, 654.px))
+ verify(filter.onTap).invoke(PxPosition(321f, 654f))
}
@Test
@@ -247,7 +246,7 @@
filter::onPointerInput.invokeOverAllPasses(moveA2, upB)
filter::onPointerInput.invokeOverAllPasses(upA)
- verify(filter.onTap).invoke(PxPosition(123.px, 456.px))
+ verify(filter.onTap).invoke(PxPosition(123f, 456f))
}
@Test
@@ -263,7 +262,7 @@
filter::onPointerInput.invokeOverAllPasses(up)
filter::onCustomEvent.invokeOverAllPasses(delayUpNotConsumed)
- verify(filter.onTap).invoke(PxPosition(123.px, 456.px))
+ verify(filter.onTap).invoke(PxPosition(123f, 456f))
}
@Test
@@ -286,7 +285,7 @@
filter::onPointerInput.invokeOverAllPasses(upA, moveB)
filter::onPointerInput.invokeOverAllPasses(upB)
- verify(filter.onTap).invoke(PxPosition(321.px, 654.px))
+ verify(filter.onTap).invoke(PxPosition(321f, 654f))
}
@Test
@@ -313,7 +312,7 @@
filter::onPointerInput.invokeOverAllPasses(upB)
filter::onCustomEvent.invokeOverAllPasses(delayUpNotConsumed)
- verify(filter.onTap).invoke(PxPosition(321.px, 654.px))
+ verify(filter.onTap).invoke(PxPosition(321f, 654f))
}
// Verification that the down changes should not be consumed.
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/gesture/util/VelocityTrackerTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/gesture/util/VelocityTrackerTest.kt
index b20ae74..2a2f421 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/gesture/util/VelocityTrackerTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/gesture/util/VelocityTrackerTest.kt
@@ -17,12 +17,10 @@
package androidx.ui.core.gesture.util
import androidx.ui.core.PointerInputData
-import androidx.ui.unit.Px
import androidx.ui.unit.PxPosition
import androidx.ui.unit.Uptime
import androidx.ui.unit.Velocity
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.junit.runner.RunWith
@@ -112,8 +110,8 @@
}
private fun checkVelocity(actual: Velocity, expectedDx: Float, expectedDy: Float) {
- assertThat(actual.pixelsPerSecond.x.value).isWithin(0.1f).of(expectedDx)
- assertThat(actual.pixelsPerSecond.y.value).isWithin(0.1f).of(expectedDy)
+ assertThat(actual.pixelsPerSecond.x).isWithin(0.1f).of(expectedDx)
+ assertThat(actual.pixelsPerSecond.y).isWithin(0.1f).of(expectedDy)
}
}
@@ -121,1538 +119,1538 @@
* This extracts the inline PxPosition to a separate function so that velocityEventData
* creation doesn't make the function too long for dex.
*/
-private fun createPxPosition(width: Px, height: Px) = PxPosition(width, height)
+private fun createPxPosition(width: Float, height: Float) = PxPosition(width, height)
val velocityEventData: List<PointerInputData> = listOf(
PointerInputData(
uptime = Uptime.Boot + 216690896.milliseconds,
down = true,
- position = createPxPosition(270.px, 538.2857055664062.px)
+ position = createPxPosition(270f, 538.2857055664062f)
),
PointerInputData(
uptime = Uptime.Boot + 216690906.milliseconds,
down = true,
- position = createPxPosition(270.px, 538.2857055664062.px)
+ position = createPxPosition(270f, 538.2857055664062f)
),
PointerInputData(
uptime = Uptime.Boot + 216690951.milliseconds,
down = true,
- position = createPxPosition(270.px, 530.8571166992188.px)
+ position = createPxPosition(270f, 530.8571166992188f)
),
PointerInputData(
uptime = Uptime.Boot + 216690959.milliseconds,
down = true,
- position = createPxPosition(270.px, 526.8571166992188.px)
+ position = createPxPosition(270f, 526.8571166992188f)
),
PointerInputData(
uptime = Uptime.Boot + 216690967.milliseconds,
down = true,
- position = createPxPosition(270.px, 521.4285888671875.px)
+ position = createPxPosition(270f, 521.4285888671875f)
),
PointerInputData(
uptime = Uptime.Boot + 216690975.milliseconds,
down = true,
- position = createPxPosition(270.px, 515.4285888671875.px)
+ position = createPxPosition(270f, 515.4285888671875f)
),
PointerInputData(
uptime = Uptime.Boot + 216690983.milliseconds,
down = true,
- position = createPxPosition(270.px, 506.8571472167969.px)
+ position = createPxPosition(270f, 506.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216690991.milliseconds,
down = true,
- position = createPxPosition(268.8571472167969.px, 496.px)
+ position = createPxPosition(268.8571472167969f, 496f)
),
PointerInputData(
uptime = Uptime.Boot + 216690998.milliseconds,
down = true,
- position = createPxPosition(267.4285583496094.px, 483.1428527832031.px)
+ position = createPxPosition(267.4285583496094f, 483.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216691006.milliseconds,
down = true,
- position = createPxPosition(266.28570556640625.px, 469.71429443359375.px)
+ position = createPxPosition(266.28570556640625f, 469.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216691014.milliseconds,
down = true,
- position = createPxPosition(265.4285583496094.px, 456.8571472167969.px)
+ position = createPxPosition(265.4285583496094f, 456.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216691021.milliseconds,
down = true,
- position = createPxPosition(264.28570556640625.px, 443.71429443359375.px)
+ position = createPxPosition(264.28570556640625f, 443.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216691029.milliseconds,
down = true,
- position = createPxPosition(264.px, 431.71429443359375.px)
+ position = createPxPosition(264f, 431.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216691036.milliseconds,
down = true,
- position = createPxPosition(263.4285583496094.px, 421.1428527832031.px)
+ position = createPxPosition(263.4285583496094f, 421.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216691044.milliseconds,
down = true,
- position = createPxPosition(263.4285583496094.px, 412.5714416503906.px)
+ position = createPxPosition(263.4285583496094f, 412.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216691052.milliseconds,
down = true,
- position = createPxPosition(263.4285583496094.px, 404.5714416503906.px)
+ position = createPxPosition(263.4285583496094f, 404.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216691060.milliseconds,
down = true,
- position = createPxPosition(263.4285583496094.px, 396.5714416503906.px)
+ position = createPxPosition(263.4285583496094f, 396.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216691068.milliseconds,
down = true,
- position = createPxPosition(264.5714416503906.px, 390.px)
+ position = createPxPosition(264.5714416503906f, 390f)
),
PointerInputData(
uptime = Uptime.Boot + 216691075.milliseconds,
down = true,
- position = createPxPosition(265.1428527832031.px, 384.8571472167969.px)
+ position = createPxPosition(265.1428527832031f, 384.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216691083.milliseconds,
down = true,
- position = createPxPosition(266.px, 380.28570556640625.px)
+ position = createPxPosition(266f, 380.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216691091.milliseconds,
down = true,
- position = createPxPosition(266.5714416503906.px, 376.28570556640625.px)
+ position = createPxPosition(266.5714416503906f, 376.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216691098.milliseconds,
down = true,
- position = createPxPosition(267.1428527832031.px, 373.1428527832031.px)
+ position = createPxPosition(267.1428527832031f, 373.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216691106.milliseconds,
down = true,
- position = createPxPosition(267.71429443359375.px, 370.28570556640625.px)
+ position = createPxPosition(267.71429443359375f, 370.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216691114.milliseconds,
down = true,
- position = createPxPosition(268.28570556640625.px, 367.71429443359375.px)
+ position = createPxPosition(268.28570556640625f, 367.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216691121.milliseconds,
down = true,
- position = createPxPosition(268.5714416503906.px, 366.px)
+ position = createPxPosition(268.5714416503906f, 366f)
),
PointerInputData(
uptime = Uptime.Boot + 216691130.milliseconds,
down = true,
- position = createPxPosition(268.8571472167969.px, 364.5714416503906.px)
+ position = createPxPosition(268.8571472167969f, 364.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216691137.milliseconds,
down = true,
- position = createPxPosition(269.1428527832031.px, 363.71429443359375.px)
+ position = createPxPosition(269.1428527832031f, 363.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216691145.milliseconds,
down = true,
- position = createPxPosition(269.1428527832031.px, 362.8571472167969.px)
+ position = createPxPosition(269.1428527832031f, 362.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216691153.milliseconds,
down = true,
- position = createPxPosition(269.4285583496094.px, 362.8571472167969.px)
+ position = createPxPosition(269.4285583496094f, 362.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216691168.milliseconds,
down = true,
- position = createPxPosition(268.5714416503906.px, 365.4285583496094.px)
+ position = createPxPosition(268.5714416503906f, 365.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216691176.milliseconds,
down = true,
- position = createPxPosition(267.1428527832031.px, 370.28570556640625.px)
+ position = createPxPosition(267.1428527832031f, 370.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216691183.milliseconds,
down = true,
- position = createPxPosition(265.4285583496094.px, 376.8571472167969.px)
+ position = createPxPosition(265.4285583496094f, 376.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216691191.milliseconds,
down = true,
- position = createPxPosition(263.1428527832031.px, 385.71429443359375.px)
+ position = createPxPosition(263.1428527832031f, 385.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216691199.milliseconds,
down = true,
- position = createPxPosition(261.4285583496094.px, 396.5714416503906.px)
+ position = createPxPosition(261.4285583496094f, 396.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216691207.milliseconds,
down = true,
- position = createPxPosition(259.71429443359375.px, 408.5714416503906.px)
+ position = createPxPosition(259.71429443359375f, 408.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216691215.milliseconds,
down = true,
- position = createPxPosition(258.28570556640625.px, 419.4285583496094.px)
+ position = createPxPosition(258.28570556640625f, 419.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216691222.milliseconds,
down = true,
- position = createPxPosition(257.4285583496094.px, 428.5714416503906.px)
+ position = createPxPosition(257.4285583496094f, 428.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216691230.milliseconds,
down = true,
- position = createPxPosition(256.28570556640625.px, 436.px)
+ position = createPxPosition(256.28570556640625f, 436f)
),
PointerInputData(
uptime = Uptime.Boot + 216691238.milliseconds,
down = true,
- position = createPxPosition(255.7142791748047.px, 442.px)
+ position = createPxPosition(255.7142791748047f, 442f)
),
PointerInputData(
uptime = Uptime.Boot + 216691245.milliseconds,
down = true,
- position = createPxPosition(255.14285278320312.px, 447.71429443359375.px)
+ position = createPxPosition(255.14285278320312f, 447.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216691253.milliseconds,
down = true,
- position = createPxPosition(254.85714721679688.px, 453.1428527832031.px)
+ position = createPxPosition(254.85714721679688f, 453.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216691261.milliseconds,
down = true,
- position = createPxPosition(254.57142639160156.px, 458.5714416503906.px)
+ position = createPxPosition(254.57142639160156f, 458.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216691268.milliseconds,
down = true,
- position = createPxPosition(254.2857208251953.px, 463.71429443359375.px)
+ position = createPxPosition(254.2857208251953f, 463.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216691276.milliseconds,
down = true,
- position = createPxPosition(254.2857208251953.px, 470.28570556640625.px)
+ position = createPxPosition(254.2857208251953f, 470.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216691284.milliseconds,
down = true,
- position = createPxPosition(254.2857208251953.px, 477.71429443359375.px)
+ position = createPxPosition(254.2857208251953f, 477.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216691292.milliseconds,
down = true,
- position = createPxPosition(255.7142791748047.px, 487.1428527832031.px)
+ position = createPxPosition(255.7142791748047f, 487.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216691300.milliseconds,
down = true,
- position = createPxPosition(256.8571472167969.px, 498.5714416503906.px)
+ position = createPxPosition(256.8571472167969f, 498.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216691307.milliseconds,
down = true,
- position = createPxPosition(258.28570556640625.px, 507.71429443359375.px)
+ position = createPxPosition(258.28570556640625f, 507.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216691315.milliseconds,
down = true,
- position = createPxPosition(259.4285583496094.px, 516.px)
+ position = createPxPosition(259.4285583496094f, 516f)
),
PointerInputData(
uptime = Uptime.Boot + 216691323.milliseconds,
down = true,
- position = createPxPosition(260.28570556640625.px, 521.7142944335938.px)
+ position = createPxPosition(260.28570556640625f, 521.7142944335938f)
),
PointerInputData(
uptime = Uptime.Boot + 216691338.milliseconds,
down = false,
- position = createPxPosition(260.28570556640625.px, 521.7142944335938.px)
+ position = createPxPosition(260.28570556640625f, 521.7142944335938f)
),
PointerInputData(
uptime = Uptime.Boot + 216691573.milliseconds,
down = true,
- position = createPxPosition(266.px, 327.4285583496094.px)
+ position = createPxPosition(266f, 327.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216691588.milliseconds,
down = true,
- position = createPxPosition(266.px, 327.4285583496094.px)
+ position = createPxPosition(266f, 327.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216691626.milliseconds,
down = true,
- position = createPxPosition(261.1428527832031.px, 337.1428527832031.px)
+ position = createPxPosition(261.1428527832031f, 337.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216691634.milliseconds,
down = true,
- position = createPxPosition(258.28570556640625.px, 343.1428527832031.px)
+ position = createPxPosition(258.28570556640625f, 343.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216691642.milliseconds,
down = true,
- position = createPxPosition(254.57142639160156.px, 354.px)
+ position = createPxPosition(254.57142639160156f, 354f)
),
PointerInputData(
uptime = Uptime.Boot + 216691650.milliseconds,
down = true,
- position = createPxPosition(250.2857208251953.px, 368.28570556640625.px)
+ position = createPxPosition(250.2857208251953f, 368.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216691657.milliseconds,
down = true,
- position = createPxPosition(247.42857360839844.px, 382.8571472167969.px)
+ position = createPxPosition(247.42857360839844f, 382.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216691665.milliseconds,
down = true,
- position = createPxPosition(245.14285278320312.px, 397.4285583496094.px)
+ position = createPxPosition(245.14285278320312f, 397.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216691673.milliseconds,
down = true,
- position = createPxPosition(243.14285278320312.px, 411.71429443359375.px)
+ position = createPxPosition(243.14285278320312f, 411.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216691680.milliseconds,
down = true,
- position = createPxPosition(242.2857208251953.px, 426.28570556640625.px)
+ position = createPxPosition(242.2857208251953f, 426.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216691688.milliseconds,
down = true,
- position = createPxPosition(241.7142791748047.px, 440.5714416503906.px)
+ position = createPxPosition(241.7142791748047f, 440.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216691696.milliseconds,
down = true,
- position = createPxPosition(241.7142791748047.px, 454.5714416503906.px)
+ position = createPxPosition(241.7142791748047f, 454.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216691703.milliseconds,
down = true,
- position = createPxPosition(242.57142639160156.px, 467.71429443359375.px)
+ position = createPxPosition(242.57142639160156f, 467.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216691712.milliseconds,
down = true,
- position = createPxPosition(243.42857360839844.px, 477.4285583496094.px)
+ position = createPxPosition(243.42857360839844f, 477.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216691720.milliseconds,
down = true,
- position = createPxPosition(244.85714721679688.px, 485.71429443359375.px)
+ position = createPxPosition(244.85714721679688f, 485.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216691727.milliseconds,
down = true,
- position = createPxPosition(246.2857208251953.px, 493.1428527832031.px)
+ position = createPxPosition(246.2857208251953f, 493.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216691735.milliseconds,
down = true,
- position = createPxPosition(248.px, 499.71429443359375.px)
+ position = createPxPosition(248f, 499.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216691750.milliseconds,
down = false,
- position = createPxPosition(248.px, 499.71429443359375.px)
+ position = createPxPosition(248f, 499.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216692255.milliseconds,
down = true,
- position = createPxPosition(249.42857360839844.px, 351.4285583496094.px)
+ position = createPxPosition(249.42857360839844f, 351.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216692270.milliseconds,
down = true,
- position = createPxPosition(249.42857360839844.px, 351.4285583496094.px)
+ position = createPxPosition(249.42857360839844f, 351.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216692309.milliseconds,
down = true,
- position = createPxPosition(246.2857208251953.px, 361.71429443359375.px)
+ position = createPxPosition(246.2857208251953f, 361.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216692317.milliseconds,
down = true,
- position = createPxPosition(244.px, 368.5714416503906.px)
+ position = createPxPosition(244f, 368.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216692325.milliseconds,
down = true,
- position = createPxPosition(241.42857360839844.px, 377.71429443359375.px)
+ position = createPxPosition(241.42857360839844f, 377.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216692333.milliseconds,
down = true,
- position = createPxPosition(237.7142791748047.px, 391.71429443359375.px)
+ position = createPxPosition(237.7142791748047f, 391.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216692340.milliseconds,
down = true,
- position = createPxPosition(235.14285278320312.px, 406.5714416503906.px)
+ position = createPxPosition(235.14285278320312f, 406.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216692348.milliseconds,
down = true,
- position = createPxPosition(232.57142639160156.px, 421.4285583496094.px)
+ position = createPxPosition(232.57142639160156f, 421.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216692356.milliseconds,
down = true,
- position = createPxPosition(230.2857208251953.px, 436.5714416503906.px)
+ position = createPxPosition(230.2857208251953f, 436.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216692363.milliseconds,
down = true,
- position = createPxPosition(228.2857208251953.px, 451.71429443359375.px)
+ position = createPxPosition(228.2857208251953f, 451.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216692371.milliseconds,
down = true,
- position = createPxPosition(227.42857360839844.px, 466.px)
+ position = createPxPosition(227.42857360839844f, 466f)
),
PointerInputData(
uptime = Uptime.Boot + 216692378.milliseconds,
down = true,
- position = createPxPosition(226.2857208251953.px, 479.71429443359375.px)
+ position = createPxPosition(226.2857208251953f, 479.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216692387.milliseconds,
down = true,
- position = createPxPosition(225.7142791748047.px, 491.71429443359375.px)
+ position = createPxPosition(225.7142791748047f, 491.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216692395.milliseconds,
down = true,
- position = createPxPosition(225.14285278320312.px, 501.71429443359375.px)
+ position = createPxPosition(225.14285278320312f, 501.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216692402.milliseconds,
down = true,
- position = createPxPosition(224.85714721679688.px, 509.1428527832031.px)
+ position = createPxPosition(224.85714721679688f, 509.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216692410.milliseconds,
down = true,
- position = createPxPosition(224.57142639160156.px, 514.8571166992188.px)
+ position = createPxPosition(224.57142639160156f, 514.8571166992188f)
),
PointerInputData(
uptime = Uptime.Boot + 216692418.milliseconds,
down = true,
- position = createPxPosition(224.2857208251953.px, 519.4285888671875.px)
+ position = createPxPosition(224.2857208251953f, 519.4285888671875f)
),
PointerInputData(
uptime = Uptime.Boot + 216692425.milliseconds,
down = true,
- position = createPxPosition(224.px, 523.4285888671875.px)
+ position = createPxPosition(224f, 523.4285888671875f)
),
PointerInputData(
uptime = Uptime.Boot + 216692433.milliseconds,
down = true,
- position = createPxPosition(224.px, 527.1428833007812.px)
+ position = createPxPosition(224f, 527.1428833007812f)
),
PointerInputData(
uptime = Uptime.Boot + 216692441.milliseconds,
down = true,
- position = createPxPosition(224.px, 530.5714111328125.px)
+ position = createPxPosition(224f, 530.5714111328125f)
),
PointerInputData(
uptime = Uptime.Boot + 216692448.milliseconds,
down = true,
- position = createPxPosition(224.px, 533.1428833007812.px)
+ position = createPxPosition(224f, 533.1428833007812f)
),
PointerInputData(
uptime = Uptime.Boot + 216692456.milliseconds,
down = true,
- position = createPxPosition(224.px, 535.4285888671875.px)
+ position = createPxPosition(224f, 535.4285888671875f)
),
PointerInputData(
uptime = Uptime.Boot + 216692464.milliseconds,
down = true,
- position = createPxPosition(223.7142791748047.px, 536.8571166992188.px)
+ position = createPxPosition(223.7142791748047f, 536.8571166992188f)
),
PointerInputData(
uptime = Uptime.Boot + 216692472.milliseconds,
down = true,
- position = createPxPosition(223.7142791748047.px, 538.2857055664062.px)
+ position = createPxPosition(223.7142791748047f, 538.2857055664062f)
),
PointerInputData(
uptime = Uptime.Boot + 216692487.milliseconds,
down = false,
- position = createPxPosition(223.7142791748047.px, 538.2857055664062.px)
+ position = createPxPosition(223.7142791748047f, 538.2857055664062f)
),
PointerInputData(
uptime = Uptime.Boot + 216692678.milliseconds,
down = true,
- position = createPxPosition(221.42857360839844.px, 526.2857055664062.px)
+ position = createPxPosition(221.42857360839844f, 526.2857055664062f)
),
PointerInputData(
uptime = Uptime.Boot + 216692701.milliseconds,
down = true,
- position = createPxPosition(220.57142639160156.px, 514.8571166992188.px)
+ position = createPxPosition(220.57142639160156f, 514.8571166992188f)
),
PointerInputData(
uptime = Uptime.Boot + 216692708.milliseconds,
down = true,
- position = createPxPosition(220.2857208251953.px, 508.px)
+ position = createPxPosition(220.2857208251953f, 508f)
),
PointerInputData(
uptime = Uptime.Boot + 216692716.milliseconds,
down = true,
- position = createPxPosition(220.2857208251953.px, 498.px)
+ position = createPxPosition(220.2857208251953f, 498f)
),
PointerInputData(
uptime = Uptime.Boot + 216692724.milliseconds,
down = true,
- position = createPxPosition(221.14285278320312.px, 484.28570556640625.px)
+ position = createPxPosition(221.14285278320312f, 484.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216692732.milliseconds,
down = true,
- position = createPxPosition(221.7142791748047.px, 469.4285583496094.px)
+ position = createPxPosition(221.7142791748047f, 469.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216692740.milliseconds,
down = true,
- position = createPxPosition(223.42857360839844.px, 453.1428527832031.px)
+ position = createPxPosition(223.42857360839844f, 453.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216692748.milliseconds,
down = true,
- position = createPxPosition(225.7142791748047.px, 436.28570556640625.px)
+ position = createPxPosition(225.7142791748047f, 436.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216692755.milliseconds,
down = true,
- position = createPxPosition(229.14285278320312.px, 418.28570556640625.px)
+ position = createPxPosition(229.14285278320312f, 418.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216692763.milliseconds,
down = true,
- position = createPxPosition(232.85714721679688.px, 400.28570556640625.px)
+ position = createPxPosition(232.85714721679688f, 400.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216692770.milliseconds,
down = true,
- position = createPxPosition(236.85714721679688.px, 382.5714416503906.px)
+ position = createPxPosition(236.85714721679688f, 382.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216692778.milliseconds,
down = true,
- position = createPxPosition(241.14285278320312.px, 366.px)
+ position = createPxPosition(241.14285278320312f, 366f)
),
PointerInputData(
uptime = Uptime.Boot + 216692786.milliseconds,
down = true,
- position = createPxPosition(244.85714721679688.px, 350.28570556640625.px)
+ position = createPxPosition(244.85714721679688f, 350.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216692793.milliseconds,
down = true,
- position = createPxPosition(249.14285278320312.px, 335.4285583496094.px)
+ position = createPxPosition(249.14285278320312f, 335.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216692809.milliseconds,
down = false,
- position = createPxPosition(249.14285278320312.px, 335.4285583496094.px)
+ position = createPxPosition(249.14285278320312f, 335.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216693222.milliseconds,
down = true,
- position = createPxPosition(224.px, 545.4285888671875.px)
+ position = createPxPosition(224f, 545.4285888671875f)
),
PointerInputData(
uptime = Uptime.Boot + 216693245.milliseconds,
down = true,
- position = createPxPosition(224.px, 545.4285888671875.px)
+ position = createPxPosition(224f, 545.4285888671875f)
),
PointerInputData(
uptime = Uptime.Boot + 216693275.milliseconds,
down = true,
- position = createPxPosition(222.85714721679688.px, 535.1428833007812.px)
+ position = createPxPosition(222.85714721679688f, 535.1428833007812f)
),
PointerInputData(
uptime = Uptime.Boot + 216693284.milliseconds,
down = true,
- position = createPxPosition(222.85714721679688.px, 528.8571166992188.px)
+ position = createPxPosition(222.85714721679688f, 528.8571166992188f)
),
PointerInputData(
uptime = Uptime.Boot + 216693291.milliseconds,
down = true,
- position = createPxPosition(222.2857208251953.px, 518.5714111328125.px)
+ position = createPxPosition(222.2857208251953f, 518.5714111328125f)
),
PointerInputData(
uptime = Uptime.Boot + 216693299.milliseconds,
down = true,
- position = createPxPosition(222.px, 503.4285583496094.px)
+ position = createPxPosition(222f, 503.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216693307.milliseconds,
down = true,
- position = createPxPosition(222.px, 485.4285583496094.px)
+ position = createPxPosition(222f, 485.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216693314.milliseconds,
down = true,
- position = createPxPosition(221.7142791748047.px, 464.px)
+ position = createPxPosition(221.7142791748047f, 464f)
),
PointerInputData(
uptime = Uptime.Boot + 216693322.milliseconds,
down = true,
- position = createPxPosition(222.2857208251953.px, 440.28570556640625.px)
+ position = createPxPosition(222.2857208251953f, 440.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216693337.milliseconds,
down = false,
- position = createPxPosition(222.2857208251953.px, 440.28570556640625.px)
+ position = createPxPosition(222.2857208251953f, 440.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216693985.milliseconds,
down = true,
- position = createPxPosition(208.px, 544.px)
+ position = createPxPosition(208f, 544f)
),
PointerInputData(
uptime = Uptime.Boot + 216694047.milliseconds,
down = true,
- position = createPxPosition(208.57142639160156.px, 532.2857055664062.px)
+ position = createPxPosition(208.57142639160156f, 532.2857055664062f)
),
PointerInputData(
uptime = Uptime.Boot + 216694054.milliseconds,
down = true,
- position = createPxPosition(208.85714721679688.px, 525.7142944335938.px)
+ position = createPxPosition(208.85714721679688f, 525.7142944335938f)
),
PointerInputData(
uptime = Uptime.Boot + 216694062.milliseconds,
down = true,
- position = createPxPosition(208.85714721679688.px, 515.1428833007812.px)
+ position = createPxPosition(208.85714721679688f, 515.1428833007812f)
),
PointerInputData(
uptime = Uptime.Boot + 216694070.milliseconds,
down = true,
- position = createPxPosition(208.px, 501.4285583496094.px)
+ position = createPxPosition(208f, 501.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216694077.milliseconds,
down = true,
- position = createPxPosition(207.42857360839844.px, 487.1428527832031.px)
+ position = createPxPosition(207.42857360839844f, 487.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216694085.milliseconds,
down = true,
- position = createPxPosition(206.57142639160156.px, 472.8571472167969.px)
+ position = createPxPosition(206.57142639160156f, 472.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216694092.milliseconds,
down = true,
- position = createPxPosition(206.57142639160156.px, 458.8571472167969.px)
+ position = createPxPosition(206.57142639160156f, 458.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216694100.milliseconds,
down = true,
- position = createPxPosition(206.57142639160156.px, 446.px)
+ position = createPxPosition(206.57142639160156f, 446f)
),
PointerInputData(
uptime = Uptime.Boot + 216694108.milliseconds,
down = true,
- position = createPxPosition(206.57142639160156.px, 434.28570556640625.px)
+ position = createPxPosition(206.57142639160156f, 434.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216694116.milliseconds,
down = true,
- position = createPxPosition(207.14285278320312.px, 423.71429443359375.px)
+ position = createPxPosition(207.14285278320312f, 423.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216694124.milliseconds,
down = true,
- position = createPxPosition(208.57142639160156.px, 412.8571472167969.px)
+ position = createPxPosition(208.57142639160156f, 412.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216694131.milliseconds,
down = true,
- position = createPxPosition(209.7142791748047.px, 402.28570556640625.px)
+ position = createPxPosition(209.7142791748047f, 402.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216694139.milliseconds,
down = true,
- position = createPxPosition(211.7142791748047.px, 393.1428527832031.px)
+ position = createPxPosition(211.7142791748047f, 393.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216694147.milliseconds,
down = true,
- position = createPxPosition(213.42857360839844.px, 385.1428527832031.px)
+ position = createPxPosition(213.42857360839844f, 385.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216694154.milliseconds,
down = true,
- position = createPxPosition(215.42857360839844.px, 378.28570556640625.px)
+ position = createPxPosition(215.42857360839844f, 378.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216694162.milliseconds,
down = true,
- position = createPxPosition(217.42857360839844.px, 371.71429443359375.px)
+ position = createPxPosition(217.42857360839844f, 371.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216694169.milliseconds,
down = true,
- position = createPxPosition(219.42857360839844.px, 366.px)
+ position = createPxPosition(219.42857360839844f, 366f)
),
PointerInputData(
uptime = Uptime.Boot + 216694177.milliseconds,
down = true,
- position = createPxPosition(221.42857360839844.px, 360.8571472167969.px)
+ position = createPxPosition(221.42857360839844f, 360.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216694185.milliseconds,
down = true,
- position = createPxPosition(223.42857360839844.px, 356.5714416503906.px)
+ position = createPxPosition(223.42857360839844f, 356.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216694193.milliseconds,
down = true,
- position = createPxPosition(225.14285278320312.px, 352.28570556640625.px)
+ position = createPxPosition(225.14285278320312f, 352.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216694201.milliseconds,
down = true,
- position = createPxPosition(226.85714721679688.px, 348.5714416503906.px)
+ position = createPxPosition(226.85714721679688f, 348.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216694209.milliseconds,
down = true,
- position = createPxPosition(228.2857208251953.px, 346.px)
+ position = createPxPosition(228.2857208251953f, 346f)
),
PointerInputData(
uptime = Uptime.Boot + 216694216.milliseconds,
down = true,
- position = createPxPosition(229.14285278320312.px, 343.71429443359375.px)
+ position = createPxPosition(229.14285278320312f, 343.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216694224.milliseconds,
down = true,
- position = createPxPosition(230.px, 342.px)
+ position = createPxPosition(230f, 342f)
),
PointerInputData(
uptime = Uptime.Boot + 216694232.milliseconds,
down = true,
- position = createPxPosition(230.57142639160156.px, 340.5714416503906.px)
+ position = createPxPosition(230.57142639160156f, 340.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216694239.milliseconds,
down = true,
- position = createPxPosition(230.85714721679688.px, 339.71429443359375.px)
+ position = createPxPosition(230.85714721679688f, 339.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216694247.milliseconds,
down = true,
- position = createPxPosition(230.85714721679688.px, 339.4285583496094.px)
+ position = createPxPosition(230.85714721679688f, 339.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216694262.milliseconds,
down = true,
- position = createPxPosition(230.2857208251953.px, 342.px)
+ position = createPxPosition(230.2857208251953f, 342f)
),
PointerInputData(
uptime = Uptime.Boot + 216694270.milliseconds,
down = true,
- position = createPxPosition(228.85714721679688.px, 346.28570556640625.px)
+ position = createPxPosition(228.85714721679688f, 346.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216694278.milliseconds,
down = true,
- position = createPxPosition(227.14285278320312.px, 352.5714416503906.px)
+ position = createPxPosition(227.14285278320312f, 352.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216694286.milliseconds,
down = true,
- position = createPxPosition(225.42857360839844.px, 359.4285583496094.px)
+ position = createPxPosition(225.42857360839844f, 359.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216694294.milliseconds,
down = true,
- position = createPxPosition(223.7142791748047.px, 367.71429443359375.px)
+ position = createPxPosition(223.7142791748047f, 367.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216694301.milliseconds,
down = true,
- position = createPxPosition(222.57142639160156.px, 376.px)
+ position = createPxPosition(222.57142639160156f, 376f)
),
PointerInputData(
uptime = Uptime.Boot + 216694309.milliseconds,
down = true,
- position = createPxPosition(221.42857360839844.px, 384.28570556640625.px)
+ position = createPxPosition(221.42857360839844f, 384.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216694317.milliseconds,
down = true,
- position = createPxPosition(220.85714721679688.px, 392.28570556640625.px)
+ position = createPxPosition(220.85714721679688f, 392.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216694324.milliseconds,
down = true,
- position = createPxPosition(220.px, 400.5714416503906.px)
+ position = createPxPosition(220f, 400.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216694332.milliseconds,
down = true,
- position = createPxPosition(219.14285278320312.px, 409.71429443359375.px)
+ position = createPxPosition(219.14285278320312f, 409.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216694339.milliseconds,
down = true,
- position = createPxPosition(218.85714721679688.px, 419.1428527832031.px)
+ position = createPxPosition(218.85714721679688f, 419.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216694348.milliseconds,
down = true,
- position = createPxPosition(218.2857208251953.px, 428.8571472167969.px)
+ position = createPxPosition(218.2857208251953f, 428.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216694356.milliseconds,
down = true,
- position = createPxPosition(218.2857208251953.px, 438.8571472167969.px)
+ position = createPxPosition(218.2857208251953f, 438.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216694363.milliseconds,
down = true,
- position = createPxPosition(218.2857208251953.px, 447.71429443359375.px)
+ position = createPxPosition(218.2857208251953f, 447.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216694371.milliseconds,
down = true,
- position = createPxPosition(218.2857208251953.px, 455.71429443359375.px)
+ position = createPxPosition(218.2857208251953f, 455.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216694379.milliseconds,
down = true,
- position = createPxPosition(219.14285278320312.px, 462.8571472167969.px)
+ position = createPxPosition(219.14285278320312f, 462.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216694386.milliseconds,
down = true,
- position = createPxPosition(220.px, 469.4285583496094.px)
+ position = createPxPosition(220f, 469.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216694394.milliseconds,
down = true,
- position = createPxPosition(221.14285278320312.px, 475.4285583496094.px)
+ position = createPxPosition(221.14285278320312f, 475.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216694401.milliseconds,
down = true,
- position = createPxPosition(222.px, 480.5714416503906.px)
+ position = createPxPosition(222f, 480.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216694409.milliseconds,
down = true,
- position = createPxPosition(222.85714721679688.px, 485.4285583496094.px)
+ position = createPxPosition(222.85714721679688f, 485.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216694417.milliseconds,
down = true,
- position = createPxPosition(224.px, 489.71429443359375.px)
+ position = createPxPosition(224f, 489.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216694425.milliseconds,
down = true,
- position = createPxPosition(224.85714721679688.px, 492.8571472167969.px)
+ position = createPxPosition(224.85714721679688f, 492.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216694433.milliseconds,
down = true,
- position = createPxPosition(225.42857360839844.px, 495.4285583496094.px)
+ position = createPxPosition(225.42857360839844f, 495.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216694440.milliseconds,
down = true,
- position = createPxPosition(226.px, 497.1428527832031.px)
+ position = createPxPosition(226f, 497.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216694448.milliseconds,
down = true,
- position = createPxPosition(226.2857208251953.px, 498.28570556640625.px)
+ position = createPxPosition(226.2857208251953f, 498.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216694456.milliseconds,
down = true,
- position = createPxPosition(226.2857208251953.px, 498.8571472167969.px)
+ position = createPxPosition(226.2857208251953f, 498.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216694471.milliseconds,
down = true,
- position = createPxPosition(226.2857208251953.px, 498.28570556640625.px)
+ position = createPxPosition(226.2857208251953f, 498.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216694479.milliseconds,
down = true,
- position = createPxPosition(226.2857208251953.px, 496.5714416503906.px)
+ position = createPxPosition(226.2857208251953f, 496.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216694486.milliseconds,
down = true,
- position = createPxPosition(226.2857208251953.px, 493.71429443359375.px)
+ position = createPxPosition(226.2857208251953f, 493.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216694494.milliseconds,
down = true,
- position = createPxPosition(226.2857208251953.px, 490.px)
+ position = createPxPosition(226.2857208251953f, 490f)
),
PointerInputData(
uptime = Uptime.Boot + 216694502.milliseconds,
down = true,
- position = createPxPosition(226.2857208251953.px, 486.px)
+ position = createPxPosition(226.2857208251953f, 486f)
),
PointerInputData(
uptime = Uptime.Boot + 216694510.milliseconds,
down = true,
- position = createPxPosition(226.2857208251953.px, 480.5714416503906.px)
+ position = createPxPosition(226.2857208251953f, 480.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216694518.milliseconds,
down = true,
- position = createPxPosition(226.2857208251953.px, 475.71429443359375.px)
+ position = createPxPosition(226.2857208251953f, 475.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216694525.milliseconds,
down = true,
- position = createPxPosition(226.2857208251953.px, 468.8571472167969.px)
+ position = createPxPosition(226.2857208251953f, 468.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216694533.milliseconds,
down = true,
- position = createPxPosition(226.2857208251953.px, 461.4285583496094.px)
+ position = createPxPosition(226.2857208251953f, 461.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216694541.milliseconds,
down = true,
- position = createPxPosition(226.2857208251953.px, 452.5714416503906.px)
+ position = createPxPosition(226.2857208251953f, 452.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216694548.milliseconds,
down = true,
- position = createPxPosition(226.57142639160156.px, 442.28570556640625.px)
+ position = createPxPosition(226.57142639160156f, 442.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216694556.milliseconds,
down = true,
- position = createPxPosition(226.57142639160156.px, 432.28570556640625.px)
+ position = createPxPosition(226.57142639160156f, 432.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216694564.milliseconds,
down = true,
- position = createPxPosition(226.85714721679688.px, 423.4285583496094.px)
+ position = createPxPosition(226.85714721679688f, 423.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216694571.milliseconds,
down = true,
- position = createPxPosition(227.42857360839844.px, 416.px)
+ position = createPxPosition(227.42857360839844f, 416f)
),
PointerInputData(
uptime = Uptime.Boot + 216694580.milliseconds,
down = true,
- position = createPxPosition(227.7142791748047.px, 410.px)
+ position = createPxPosition(227.7142791748047f, 410f)
),
PointerInputData(
uptime = Uptime.Boot + 216694587.milliseconds,
down = true,
- position = createPxPosition(228.2857208251953.px, 404.28570556640625.px)
+ position = createPxPosition(228.2857208251953f, 404.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216694595.milliseconds,
down = true,
- position = createPxPosition(228.85714721679688.px, 399.71429443359375.px)
+ position = createPxPosition(228.85714721679688f, 399.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216694603.milliseconds,
down = true,
- position = createPxPosition(229.14285278320312.px, 395.4285583496094.px)
+ position = createPxPosition(229.14285278320312f, 395.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216694610.milliseconds,
down = true,
- position = createPxPosition(229.42857360839844.px, 392.28570556640625.px)
+ position = createPxPosition(229.42857360839844f, 392.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216694618.milliseconds,
down = true,
- position = createPxPosition(229.7142791748047.px, 390.px)
+ position = createPxPosition(229.7142791748047f, 390f)
),
PointerInputData(
uptime = Uptime.Boot + 216694625.milliseconds,
down = true,
- position = createPxPosition(229.7142791748047.px, 388.px)
+ position = createPxPosition(229.7142791748047f, 388f)
),
PointerInputData(
uptime = Uptime.Boot + 216694633.milliseconds,
down = true,
- position = createPxPosition(229.7142791748047.px, 386.8571472167969.px)
+ position = createPxPosition(229.7142791748047f, 386.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216694641.milliseconds,
down = true,
- position = createPxPosition(229.7142791748047.px, 386.28570556640625.px)
+ position = createPxPosition(229.7142791748047f, 386.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216694648.milliseconds,
down = true,
- position = createPxPosition(229.7142791748047.px, 386.px)
+ position = createPxPosition(229.7142791748047f, 386f)
),
PointerInputData(
uptime = Uptime.Boot + 216694657.milliseconds,
down = true,
- position = createPxPosition(228.85714721679688.px, 386.px)
+ position = createPxPosition(228.85714721679688f, 386f)
),
PointerInputData(
uptime = Uptime.Boot + 216694665.milliseconds,
down = true,
- position = createPxPosition(228.px, 388.px)
+ position = createPxPosition(228f, 388f)
),
PointerInputData(
uptime = Uptime.Boot + 216694672.milliseconds,
down = true,
- position = createPxPosition(226.px, 392.5714416503906.px)
+ position = createPxPosition(226f, 392.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216694680.milliseconds,
down = true,
- position = createPxPosition(224.px, 397.71429443359375.px)
+ position = createPxPosition(224f, 397.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216694688.milliseconds,
down = true,
- position = createPxPosition(222.px, 404.28570556640625.px)
+ position = createPxPosition(222f, 404.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216694695.milliseconds,
down = true,
- position = createPxPosition(219.7142791748047.px, 411.1428527832031.px)
+ position = createPxPosition(219.7142791748047f, 411.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216694703.milliseconds,
down = true,
- position = createPxPosition(218.2857208251953.px, 418.px)
+ position = createPxPosition(218.2857208251953f, 418f)
),
PointerInputData(
uptime = Uptime.Boot + 216694710.milliseconds,
down = true,
- position = createPxPosition(217.14285278320312.px, 425.4285583496094.px)
+ position = createPxPosition(217.14285278320312f, 425.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216694718.milliseconds,
down = true,
- position = createPxPosition(215.7142791748047.px, 433.4285583496094.px)
+ position = createPxPosition(215.7142791748047f, 433.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216694726.milliseconds,
down = true,
- position = createPxPosition(214.85714721679688.px, 442.28570556640625.px)
+ position = createPxPosition(214.85714721679688f, 442.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216694734.milliseconds,
down = true,
- position = createPxPosition(214.px, 454.px)
+ position = createPxPosition(214f, 454f)
),
PointerInputData(
uptime = Uptime.Boot + 216694742.milliseconds,
down = true,
- position = createPxPosition(214.px, 469.4285583496094.px)
+ position = createPxPosition(214f, 469.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216694749.milliseconds,
down = true,
- position = createPxPosition(215.42857360839844.px, 485.4285583496094.px)
+ position = createPxPosition(215.42857360839844f, 485.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216694757.milliseconds,
down = true,
- position = createPxPosition(217.7142791748047.px, 502.8571472167969.px)
+ position = createPxPosition(217.7142791748047f, 502.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216694765.milliseconds,
down = true,
- position = createPxPosition(221.14285278320312.px, 521.4285888671875.px)
+ position = createPxPosition(221.14285278320312f, 521.4285888671875f)
),
PointerInputData(
uptime = Uptime.Boot + 216694772.milliseconds,
down = true,
- position = createPxPosition(224.57142639160156.px, 541.1428833007812.px)
+ position = createPxPosition(224.57142639160156f, 541.1428833007812f)
),
PointerInputData(
uptime = Uptime.Boot + 216694780.milliseconds,
down = true,
- position = createPxPosition(229.14285278320312.px, 561.1428833007812.px)
+ position = createPxPosition(229.14285278320312f, 561.1428833007812f)
),
PointerInputData(
uptime = Uptime.Boot + 216694788.milliseconds,
down = true,
- position = createPxPosition(233.42857360839844.px, 578.8571166992188.px)
+ position = createPxPosition(233.42857360839844f, 578.8571166992188f)
),
PointerInputData(
uptime = Uptime.Boot + 216694802.milliseconds,
down = false,
- position = createPxPosition(233.42857360839844.px, 578.8571166992188.px)
+ position = createPxPosition(233.42857360839844f, 578.8571166992188f)
),
PointerInputData(
uptime = Uptime.Boot + 216695344.milliseconds,
down = true,
- position = createPxPosition(253.42857360839844.px, 310.5714416503906.px)
+ position = createPxPosition(253.42857360839844f, 310.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216695352.milliseconds,
down = true,
- position = createPxPosition(253.42857360839844.px, 310.5714416503906.px)
+ position = createPxPosition(253.42857360839844f, 310.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216695359.milliseconds,
down = true,
- position = createPxPosition(252.85714721679688.px, 318.px)
+ position = createPxPosition(252.85714721679688f, 318f)
),
PointerInputData(
uptime = Uptime.Boot + 216695367.milliseconds,
down = true,
- position = createPxPosition(251.14285278320312.px, 322.px)
+ position = createPxPosition(251.14285278320312f, 322f)
),
PointerInputData(
uptime = Uptime.Boot + 216695375.milliseconds,
down = true,
- position = createPxPosition(248.85714721679688.px, 327.1428527832031.px)
+ position = createPxPosition(248.85714721679688f, 327.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216695382.milliseconds,
down = true,
- position = createPxPosition(246.px, 334.8571472167969.px)
+ position = createPxPosition(246f, 334.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216695390.milliseconds,
down = true,
- position = createPxPosition(242.57142639160156.px, 344.5714416503906.px)
+ position = createPxPosition(242.57142639160156f, 344.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216695397.milliseconds,
down = true,
- position = createPxPosition(238.85714721679688.px, 357.4285583496094.px)
+ position = createPxPosition(238.85714721679688f, 357.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216695406.milliseconds,
down = true,
- position = createPxPosition(235.7142791748047.px, 371.71429443359375.px)
+ position = createPxPosition(235.7142791748047f, 371.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216695414.milliseconds,
down = true,
- position = createPxPosition(232.2857208251953.px, 386.8571472167969.px)
+ position = createPxPosition(232.2857208251953f, 386.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216695421.milliseconds,
down = true,
- position = createPxPosition(229.42857360839844.px, 402.px)
+ position = createPxPosition(229.42857360839844f, 402f)
),
PointerInputData(
uptime = Uptime.Boot + 216695429.milliseconds,
down = true,
- position = createPxPosition(227.42857360839844.px, 416.8571472167969.px)
+ position = createPxPosition(227.42857360839844f, 416.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216695437.milliseconds,
down = true,
- position = createPxPosition(226.2857208251953.px, 431.4285583496094.px)
+ position = createPxPosition(226.2857208251953f, 431.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216695444.milliseconds,
down = true,
- position = createPxPosition(226.2857208251953.px, 446.px)
+ position = createPxPosition(226.2857208251953f, 446f)
),
PointerInputData(
uptime = Uptime.Boot + 216695452.milliseconds,
down = true,
- position = createPxPosition(227.7142791748047.px, 460.28570556640625.px)
+ position = createPxPosition(227.7142791748047f, 460.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216695459.milliseconds,
down = true,
- position = createPxPosition(230.px, 475.1428527832031.px)
+ position = createPxPosition(230f, 475.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216695467.milliseconds,
down = true,
- position = createPxPosition(232.2857208251953.px, 489.71429443359375.px)
+ position = createPxPosition(232.2857208251953f, 489.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216695475.milliseconds,
down = true,
- position = createPxPosition(235.7142791748047.px, 504.px)
+ position = createPxPosition(235.7142791748047f, 504f)
),
PointerInputData(
uptime = Uptime.Boot + 216695490.milliseconds,
down = false,
- position = createPxPosition(235.7142791748047.px, 504.px)
+ position = createPxPosition(235.7142791748047f, 504f)
),
PointerInputData(
uptime = Uptime.Boot + 216695885.milliseconds,
down = true,
- position = createPxPosition(238.85714721679688.px, 524.px)
+ position = createPxPosition(238.85714721679688f, 524f)
),
PointerInputData(
uptime = Uptime.Boot + 216695908.milliseconds,
down = true,
- position = createPxPosition(236.2857208251953.px, 515.7142944335938.px)
+ position = createPxPosition(236.2857208251953f, 515.7142944335938f)
),
PointerInputData(
uptime = Uptime.Boot + 216695916.milliseconds,
down = true,
- position = createPxPosition(234.85714721679688.px, 509.1428527832031.px)
+ position = createPxPosition(234.85714721679688f, 509.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216695924.milliseconds,
down = true,
- position = createPxPosition(232.57142639160156.px, 498.5714416503906.px)
+ position = createPxPosition(232.57142639160156f, 498.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216695931.milliseconds,
down = true,
- position = createPxPosition(230.57142639160156.px, 483.71429443359375.px)
+ position = createPxPosition(230.57142639160156f, 483.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216695939.milliseconds,
down = true,
- position = createPxPosition(229.14285278320312.px, 466.5714416503906.px)
+ position = createPxPosition(229.14285278320312f, 466.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216695947.milliseconds,
down = true,
- position = createPxPosition(229.14285278320312.px, 446.5714416503906.px)
+ position = createPxPosition(229.14285278320312f, 446.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216695955.milliseconds,
down = true,
- position = createPxPosition(230.57142639160156.px, 424.8571472167969.px)
+ position = createPxPosition(230.57142639160156f, 424.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216695963.milliseconds,
down = true,
- position = createPxPosition(232.57142639160156.px, 402.28570556640625.px)
+ position = createPxPosition(232.57142639160156f, 402.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216695970.milliseconds,
down = true,
- position = createPxPosition(235.14285278320312.px, 380.px)
+ position = createPxPosition(235.14285278320312f, 380f)
),
PointerInputData(
uptime = Uptime.Boot + 216695978.milliseconds,
down = true,
- position = createPxPosition(238.57142639160156.px, 359.4285583496094.px)
+ position = createPxPosition(238.57142639160156f, 359.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216695993.milliseconds,
down = false,
- position = createPxPosition(238.57142639160156.px, 359.4285583496094.px)
+ position = createPxPosition(238.57142639160156f, 359.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216696429.milliseconds,
down = true,
- position = createPxPosition(238.2857208251953.px, 568.5714111328125.px)
+ position = createPxPosition(238.2857208251953f, 568.5714111328125f)
),
PointerInputData(
uptime = Uptime.Boot + 216696459.milliseconds,
down = true,
- position = createPxPosition(234.px, 560.px)
+ position = createPxPosition(234f, 560f)
),
PointerInputData(
uptime = Uptime.Boot + 216696467.milliseconds,
down = true,
- position = createPxPosition(231.42857360839844.px, 553.1428833007812.px)
+ position = createPxPosition(231.42857360839844f, 553.1428833007812f)
),
PointerInputData(
uptime = Uptime.Boot + 216696475.milliseconds,
down = true,
- position = createPxPosition(228.2857208251953.px, 543.1428833007812.px)
+ position = createPxPosition(228.2857208251953f, 543.1428833007812f)
),
PointerInputData(
uptime = Uptime.Boot + 216696483.milliseconds,
down = true,
- position = createPxPosition(225.42857360839844.px, 528.8571166992188.px)
+ position = createPxPosition(225.42857360839844f, 528.8571166992188f)
),
PointerInputData(
uptime = Uptime.Boot + 216696491.milliseconds,
down = true,
- position = createPxPosition(223.14285278320312.px, 512.2857055664062.px)
+ position = createPxPosition(223.14285278320312f, 512.2857055664062f)
),
PointerInputData(
uptime = Uptime.Boot + 216696498.milliseconds,
down = true,
- position = createPxPosition(222.px, 495.4285583496094.px)
+ position = createPxPosition(222f, 495.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216696506.milliseconds,
down = true,
- position = createPxPosition(221.7142791748047.px, 477.4285583496094.px)
+ position = createPxPosition(221.7142791748047f, 477.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216696514.milliseconds,
down = true,
- position = createPxPosition(221.7142791748047.px, 458.28570556640625.px)
+ position = createPxPosition(221.7142791748047f, 458.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216696521.milliseconds,
down = true,
- position = createPxPosition(223.14285278320312.px, 438.px)
+ position = createPxPosition(223.14285278320312f, 438f)
),
PointerInputData(
uptime = Uptime.Boot + 216696529.milliseconds,
down = true,
- position = createPxPosition(224.2857208251953.px, 416.28570556640625.px)
+ position = createPxPosition(224.2857208251953f, 416.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216696544.milliseconds,
down = false,
- position = createPxPosition(224.2857208251953.px, 416.28570556640625.px)
+ position = createPxPosition(224.2857208251953f, 416.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216696974.milliseconds,
down = true,
- position = createPxPosition(218.57142639160156.px, 530.5714111328125.px)
+ position = createPxPosition(218.57142639160156f, 530.5714111328125f)
),
PointerInputData(
uptime = Uptime.Boot + 216697012.milliseconds,
down = true,
- position = createPxPosition(220.2857208251953.px, 522.px)
+ position = createPxPosition(220.2857208251953f, 522f)
),
PointerInputData(
uptime = Uptime.Boot + 216697020.milliseconds,
down = true,
- position = createPxPosition(221.14285278320312.px, 517.7142944335938.px)
+ position = createPxPosition(221.14285278320312f, 517.7142944335938f)
),
PointerInputData(
uptime = Uptime.Boot + 216697028.milliseconds,
down = true,
- position = createPxPosition(222.2857208251953.px, 511.71429443359375.px)
+ position = createPxPosition(222.2857208251953f, 511.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216697036.milliseconds,
down = true,
- position = createPxPosition(224.px, 504.28570556640625.px)
+ position = createPxPosition(224f, 504.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216697044.milliseconds,
down = true,
- position = createPxPosition(227.14285278320312.px, 490.5714416503906.px)
+ position = createPxPosition(227.14285278320312f, 490.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216697052.milliseconds,
down = true,
- position = createPxPosition(229.42857360839844.px, 474.px)
+ position = createPxPosition(229.42857360839844f, 474f)
),
PointerInputData(
uptime = Uptime.Boot + 216697059.milliseconds,
down = true,
- position = createPxPosition(231.42857360839844.px, 454.5714416503906.px)
+ position = createPxPosition(231.42857360839844f, 454.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216697067.milliseconds,
down = true,
- position = createPxPosition(233.7142791748047.px, 431.1428527832031.px)
+ position = createPxPosition(233.7142791748047f, 431.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216697082.milliseconds,
down = false,
- position = createPxPosition(233.7142791748047.px, 431.1428527832031.px)
+ position = createPxPosition(233.7142791748047f, 431.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216697435.milliseconds,
down = true,
- position = createPxPosition(257.1428527832031.px, 285.1428527832031.px)
+ position = createPxPosition(257.1428527832031f, 285.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216697465.milliseconds,
down = true,
- position = createPxPosition(251.7142791748047.px, 296.8571472167969.px)
+ position = createPxPosition(251.7142791748047f, 296.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216697473.milliseconds,
down = true,
- position = createPxPosition(248.2857208251953.px, 304.px)
+ position = createPxPosition(248.2857208251953f, 304f)
),
PointerInputData(
uptime = Uptime.Boot + 216697481.milliseconds,
down = true,
- position = createPxPosition(244.57142639160156.px, 314.8571472167969.px)
+ position = createPxPosition(244.57142639160156f, 314.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216697489.milliseconds,
down = true,
- position = createPxPosition(240.2857208251953.px, 329.1428527832031.px)
+ position = createPxPosition(240.2857208251953f, 329.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216697497.milliseconds,
down = true,
- position = createPxPosition(236.85714721679688.px, 345.1428527832031.px)
+ position = createPxPosition(236.85714721679688f, 345.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216697505.milliseconds,
down = true,
- position = createPxPosition(233.7142791748047.px, 361.4285583496094.px)
+ position = createPxPosition(233.7142791748047f, 361.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216697512.milliseconds,
down = true,
- position = createPxPosition(231.14285278320312.px, 378.28570556640625.px)
+ position = createPxPosition(231.14285278320312f, 378.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216697520.milliseconds,
down = true,
- position = createPxPosition(229.42857360839844.px, 395.4285583496094.px)
+ position = createPxPosition(229.42857360839844f, 395.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216697528.milliseconds,
down = true,
- position = createPxPosition(229.42857360839844.px, 412.8571472167969.px)
+ position = createPxPosition(229.42857360839844f, 412.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216697535.milliseconds,
down = true,
- position = createPxPosition(230.85714721679688.px, 430.8571472167969.px)
+ position = createPxPosition(230.85714721679688f, 430.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216697543.milliseconds,
down = true,
- position = createPxPosition(233.42857360839844.px, 449.71429443359375.px)
+ position = createPxPosition(233.42857360839844f, 449.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216697558.milliseconds,
down = false,
- position = createPxPosition(233.42857360839844.px, 449.71429443359375.px)
+ position = createPxPosition(233.42857360839844f, 449.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216697749.milliseconds,
down = true,
- position = createPxPosition(246.px, 311.4285583496094.px)
+ position = createPxPosition(246f, 311.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216697780.milliseconds,
down = true,
- position = createPxPosition(244.57142639160156.px, 318.28570556640625.px)
+ position = createPxPosition(244.57142639160156f, 318.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216697787.milliseconds,
down = true,
- position = createPxPosition(243.14285278320312.px, 325.4285583496094.px)
+ position = createPxPosition(243.14285278320312f, 325.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216697795.milliseconds,
down = true,
- position = createPxPosition(241.42857360839844.px, 336.px)
+ position = createPxPosition(241.42857360839844f, 336f)
),
PointerInputData(
uptime = Uptime.Boot + 216697803.milliseconds,
down = true,
- position = createPxPosition(239.7142791748047.px, 351.1428527832031.px)
+ position = createPxPosition(239.7142791748047f, 351.1428527832031f)
),
PointerInputData(
uptime = Uptime.Boot + 216697811.milliseconds,
down = true,
- position = createPxPosition(238.2857208251953.px, 368.5714416503906.px)
+ position = createPxPosition(238.2857208251953f, 368.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216697819.milliseconds,
down = true,
- position = createPxPosition(238.px, 389.4285583496094.px)
+ position = createPxPosition(238f, 389.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216697826.milliseconds,
down = true,
- position = createPxPosition(239.14285278320312.px, 412.px)
+ position = createPxPosition(239.14285278320312f, 412f)
),
PointerInputData(
uptime = Uptime.Boot + 216697834.milliseconds,
down = true,
- position = createPxPosition(242.2857208251953.px, 438.px)
+ position = createPxPosition(242.2857208251953f, 438f)
),
PointerInputData(
uptime = Uptime.Boot + 216697842.milliseconds,
down = true,
- position = createPxPosition(247.42857360839844.px, 466.8571472167969.px)
+ position = createPxPosition(247.42857360839844f, 466.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216697849.milliseconds,
down = true,
- position = createPxPosition(254.2857208251953.px, 497.71429443359375.px)
+ position = createPxPosition(254.2857208251953f, 497.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216697864.milliseconds,
down = false,
- position = createPxPosition(254.2857208251953.px, 497.71429443359375.px)
+ position = createPxPosition(254.2857208251953f, 497.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216698321.milliseconds,
down = true,
- position = createPxPosition(250.px, 306.px)
+ position = createPxPosition(250f, 306f)
),
PointerInputData(
uptime = Uptime.Boot + 216698328.milliseconds,
down = true,
- position = createPxPosition(250.px, 306.px)
+ position = createPxPosition(250f, 306f)
),
PointerInputData(
uptime = Uptime.Boot + 216698344.milliseconds,
down = true,
- position = createPxPosition(249.14285278320312.px, 314.px)
+ position = createPxPosition(249.14285278320312f, 314f)
),
PointerInputData(
uptime = Uptime.Boot + 216698351.milliseconds,
down = true,
- position = createPxPosition(247.42857360839844.px, 319.4285583496094.px)
+ position = createPxPosition(247.42857360839844f, 319.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216698359.milliseconds,
down = true,
- position = createPxPosition(245.14285278320312.px, 326.8571472167969.px)
+ position = createPxPosition(245.14285278320312f, 326.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216698366.milliseconds,
down = true,
- position = createPxPosition(241.7142791748047.px, 339.4285583496094.px)
+ position = createPxPosition(241.7142791748047f, 339.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216698374.milliseconds,
down = true,
- position = createPxPosition(238.57142639160156.px, 355.71429443359375.px)
+ position = createPxPosition(238.57142639160156f, 355.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + 216698382.milliseconds,
down = true,
- position = createPxPosition(236.2857208251953.px, 374.28570556640625.px)
+ position = createPxPosition(236.2857208251953f, 374.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + 216698390.milliseconds,
down = true,
- position = createPxPosition(235.14285278320312.px, 396.5714416503906.px)
+ position = createPxPosition(235.14285278320312f, 396.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + 216698398.milliseconds,
down = true,
- position = createPxPosition(236.57142639160156.px, 421.4285583496094.px)
+ position = createPxPosition(236.57142639160156f, 421.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216698406.milliseconds,
down = true,
- position = createPxPosition(241.14285278320312.px, 451.4285583496094.px)
+ position = createPxPosition(241.14285278320312f, 451.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216698421.milliseconds,
down = false,
- position = createPxPosition(241.14285278320312.px, 451.4285583496094.px)
+ position = createPxPosition(241.14285278320312f, 451.4285583496094f)
)
)
@@ -1660,32 +1658,32 @@
PointerInputData(
uptime = Uptime.Boot + 216698321.milliseconds,
down = true,
- position = createPxPosition(250.px, 306.px)
+ position = createPxPosition(250f, 306f)
),
PointerInputData(
uptime = Uptime.Boot + 216698328.milliseconds,
down = true,
- position = createPxPosition(250.px, 306.px)
+ position = createPxPosition(250f, 306f)
),
PointerInputData(
uptime = Uptime.Boot + 216698344.milliseconds,
down = true,
- position = createPxPosition(249.14285278320312.px, 314.px)
+ position = createPxPosition(249.14285278320312f, 314f)
),
PointerInputData(
uptime = Uptime.Boot + 216698351.milliseconds,
down = true,
- position = createPxPosition(247.42857360839844.px, 319.4285583496094.px)
+ position = createPxPosition(247.42857360839844f, 319.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + 216698359.milliseconds,
down = true,
- position = createPxPosition(245.14285278320312.px, 326.8571472167969.px)
+ position = createPxPosition(245.14285278320312f, 326.8571472167969f)
),
PointerInputData(
uptime = Uptime.Boot + 216698366.milliseconds,
down = true,
- position = createPxPosition(241.7142791748047.px, 339.4285583496094.px)
+ position = createPxPosition(241.7142791748047f, 339.4285583496094f)
),
// The pointer "stops" here because we've introduced a 40+ms gap
@@ -1695,31 +1693,31 @@
PointerInputData(
uptime = Uptime.Boot + (216698374 + 40).milliseconds,
down = true,
- position = createPxPosition(238.57142639160156.px, 355.71429443359375.px)
+ position = createPxPosition(238.57142639160156f, 355.71429443359375f)
),
PointerInputData(
uptime = Uptime.Boot + (216698382 + 40).milliseconds,
down = true,
- position = createPxPosition(236.2857208251953.px, 374.28570556640625.px)
+ position = createPxPosition(236.2857208251953f, 374.28570556640625f)
),
PointerInputData(
uptime = Uptime.Boot + (216698390 + 40).milliseconds,
down = true,
- position = createPxPosition(235.14285278320312.px, 396.5714416503906.px)
+ position = createPxPosition(235.14285278320312f, 396.5714416503906f)
),
PointerInputData(
uptime = Uptime.Boot + (216698398 + 40).milliseconds,
down = true,
- position = createPxPosition(236.57142639160156.px, 421.4285583496094.px)
+ position = createPxPosition(236.57142639160156f, 421.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + (216698406 + 40).milliseconds,
down = true,
- position = createPxPosition(241.14285278320312.px, 451.4285583496094.px)
+ position = createPxPosition(241.14285278320312f, 451.4285583496094f)
),
PointerInputData(
uptime = Uptime.Boot + (216698421 + 40).milliseconds,
down = false,
- position = createPxPosition(241.14285278320312.px, 451.4285583496094.px)
+ position = createPxPosition(241.14285278320312f, 451.4285583496094f)
)
)
\ No newline at end of file
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/HitPathTrackerTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/HitPathTrackerTest.kt
index 0c7d813..e2b89f1 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/HitPathTrackerTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/HitPathTrackerTest.kt
@@ -35,7 +35,6 @@
import androidx.ui.unit.PxBounds
import androidx.ui.unit.PxPosition
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.eq
@@ -49,6 +48,7 @@
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
+import kotlin.math.roundToInt
@SmallTest
@RunWith(JUnit4::class)
@@ -569,7 +569,7 @@
PointerEventPass.PreUp -> 64f
else -> 0f
}
- it.consumePositionChange(0.px, yConsume.px)
+ it.consumePositionChange(0f, yConsume)
}
})
)
@@ -583,7 +583,7 @@
PointerEventPass.PreUp -> 32f
else -> 0f
}
- it.consumePositionChange(0.px, yConsume.px)
+ it.consumePositionChange(0f, yConsume)
}
})
)
@@ -597,7 +597,7 @@
PointerEventPass.PreUp -> 16f
else -> 0f
}
- it.consumePositionChange(0.px, yConsume.px)
+ it.consumePositionChange(0f, yConsume)
}
})
)
@@ -610,27 +610,27 @@
eq(listOf(change)), eq(PointerEventPass.InitialDown), any()
)
verify(pif2).onPointerInput(
- eq(listOf(change.consumePositionChange(0.px, 2.px))),
+ eq(listOf(change.consumePositionChange(0f, 2f))),
eq(PointerEventPass.InitialDown),
any()
)
verify(pif3).onPointerInput(
- eq(listOf(change.consumePositionChange(0.px, 6.px))), // 2 + 4
+ eq(listOf(change.consumePositionChange(0f, 6f))), // 2 + 4
eq(PointerEventPass.InitialDown),
any()
)
verify(pif3).onPointerInput(
- eq(listOf(change.consumePositionChange(0.px, 14.px))), // 2 + 4 + 8
+ eq(listOf(change.consumePositionChange(0f, 14f))), // 2 + 4 + 8
eq(PointerEventPass.PreUp),
any()
)
verify(pif2).onPointerInput(
- eq(listOf(change.consumePositionChange(0.px, 30.px))), // 2 + 4 + 8 + 16
+ eq(listOf(change.consumePositionChange(0f, 30f))), // 2 + 4 + 8 + 16
eq(PointerEventPass.PreUp),
any()
)
verify(pif1).onPointerInput(
- eq(listOf(change.consumePositionChange(0.px, 62.px))), // 2 + 4 + 8 + 16 + 32
+ eq(listOf(change.consumePositionChange(0f, 62f))), // 2 + 4 + 8 + 16 + 32
eq(PointerEventPass.PreUp),
any()
)
@@ -638,8 +638,8 @@
.isEqualTo(
listOf(
change.consumePositionChange(
- 0.px,
- 126.px
+ 0f,
+ 126f
)
)
) // 2 + 4 + 8 + 16 + 32 + 64
@@ -657,7 +657,7 @@
PointerEventPass.PreUp -> 12f
else -> 0f
}
- it.consumePositionChange(0.px, yConsume.px)
+ it.consumePositionChange(0f, yConsume)
}
})
)
@@ -671,7 +671,7 @@
PointerEventPass.PreUp -> 6f
else -> 0f
}
- it.consumePositionChange(0.px, yConsume.px)
+ it.consumePositionChange(0f, yConsume)
}
})
)
@@ -685,7 +685,7 @@
PointerEventPass.PreUp -> -12f
else -> 0f
}
- it.consumePositionChange(0.px, yConsume.px)
+ it.consumePositionChange(0f, yConsume)
}
})
)
@@ -699,7 +699,7 @@
PointerEventPass.PreUp -> -6f
else -> 0f
}
- it.consumePositionChange(0.px, yConsume.px)
+ it.consumePositionChange(0f, yConsume)
}
})
)
@@ -718,17 +718,17 @@
any()
)
verify(pif2).onPointerInput(
- eq(listOf(event1.consumePositionChange(0.px, 2.px))),
+ eq(listOf(event1.consumePositionChange(0f, 2f))),
eq(PointerEventPass.InitialDown),
any()
)
verify(pif2).onPointerInput(
- eq(listOf(event1.consumePositionChange(0.px, 5.px))),
+ eq(listOf(event1.consumePositionChange(0f, 5f))),
eq(PointerEventPass.PreUp),
any()
)
verify(pif1).onPointerInput(
- eq(listOf(event1.consumePositionChange(0.px, 11.px))),
+ eq(listOf(event1.consumePositionChange(0f, 11f))),
eq(PointerEventPass.PreUp),
any()
)
@@ -739,24 +739,24 @@
any()
)
verify(pif4).onPointerInput(
- eq(listOf(event2.consumePositionChange(0.px, (-2).px))),
+ eq(listOf(event2.consumePositionChange(0f, -2f))),
eq(PointerEventPass.InitialDown),
any()
)
verify(pif4).onPointerInput(
- eq(listOf(event2.consumePositionChange(0.px, (-5).px))),
+ eq(listOf(event2.consumePositionChange(0f, -5f))),
eq(PointerEventPass.PreUp),
any()
)
verify(pif3).onPointerInput(
- eq(listOf(event2.consumePositionChange(0.px, (-11).px))),
+ eq(listOf(event2.consumePositionChange(0f, -11f))),
eq(PointerEventPass.PreUp),
any()
)
assertThat(result).hasSize(2)
- assertThat(result).contains(event1.consumePositionChange(0.px, 23.px))
- assertThat(result).contains(event2.consumePositionChange(0.px, (-23).px))
+ assertThat(result).contains(event1.consumePositionChange(0f, 23f))
+ assertThat(result).contains(event2.consumePositionChange(0f, -23f))
}
@Test
@@ -772,8 +772,8 @@
else -> Int.MAX_VALUE
}
it.consumePositionChange(
- 0.px,
- (it.positionChange().y.value.toInt() / yConsume).px
+ 0f,
+ (it.positionChange().y.roundToInt() / yConsume).toFloat()
)
}
})
@@ -789,8 +789,8 @@
else -> Int.MAX_VALUE
}
it.consumePositionChange(
- 0.px,
- (it.positionChange().y.value.toInt() / yConsume).px
+ 0f,
+ (it.positionChange().y.roundToInt() / yConsume).toFloat()
)
}
})
@@ -806,8 +806,8 @@
else -> Int.MAX_VALUE
}
it.consumePositionChange(
- 0.px,
- (it.positionChange().y.value.toInt() / yConsume).px
+ 0f,
+ (it.positionChange().y.roundToInt() / yConsume).toFloat()
)
}
})
@@ -827,30 +827,30 @@
any()
)
verify(child1).onPointerInput(
- eq(listOf(event1.consumePositionChange(0.px, 500.px))),
+ eq(listOf(event1.consumePositionChange(0f, 500f))),
eq(PointerEventPass.InitialDown),
any()
)
verify(child2).onPointerInput(
- eq(listOf(event2.consumePositionChange(0.px, (-500).px))),
+ eq(listOf(event2.consumePositionChange(0f, -500f))),
eq(PointerEventPass.InitialDown),
any()
)
verify(child1).onPointerInput(
- eq(listOf(event1.consumePositionChange(0.px, 600.px))),
+ eq(listOf(event1.consumePositionChange(0f, 600f))),
eq(PointerEventPass.PreUp),
any()
)
verify(child2).onPointerInput(
- eq(listOf(event2.consumePositionChange(0.px, (-545).px))),
+ eq(listOf(event2.consumePositionChange(0f, -545f))),
eq(PointerEventPass.PreUp),
any()
)
verify(parent).onPointerInput(
eq(
listOf(
- event1.consumePositionChange(0.px, 657.px),
- event2.consumePositionChange(0.px, (-580).px)
+ event1.consumePositionChange(0f, 657f),
+ event2.consumePositionChange(0f, -580f)
)
),
eq(PointerEventPass.PreUp),
@@ -858,8 +858,8 @@
)
assertThat(result).hasSize(2)
- assertThat(result).contains(event1.consumePositionChange(0.px, 771.px))
- assertThat(result).contains(event2.consumePositionChange(0.px, (-720).px))
+ assertThat(result).contains(event1.consumePositionChange(0f, 771f))
+ assertThat(result).contains(event2.consumePositionChange(0f, -720f))
}
@Test
@@ -875,8 +875,8 @@
else -> Int.MAX_VALUE
}
it.consumePositionChange(
- 0.px,
- (it.positionChange().y.value.toInt() / yConsume).px
+ 0f,
+ (it.positionChange().y.roundToInt() / yConsume).toFloat()
)
}
})
@@ -892,8 +892,8 @@
else -> Int.MAX_VALUE
}
it.consumePositionChange(
- 0.px,
- (it.positionChange().y.value.toInt() / yConsume).px
+ 0f,
+ (it.positionChange().y.roundToInt() / yConsume).toFloat()
)
}
})
@@ -915,8 +915,8 @@
verify(child2).onPointerInput(
eq(
listOf(
- event1.consumePositionChange(0.px, 500.px),
- event2.consumePositionChange(0.px, (-500).px)
+ event1.consumePositionChange(0f, 500f),
+ event2.consumePositionChange(0f, -500f)
)
),
eq(PointerEventPass.InitialDown),
@@ -926,8 +926,8 @@
verify(child2).onPointerInput(
eq(
listOf(
- event1.consumePositionChange(0.px, 600.px),
- event2.consumePositionChange(0.px, (-600).px)
+ event1.consumePositionChange(0f, 600f),
+ event2.consumePositionChange(0f, -600f)
)
),
eq(PointerEventPass.PreUp),
@@ -936,8 +936,8 @@
verify(child1).onPointerInput(
eq(
listOf(
- event1.consumePositionChange(0.px, 657.px),
- event2.consumePositionChange(0.px, (-657).px)
+ event1.consumePositionChange(0f, 657f),
+ event2.consumePositionChange(0f, -657f)
)
),
eq(PointerEventPass.PreUp),
@@ -945,8 +945,8 @@
)
assertThat(result).hasSize(2)
- assertThat(result).contains(event1.consumePositionChange(0.px, 771.px))
- assertThat(result).contains(event2.consumePositionChange(0.px, (-771).px))
+ assertThat(result).contains(event1.consumePositionChange(0f, 771f))
+ assertThat(result).contains(event2.consumePositionChange(0f, -771f))
}
@Test
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/PointerInputEventProcessorTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/PointerInputEventProcessorTest.kt
index 949957b..dfbc831 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/PointerInputEventProcessorTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/PointerInputEventProcessorTest.kt
@@ -33,7 +33,6 @@
import androidx.ui.unit.Uptime
import androidx.ui.unit.ipx
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.eq
@@ -104,8 +103,8 @@
root.insertAt(0, layoutNode)
- val offset = PxPosition(100.px, 200.px)
- val offset2 = PxPosition(300.px, 400.px)
+ val offset = PxPosition(100f, 200f)
+ val offset2 = PxPosition(300f, 400f)
val events = arrayOf(
PointerInputEvent(8712, Uptime.Boot + 3.milliseconds, offset, true),
@@ -165,7 +164,7 @@
// Arrange
- val childOffset = PxPosition(100.px, 200.px)
+ val childOffset = PxPosition(100f, 200f)
val pointerInputFilter: PointerInputFilter = spy()
val layoutNode = LayoutNode(
100, 200, 301, 401,
@@ -177,10 +176,10 @@
root.insertAt(0, layoutNode)
val offsets = arrayOf(
- PxPosition(100.px, 200.px),
- PxPosition(300.px, 200.px),
- PxPosition(100.px, 400.px),
- PxPosition(300.px, 400.px)
+ PxPosition(100f, 200f),
+ PxPosition(300f, 200f),
+ PxPosition(100f, 400f),
+ PxPosition(300f, 400f)
)
val events = Array(4) { index ->
@@ -240,14 +239,14 @@
root.insertAt(0, layoutNode)
val offsets = arrayOf(
- PxPosition(99.px, 200.px),
- PxPosition(99.px, 400.px),
- PxPosition(100.px, 199.px),
- PxPosition(100.px, 401.px),
- PxPosition(300.px, 199.px),
- PxPosition(300.px, 401.px),
- PxPosition(301.px, 200.px),
- PxPosition(301.px, 400.px)
+ PxPosition(99f, 200f),
+ PxPosition(99f, 400f),
+ PxPosition(100f, 199f),
+ PxPosition(100f, 401f),
+ PxPosition(300f, 199f),
+ PxPosition(300f, 401f),
+ PxPosition(301f, 200f),
+ PxPosition(301f, 400f)
)
val events = Array(8) { index ->
@@ -315,9 +314,9 @@
root.insertAt(0, parentLayoutNode)
val offset = when (numberOfChildrenHit) {
- 3 -> PxPosition(250.px, 250.px)
- 2 -> PxPosition(150.px, 150.px)
- 1 -> PxPosition(50.px, 50.px)
+ 3 -> PxPosition(250f, 250f)
+ 2 -> PxPosition(150f, 150f)
+ 1 -> PxPosition(50f, 50f)
else -> throw IllegalStateException()
}
@@ -394,21 +393,21 @@
id = PointerId(0),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(100.px, 0.px),
+ PxPosition(100f, 0f),
true
),
- previous = PointerInputData(Uptime.Boot + 3.milliseconds, PxPosition(0.px, 0.px), true),
- consumed = ConsumedData(positionChange = PxPosition(0.px, 0.px))
+ previous = PointerInputData(Uptime.Boot + 3.milliseconds, PxPosition(0f, 0f), true),
+ consumed = ConsumedData(positionChange = PxPosition(0f, 0f))
)
val output = PointerInputChange(
id = PointerId(0),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(100.px, 0.px),
+ PxPosition(100f, 0f),
true
),
- previous = PointerInputData(Uptime.Boot + 3.milliseconds, PxPosition(0.px, 0.px), true),
- consumed = ConsumedData(positionChange = PxPosition(13.px, 0.px))
+ previous = PointerInputData(Uptime.Boot + 3.milliseconds, PxPosition(0f, 0f), true),
+ consumed = ConsumedData(positionChange = PxPosition(13f, 0f))
)
val pointerInputFilter: PointerInputFilter =
@@ -436,13 +435,13 @@
val down = PointerInputEvent(
0,
Uptime.Boot + 3.milliseconds,
- PxPosition(0.px, 0.px),
+ PxPosition(0f, 0f),
true
)
val move = PointerInputEvent(
0,
Uptime.Boot + 5.milliseconds,
- PxPosition(100.px, 0.px),
+ PxPosition(100f, 0f),
true
)
@@ -519,14 +518,14 @@
val middlePointerInputFilter: PointerInputFilter = spy()
val parentPointerInputFilter: PointerInputFilter = spy()
- val childOffset = PxPosition(cX1.px, cY1.px)
+ val childOffset = PxPosition(cX1.toFloat(), cY1.toFloat())
val childLayoutNode = LayoutNode(
cX1, cY1, cX2, cY2,
PointerInputModifierImpl(
childPointerInputFilter
)
)
- val middleOffset = PxPosition(mX1.px, mY1.px)
+ val middleOffset = PxPosition(mX1.toFloat(), mY1.toFloat())
val middleLayoutNode: LayoutNode = LayoutNode(
mX1, mY1, mX2, mY2,
PointerInputModifierImpl(
@@ -550,7 +549,7 @@
val additionalOffset = IntPxPosition(aOX.ipx, aOY.ipx)
- val offset = PxPosition(pointerX.px, pointerY.px)
+ val offset = PxPosition(pointerX.toFloat(), pointerY.toFloat())
val down = PointerInputEvent(0, Uptime.Boot + 7.milliseconds, offset, true)
@@ -670,8 +669,8 @@
insertAt(0, childLayoutNode2)
}
- val offset1 = PxPosition(25.px, 25.px)
- val offset2 = PxPosition(75.px, 75.px)
+ val offset1 = PxPosition(25f, 25f)
+ val offset2 = PxPosition(75f, 75f)
val down = PointerInputEvent(
Uptime.Boot + 5.milliseconds,
@@ -691,7 +690,7 @@
id = PointerId(1),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- offset2 - PxPosition(50.px, 50.px),
+ offset2 - PxPosition(50f, 50f),
true
),
previous = PointerInputData(null, null, false),
@@ -781,9 +780,9 @@
insertAt(2, childLayoutNode3)
}
- val offset1 = PxPosition(25.px, 25.px)
- val offset2 = PxPosition(75.px, 75.px)
- val offset3 = PxPosition(125.px, 125.px)
+ val offset1 = PxPosition(25f, 25f)
+ val offset2 = PxPosition(75f, 75f)
+ val offset3 = PxPosition(125f, 125f)
val down = PointerInputEvent(
Uptime.Boot + 5.milliseconds,
@@ -804,7 +803,7 @@
id = PointerId(1),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- offset2 - PxPosition(50.px, 50.px),
+ offset2 - PxPosition(50f, 50f),
true
),
previous = PointerInputData(null, null, false),
@@ -814,7 +813,7 @@
id = PointerId(2),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- offset3 - PxPosition(100.px, 100.px),
+ offset3 - PxPosition(100f, 100f),
true
),
previous = PointerInputData(null, null, false),
@@ -903,9 +902,9 @@
insertAt(1, childLayoutNode2)
}
- val offset1 = PxPosition(50.px, 25.px)
- val offset2 = PxPosition(50.px, 75.px)
- val offset3 = PxPosition(50.px, 125.px)
+ val offset1 = PxPosition(50f, 25f)
+ val offset2 = PxPosition(50f, 75f)
+ val offset3 = PxPosition(50f, 125f)
val down = PointerInputEvent(
Uptime.Boot + 7.milliseconds,
@@ -926,7 +925,7 @@
id = PointerId(1),
current = PointerInputData(
Uptime.Boot + 7.milliseconds,
- offset2 - PxPosition(25.px, 50.px),
+ offset2 - PxPosition(25f, 50f),
true
),
previous = PointerInputData(null, null, false),
@@ -1008,9 +1007,9 @@
insertAt(1, childLayoutNode2)
}
- val offset1 = PxPosition(25.px, 50.px)
- val offset2 = PxPosition(75.px, 50.px)
- val offset3 = PxPosition(125.px, 50.px)
+ val offset1 = PxPosition(25f, 50f)
+ val offset2 = PxPosition(75f, 50f)
+ val offset3 = PxPosition(125f, 50f)
val down = PointerInputEvent(
Uptime.Boot + 11.milliseconds,
@@ -1031,7 +1030,7 @@
id = PointerId(1),
current = PointerInputData(
Uptime.Boot + 11.milliseconds,
- offset2 - PxPosition(50.px, 25.px),
+ offset2 - PxPosition(50f, 25f),
true
),
previous = PointerInputData(null, null, false),
@@ -1141,21 +1140,21 @@
}
val offsetsThatHit =
listOf(
- PxPosition(1.px, 1.px),
- PxPosition(3.px, 1.px),
- PxPosition(1.px, 3.px),
- PxPosition(3.px, 3.px)
+ PxPosition(1f, 1f),
+ PxPosition(3f, 1f),
+ PxPosition(1f, 3f),
+ PxPosition(3f, 3f)
)
val offsetsThatMiss =
listOf(
- PxPosition(1.px, 0.px),
- PxPosition(3.px, 0.px),
- PxPosition(0.px, 1.px),
- PxPosition(4.px, 1.px),
- PxPosition(0.px, 3.px),
- PxPosition(4.px, 3.px),
- PxPosition(1.px, 4.px),
- PxPosition(3.px, 4.px)
+ PxPosition(1f, 0f),
+ PxPosition(3f, 0f),
+ PxPosition(0f, 1f),
+ PxPosition(4f, 1f),
+ PxPosition(0f, 3f),
+ PxPosition(4f, 3f),
+ PxPosition(1f, 4f),
+ PxPosition(3f, 4f)
)
val allOffsets = offsetsThatHit + offsetsThatMiss
val pointerInputEvent =
@@ -1179,8 +1178,8 @@
current = PointerInputData(
Uptime.Boot + 11.milliseconds,
PxPosition(
- if (offsetsThatHit[it].x == 1.px) 1.px else 0.px,
- if (offsetsThatHit[it].y == 1.px) 1.px else 0.px
+ if (offsetsThatHit[it].x == 1f) 1f else 0f,
+ if (offsetsThatHit[it].y == 1f) 1f else 0f
),
true
),
@@ -1268,15 +1267,15 @@
}
val offsetsThatHit =
listOf(
- PxPosition(2.px, 2.px),
- PxPosition(2.px, 1.px),
- PxPosition(1.px, 2.px)
+ PxPosition(2f, 2f),
+ PxPosition(2f, 1f),
+ PxPosition(1f, 2f)
)
val offsetsThatMiss =
listOf(
- PxPosition(0.px, 0.px),
- PxPosition(0.px, 1.px),
- PxPosition(1.px, 0.px)
+ PxPosition(0f, 0f),
+ PxPosition(0f, 1f),
+ PxPosition(1f, 0f)
)
val allOffsets = offsetsThatHit + offsetsThatMiss
val pointerInputEvent =
@@ -1300,7 +1299,7 @@
id = PointerId(it.toLong()),
current = PointerInputData(
Uptime.Boot + 11.milliseconds,
- offsetsThatHit[it] - PxPosition(1.px, 1.px),
+ offsetsThatHit[it] - PxPosition(1f, 1f),
true
),
previous = PointerInputData(null, null, false),
@@ -1342,7 +1341,7 @@
insertAt(0, layoutNode)
}
- val offset1 = PxPosition(50.px, 75.px)
+ val offset1 = PxPosition(50f, 75f)
val down = PointerInputEvent(
Uptime.Boot + 7.milliseconds,
@@ -1355,7 +1354,7 @@
id = PointerId(0),
current = PointerInputData(
Uptime.Boot + 7.milliseconds,
- offset1 - PxPosition(25.px, 50.px),
+ offset1 - PxPosition(25f, 50f),
true
),
previous = PointerInputData(null, null, false),
@@ -1422,7 +1421,7 @@
insertAt(0, layoutNode4)
}
- val offset1 = PxPosition(499.px, 499.px)
+ val offset1 = PxPosition(499f, 499f)
val downEvent = PointerInputEvent(
Uptime.Boot + 7.milliseconds,
@@ -1435,7 +1434,7 @@
id = PointerId(0),
current = PointerInputData(
Uptime.Boot + 7.milliseconds,
- offset1 - PxPosition(1.px + 2.px + 3.px + 4.px, 5.px + 6.px + 7.px + 8.px),
+ offset1 - PxPosition(1f + 2f + 3f + 4f, 5f + 6f + 7f + 8f),
true
),
previous = PointerInputData(null, null, false),
@@ -1501,7 +1500,7 @@
insertAt(0, layoutNode5)
}
- val offset1 = PxPosition(499.px, 499.px)
+ val offset1 = PxPosition(499f, 499f)
val downEvent = PointerInputEvent(
Uptime.Boot + 3.milliseconds,
@@ -1515,8 +1514,8 @@
current = PointerInputData(
Uptime.Boot + 3.milliseconds,
offset1 - PxPosition(
- 1.px + 2.px + 3.px + 4.px + 5.px,
- 6.px + 7.px + 8.px + 9.px + 10.px
+ 1f + 2f + 3f + 4f + 5f,
+ 6f + 7f + 8f + 9f + 10f
),
true
),
@@ -1528,7 +1527,7 @@
id = PointerId(0),
current = PointerInputData(
Uptime.Boot + 3.milliseconds,
- offset1 - PxPosition(3.px + 4.px + 5.px, 8.px + 9.px + 10.px),
+ offset1 - PxPosition(3f + 4f + 5f, 8f + 9f + 10f),
true
),
previous = PointerInputData(null, null, false),
@@ -1606,7 +1605,7 @@
}
val down = PointerInputEvent(
- 1, Uptime.Boot + 0.milliseconds, PxPosition(50.px, 50.px), true
+ 1, Uptime.Boot + 0.milliseconds, PxPosition(50f, 50f), true
)
// Act
@@ -1633,7 +1632,7 @@
}
val down = PointerInputEvent(
- 1, Uptime.Boot + 0.milliseconds, PxPosition(0.px, 0.px), true
+ 1, Uptime.Boot + 0.milliseconds, PxPosition(0f, 0f), true
)
// Act
@@ -1668,7 +1667,7 @@
PointerInputEvent(
7,
Uptime.Boot + 5.milliseconds,
- PxPosition(250.px, 250.px),
+ PxPosition(250f, 250f),
true
)
@@ -1677,7 +1676,7 @@
id = PointerId(7),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(250.px, 250.px),
+ PxPosition(250f, 250f),
true
),
previous = PointerInputData(null, null, false),
@@ -1728,7 +1727,7 @@
PointerInputEvent(
7,
Uptime.Boot + 5.milliseconds,
- PxPosition(200.px, 200.px),
+ PxPosition(200f, 200f),
true
)
@@ -1739,13 +1738,13 @@
PointerInputEventData(
7,
Uptime.Boot + 10.milliseconds,
- PxPosition(200.px, 200.px),
+ PxPosition(200f, 200f),
true
),
PointerInputEventData(
9,
Uptime.Boot + 10.milliseconds,
- PxPosition(300.px, 300.px),
+ PxPosition(300f, 300f),
true
)
)
@@ -1757,7 +1756,7 @@
id = PointerId(7),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(200.px, 200.px),
+ PxPosition(200f, 200f),
true
),
previous = PointerInputData(null, null, false),
@@ -1771,12 +1770,12 @@
id = PointerId(7),
current = PointerInputData(
Uptime.Boot + 10.milliseconds,
- PxPosition(200.px, 200.px),
+ PxPosition(200f, 200f),
true
),
previous = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(200.px, 200.px),
+ PxPosition(200f, 200f),
true
),
consumed = ConsumedData()
@@ -1785,7 +1784,7 @@
id = PointerId(9),
current = PointerInputData(
Uptime.Boot + 10.milliseconds,
- PxPosition(300.px, 300.px),
+ PxPosition(300f, 300f),
true
),
previous = PointerInputData(null, null, false),
@@ -1849,7 +1848,7 @@
PointerInputEventData(
7,
Uptime.Boot + 5.milliseconds,
- PxPosition(100.px, 100.px),
+ PxPosition(100f, 100f),
true
)
@@ -1857,7 +1856,7 @@
PointerInputEventData(
9,
Uptime.Boot + 5.milliseconds,
- PxPosition(300.px, 300.px),
+ PxPosition(300f, 300f),
true
)
@@ -1871,7 +1870,7 @@
id = PointerId(7),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(100.px, 100.px),
+ PxPosition(100f, 100f),
true
),
previous = PointerInputData(null, null, false),
@@ -1883,7 +1882,7 @@
id = PointerId(9),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(100.px, 100.px),
+ PxPosition(100f, 100f),
true
),
previous = PointerInputData(null, null, false),
@@ -1943,7 +1942,7 @@
PointerInputEvent(
7,
Uptime.Boot + 5.milliseconds,
- PxPosition(200.px, 200.px),
+ PxPosition(200f, 200f),
true
)
@@ -1951,7 +1950,7 @@
PointerInputEvent(
7,
Uptime.Boot + 10.milliseconds,
- PxPosition(300.px, 300.px),
+ PxPosition(300f, 300f),
true
)
@@ -1960,7 +1959,7 @@
id = PointerId(7),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(200.px, 200.px),
+ PxPosition(200f, 200f),
true
),
previous = PointerInputData(null, null, false),
@@ -1972,12 +1971,12 @@
id = PointerId(7),
current = PointerInputData(
Uptime.Boot + 10.milliseconds,
- PxPosition(300.px, 300.px),
+ PxPosition(300f, 300f),
true
),
previous = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(200.px, 200.px),
+ PxPosition(200f, 200f),
true
),
consumed = ConsumedData()
@@ -2032,7 +2031,7 @@
PointerInputEvent(
7,
Uptime.Boot + 5.milliseconds,
- PxPosition(200.px, 200.px),
+ PxPosition(200f, 200f),
true
)
@@ -2041,7 +2040,7 @@
id = PointerId(7),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(200.px, 200.px),
+ PxPosition(200f, 200f),
true
),
previous = PointerInputData(null, null, false),
@@ -2091,7 +2090,7 @@
PointerInputEvent(
7,
Uptime.Boot + 5.milliseconds,
- PxPosition(200.px, 200.px),
+ PxPosition(200f, 200f),
true
)
@@ -2099,7 +2098,7 @@
PointerInputEvent(
7,
Uptime.Boot + 10.milliseconds,
- PxPosition(200.px, 200.px),
+ PxPosition(200f, 200f),
true
)
@@ -2108,7 +2107,7 @@
id = PointerId(7),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(200.px, 200.px),
+ PxPosition(200f, 200f),
true
),
previous = PointerInputData(null, null, false),
@@ -2120,7 +2119,7 @@
id = PointerId(7),
current = PointerInputData(
Uptime.Boot + 10.milliseconds,
- PxPosition(200.px, 200.px),
+ PxPosition(200f, 200f),
true
),
previous = PointerInputData(null, null, false),
@@ -2180,7 +2179,7 @@
root.insertAt(0, parentLayoutNode)
- val offset = PxPosition(50.px, 50.px)
+ val offset = PxPosition(50f, 50f)
val down = PointerInputEvent(0, Uptime.Boot + 7.milliseconds, offset, true)
val up = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, null, false)
@@ -2246,7 +2245,7 @@
root.insertAt(0, parentLayoutNode)
val down =
- PointerInputEvent(0, Uptime.Boot + 7.milliseconds, PxPosition(50.px, 50.px), true)
+ PointerInputEvent(0, Uptime.Boot + 7.milliseconds, PxPosition(50f, 50f), true)
val up = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, null, false)
@@ -2286,7 +2285,7 @@
root.insertAt(0, parentLayoutNode)
- val offset = PxPosition(50.px, 50.px)
+ val offset = PxPosition(50f, 50f)
val down = PointerInputEvent(0, Uptime.Boot + 7.milliseconds, offset, true)
val up = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, null, false)
@@ -2352,7 +2351,7 @@
root.insertAt(0, parentLayoutNode)
val down =
- PointerInputEvent(0, Uptime.Boot + 7.milliseconds, PxPosition(50.px, 50.px), true)
+ PointerInputEvent(0, Uptime.Boot + 7.milliseconds, PxPosition(50f, 50f), true)
val up = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, null, false)
@@ -2370,7 +2369,7 @@
@Test
fun process_downNoPointerInputModifiers_nothingInteractedWithAndNoMovementConsumed() {
val pointerInputEvent =
- PointerInputEvent(0, Uptime.Boot + 7.milliseconds, PxPosition(0.px, 0.px), true)
+ PointerInputEvent(0, Uptime.Boot + 7.milliseconds, PxPosition(0f, 0f), true)
val result: ProcessResult = pointerInputEventProcessor.process(pointerInputEvent)
@@ -2402,10 +2401,10 @@
val offsets =
listOf(
- PxPosition((-1).px, 0.px),
- PxPosition(0.px, (-1).px),
- PxPosition(1.px, 0.px),
- PxPosition(0.px, 1.px)
+ PxPosition(-1f, 0f),
+ PxPosition(0f, -1f),
+ PxPosition(1f, 0f),
+ PxPosition(0f, 1f)
)
val pointerInputEvent =
PointerInputEvent(
@@ -2443,7 +2442,7 @@
)
root.apply { insertAt(0, layoutNode) }
val pointerInputEvent =
- PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(0.px, 0.px), true)
+ PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(0f, 0f), true)
// Act
@@ -2472,9 +2471,9 @@
)
)
root.apply { insertAt(0, layoutNode) }
- val down = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(0.px, 0.px), true)
+ val down = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(0f, 0f), true)
pointerInputEventProcessor.process(down)
- val move = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(1.px, 0.px), true)
+ val move = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(1f, 0f), true)
// Act
@@ -2504,9 +2503,9 @@
)
)
root.apply { insertAt(0, layoutNode) }
- val down = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(0.px, 0.px), true)
+ val down = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(0f, 0f), true)
pointerInputEventProcessor.process(down)
- val move = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(1.px, 0.px), true)
+ val move = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(1f, 0f), true)
// Act
@@ -2531,7 +2530,7 @@
spy(
TestPointerInputFilter { changes, pass, _ ->
if (pass == PointerEventPass.InitialDown) {
- changes.map { it.consumePositionChange(1.px, 0.px) }
+ changes.map { it.consumePositionChange(1f, 0f) }
} else {
changes
}
@@ -2545,9 +2544,9 @@
)
)
root.apply { insertAt(0, layoutNode) }
- val down = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(0.px, 0.px), true)
+ val down = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(0f, 0f), true)
pointerInputEventProcessor.process(down)
- val move = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(1.px, 0.px), true)
+ val move = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(1f, 0f), true)
// Act
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerDragTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerDragTest.kt
index 9261cb2..87f5948 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerDragTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerDragTest.kt
@@ -22,7 +22,6 @@
import androidx.ui.core.LayoutCoordinates
import androidx.ui.text.style.TextDirection
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.doReturn
@@ -47,7 +46,7 @@
private val containerLayoutCoordinates = mock<LayoutCoordinates> {
on { isAttached } doReturn true
}
- private val childToLocal_result = PxPosition(300.px, 400.px)
+ private val childToLocal_result = PxPosition(300f, 400f)
private val startSelectable = mock<Selectable>()
private val endSelectable = mock<Selectable>()
@@ -151,7 +150,7 @@
@Test
fun handleDragObserver_onDrag_startHandle_reuse_endHandle_calls_getSelection_change_selection
() {
- val dragDistance = PxPosition(100.px, 100.px)
+ val dragDistance = PxPosition(100f, 100f)
selectionManager.handleDragObserver(isStartHandle = true).onStart(PxPosition.Origin)
val result = selectionManager.handleDragObserver(isStartHandle = true).onDrag(dragDistance)
@@ -178,7 +177,7 @@
@Test
fun handleDragObserver_onDrag_endHandle_resue_startHandle_calls_getSelection_change_selection
() {
- val dragDistance = PxPosition(100.px, 100.px)
+ val dragDistance = PxPosition(100f, 100f)
selectionManager.handleDragObserver(isStartHandle = false).onStart(PxPosition.Origin)
val result = selectionManager.handleDragObserver(isStartHandle = false).onDrag(dragDistance)
@@ -213,12 +212,12 @@
}
private fun getAdjustedCoordinates(position: PxPosition): PxPosition {
- return PxPosition(position.x, position.y - 1.px)
+ return PxPosition(position.x, position.y - 1f)
}
private fun verify_draggingHandle(expectedDraggingHandleValue: Boolean) {
// Verify draggingHandle is true, by verifying LongPress does nothing. Vice Versa.
- val position = PxPosition(100.px, 100.px)
+ val position = PxPosition(100f, 100f)
selectionManager.longPressDragObserver.onLongPress(position)
verify(selectable, times(if (expectedDraggingHandleValue) 0 else 1))
.getSelection(
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerLongPressDragTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerLongPressDragTest.kt
index 7079fb1..1c69bfc 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerLongPressDragTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerLongPressDragTest.kt
@@ -22,7 +22,6 @@
import androidx.ui.core.LayoutCoordinates
import androidx.ui.text.style.TextDirection
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.anyOrNull
@@ -110,7 +109,7 @@
@Test
fun longPressDragObserver_onLongPress_calls_getSelection_change_selection() {
- val position = PxPosition(100.px, 100.px)
+ val position = PxPosition(100f, 100f)
selectionManager.longPressDragObserver.onLongPress(position)
@@ -130,10 +129,10 @@
@Test
fun longPressDragObserver_onDragStart_reset_dragTotalDistance() {
// Setup. Make sure selectionManager.dragTotalDistance is not 0.
- val dragDistance1 = PxPosition(15.px, 10.px)
- val beginPosition1 = PxPosition(30.px, 20.px)
- val dragDistance2 = PxPosition(100.px, 300.px)
- val beginPosition2 = PxPosition(300.px, 200.px)
+ val dragDistance1 = PxPosition(15f, 10f)
+ val beginPosition1 = PxPosition(30f, 20f)
+ val dragDistance2 = PxPosition(100f, 300f)
+ val beginPosition2 = PxPosition(300f, 200f)
selectionManager.longPressDragObserver.onLongPress(beginPosition1)
selectionManager.longPressDragObserver.onDragStart()
selectionManager.longPressDragObserver.onDrag(dragDistance1)
@@ -163,8 +162,8 @@
@Test
fun longPressDragObserver_onDrag_calls_getSelection_change_selection() {
- val dragDistance = PxPosition(15.px, 10.px)
- val beginPosition = PxPosition(30.px, 20.px)
+ val dragDistance = PxPosition(15f, 10f)
+ val beginPosition = PxPosition(30f, 20f)
selectionManager.longPressDragObserver.onLongPress(beginPosition)
selectionManager.selection = fakeInitialSelection
selection = fakeInitialSelection
@@ -187,8 +186,8 @@
@Test
fun longPressDragObserver_onDrag_directly_not_call_getSelection_not_change_selection() {
- val dragDistance = PxPosition(15.px, 10.px)
- val beginPosition = PxPosition(30.px, 20.px)
+ val dragDistance = PxPosition(15f, 10f)
+ val beginPosition = PxPosition(30f, 20f)
selection = fakeInitialSelection
val result = selectionManager.longPressDragObserver.onDrag(dragDistance)
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerTest.kt
index 8b7bcdf..a56b8c1 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerTest.kt
@@ -30,7 +30,6 @@
import androidx.ui.text.style.TextDirection
import androidx.ui.text.subSequence
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.doReturn
@@ -61,8 +60,8 @@
private val middleSelectable = mock<Selectable>()
private val lastSelectable = mock<Selectable>()
- private val startCoordinates = PxPosition(3.px, 30.px)
- private val endCoordinates = PxPosition(3.px, 600.px)
+ private val startCoordinates = PxPosition(3f, 30f)
+ private val endCoordinates = PxPosition(3f, 600f)
private val fakeSelection =
Selection(
@@ -417,8 +416,8 @@
verify(selectable, times(1))
.getSelection(
- startPosition = PxPosition((-1).px, (-1).px),
- endPosition = PxPosition((-1).px, (-1).px),
+ startPosition = PxPosition(-1f, -1f),
+ endPosition = PxPosition(-1f, -1f),
containerLayoutCoordinates = selectionManager.requireContainerCoordinates(),
longPress = false,
previousSelection = fakeSelection
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionRegistrarImplTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionRegistrarImplTest.kt
index e083526..4188bb3 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionRegistrarImplTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionRegistrarImplTest.kt
@@ -19,7 +19,6 @@
import androidx.test.filters.SmallTest
import androidx.ui.core.LayoutCoordinates
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.whenever
@@ -76,10 +75,10 @@
whenever(handler3.getLayoutCoordinates()).thenReturn(layoutCoordinates3)
// The order of the 4 handlers should be 1, 0, 3, 2.
- val relativeCoordinates0 = PxPosition(20.px, 12.px)
- val relativeCoordinates1 = PxPosition(5.px, 12.px)
- val relativeCoordinates2 = PxPosition(20.px, 24.px)
- val relativeCoordinates3 = PxPosition(5.px, 24.px)
+ val relativeCoordinates0 = PxPosition(20f, 12f)
+ val relativeCoordinates1 = PxPosition(5f, 12f)
+ val relativeCoordinates2 = PxPosition(20f, 24f)
+ val relativeCoordinates3 = PxPosition(5f, 24f)
val containerLayoutCoordinates = mock<LayoutCoordinates>()
whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates0, PxPosition.Origin))
@@ -127,10 +126,10 @@
whenever(handler3.getLayoutCoordinates()).thenReturn(layoutCoordinates3)
// The order of the 4 handlers should be 1, 0, 3, 2.
- val relativeCoordinates0 = PxPosition(20.px, 12.px)
- val relativeCoordinates1 = PxPosition(5.px, 12.px)
- val relativeCoordinates2 = PxPosition(20.px, 24.px)
- val relativeCoordinates3 = PxPosition(5.px, 24.px)
+ val relativeCoordinates0 = PxPosition(20f, 12f)
+ val relativeCoordinates1 = PxPosition(5f, 12f)
+ val relativeCoordinates2 = PxPosition(20f, 24f)
+ val relativeCoordinates3 = PxPosition(5f, 24f)
val containerLayoutCoordinates = mock<LayoutCoordinates>()
whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates0, PxPosition.Origin))
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DraggableTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DraggableTest.kt
index d485b62..59e5574 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DraggableTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DraggableTest.kt
@@ -37,7 +37,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -68,7 +67,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100.px, this.center.y),
+ end = PxPosition(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -79,7 +78,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x, this.center.y + 100.px),
+ end = PxPosition(this.center.x, this.center.y + 100f),
duration = 100.milliseconds
)
}
@@ -89,7 +88,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x - 100.px, this.center.y),
+ end = PxPosition(this.center.x - 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -113,7 +112,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x, this.center.y + 100.px),
+ end = PxPosition(this.center.x, this.center.y + 100f),
duration = 100.milliseconds
)
}
@@ -124,7 +123,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100.px, this.center.y),
+ end = PxPosition(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -134,7 +133,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x, this.center.y - 100.px),
+ end = PxPosition(this.center.x, this.center.y - 100f),
duration = 100.milliseconds
)
}
@@ -168,7 +167,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100.px, this.center.y),
+ end = PxPosition(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -195,7 +194,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100.px, this.center.y),
+ end = PxPosition(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -207,7 +206,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100.px, this.center.y),
+ end = PxPosition(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -233,7 +232,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipeWithVelocity(
start = this.center,
- end = PxPosition(this.center.x + 100.px, this.center.y),
+ end = PxPosition(this.center.x + 100f, this.center.y),
endVelocity = 112f,
duration = 100.milliseconds
@@ -260,7 +259,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100.px, this.center.y),
+ end = PxPosition(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -290,7 +289,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100.px, this.center.y),
+ end = PxPosition(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -333,7 +332,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 200.px, this.center.y),
+ end = PxPosition(this.center.x + 200f, this.center.y),
duration = 300.milliseconds
)
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/IndicationTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/IndicationTest.kt
index 54064fb..993dbb0 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/IndicationTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/IndicationTest.kt
@@ -31,7 +31,6 @@
import androidx.ui.test.sendUp
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.Ignore
import org.junit.Rule
@@ -141,7 +140,7 @@
findByTag(testTag)
.assertExists()
.doPartialGesture {
- position1 = PxPosition(center.x, center.y + 20.px)
+ position1 = PxPosition(center.x, center.y + 20f)
// pointer 1, when we have multitouch
sendDown(position1!!)
}
@@ -151,7 +150,7 @@
findByTag(testTag)
.assertExists()
.doPartialGesture {
- val position2 = PxPosition(center.x + 20.px, center.y)
+ val position2 = PxPosition(center.x + 20f, center.y)
// pointer 2, when we have multitouch
sendDown(position2)
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollableTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollableTest.kt
index ed93bdc..3ebd1a0a 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollableTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollableTest.kt
@@ -44,7 +44,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
import com.google.common.truth.Truth
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
@@ -84,7 +83,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100.px, this.center.y),
+ end = PxPosition(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -97,7 +96,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x, this.center.y + 100.px),
+ end = PxPosition(this.center.x, this.center.y + 100f),
duration = 100.milliseconds
)
}
@@ -109,7 +108,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x - 100.px, this.center.y),
+ end = PxPosition(this.center.x - 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -140,7 +139,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x, this.center.y + 100.px),
+ end = PxPosition(this.center.x, this.center.y + 100f),
duration = 100.milliseconds
)
}
@@ -153,7 +152,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100.px, this.center.y),
+ end = PxPosition(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -165,7 +164,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x, this.center.y - 100.px),
+ end = PxPosition(this.center.x, this.center.y - 100f),
duration = 100.milliseconds
)
}
@@ -204,7 +203,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100.px, this.center.y),
+ end = PxPosition(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -244,7 +243,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100.px, this.center.y),
+ end = PxPosition(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -257,7 +256,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100.px, this.center.y),
+ end = PxPosition(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -292,7 +291,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipeWithVelocity(
start = this.center,
- end = PxPosition(this.center.x + 100.px, this.center.y),
+ end = PxPosition(this.center.x + 100f, this.center.y),
endVelocity = 112f,
duration = 100.milliseconds
@@ -303,7 +302,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipeWithVelocity(
start = this.center,
- end = PxPosition(this.center.x - 100.px, this.center.y),
+ end = PxPosition(this.center.x - 100f, this.center.y),
endVelocity = 312f,
duration = 100.milliseconds
@@ -336,7 +335,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100.px, this.center.y),
+ end = PxPosition(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -348,7 +347,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 114.px, this.center.y),
+ end = PxPosition(this.center.x + 114f, this.center.y),
duration = 100.milliseconds
)
}
@@ -388,7 +387,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100.px, this.center.y),
+ end = PxPosition(this.center.x + 100, this.center.y),
duration = 100.milliseconds
)
}
@@ -551,7 +550,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 200.px, this.center.y),
+ end = PxPosition(this.center.x + 200f, this.center.y),
duration = 300.milliseconds
)
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/TextFieldOnValueChangeTextFieldValueTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/TextFieldOnValueChangeTextFieldValueTest.kt
index 9158382..150bcaa 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/TextFieldOnValueChangeTextFieldValueTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/TextFieldOnValueChangeTextFieldValueTest.kt
@@ -37,7 +37,6 @@
import androidx.ui.test.sendClick
import androidx.ui.text.TextRange
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.argumentCaptor
@@ -95,7 +94,7 @@
// Perform click to focus in.
find(hasInputMethodsSupport())
- .doGesture { sendClick(PxPosition(1.px, 1.px)) }
+ .doGesture { sendClick(PxPosition(1f, 1f)) }
runOnIdleCompose {
// Verify startInput is called and capture the callback.
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/DragDirection.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/DragDirection.kt
index 1ac765d..fe7d19a 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/DragDirection.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/DragDirection.kt
@@ -33,7 +33,7 @@
currentValue: Float
) -> Boolean
- internal open fun project(pos: PxPosition) = xProjection(pos.x.value) + yProjection(pos.y.value)
+ internal open fun project(pos: PxPosition) = xProjection(pos.x) + yProjection(pos.y)
/**
* Horizontal direction of dragging in [draggable] or [scrollable].
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Draggable.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Draggable.kt
index d5debc10..d929b46 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Draggable.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Draggable.kt
@@ -26,7 +26,6 @@
import androidx.ui.foundation.Interaction
import androidx.ui.foundation.InteractionState
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
/**
* Configure touch dragging for the UI element in a single [DragDirection]. The drag distance is
@@ -89,8 +88,8 @@
dragState.value = dragState.value + consumed
val fractionConsumed = if (projected == 0f) 0f else consumed / projected
return PxPosition(
- dragDirection.xProjection(dragDistance.x.value).px * fractionConsumed,
- dragDirection.yProjection(dragDistance.y.value).px * fractionConsumed
+ dragDirection.xProjection(dragDistance.x) * fractionConsumed,
+ dragDirection.yProjection(dragDistance.y) * fractionConsumed
)
}
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Scrollable.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Scrollable.kt
index f65dd6b..d9c9ce6 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Scrollable.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Scrollable.kt
@@ -34,7 +34,6 @@
import androidx.ui.foundation.animation.FlingConfig
import androidx.ui.foundation.animation.fling
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
/**
* Create [ScrollableState] for [scrollable] with default [FlingConfig] and
@@ -185,8 +184,8 @@
scrollableState.value = scrollableState.value + consumed
val fractionConsumed = if (projected == 0f) 0f else consumed / projected
return PxPosition(
- dragDirection.xProjection(dragDistance.x.value).px * fractionConsumed,
- dragDirection.yProjection(dragDistance.y.value).px * fractionConsumed
+ dragDirection.xProjection(dragDistance.x) * fractionConsumed,
+ dragDirection.yProjection(dragDistance.y) * fractionConsumed
)
}
diff --git a/ui/ui-layout/api/0.1.0-dev14.txt b/ui/ui-layout/api/0.1.0-dev14.txt
index d1db5d8..8b810dc 100644
--- a/ui/ui-layout/api/0.1.0-dev14.txt
+++ b/ui/ui-layout/api/0.1.0-dev14.txt
@@ -357,7 +357,7 @@
public final class LayoutOffsetKt {
method @androidx.compose.Stable public static androidx.ui.core.Modifier offset-qJOR85M(androidx.ui.core.Modifier, float x = 0.dp, float y = 0.dp);
- method public static androidx.ui.core.Modifier offsetPx(androidx.ui.core.Modifier, androidx.compose.State<androidx.ui.unit.Px> x = mutableStateOf(Px.Zero), androidx.compose.State<androidx.ui.unit.Px> y = mutableStateOf(Px.Zero));
+ method public static androidx.ui.core.Modifier offsetPx(androidx.ui.core.Modifier, androidx.compose.State<java.lang.Float> x = mutableStateOf(0.0), androidx.compose.State<java.lang.Float> y = mutableStateOf(0.0));
}
public final class LayoutPaddingKt {
diff --git a/ui/ui-layout/api/current.txt b/ui/ui-layout/api/current.txt
index d1db5d8..8b810dc 100644
--- a/ui/ui-layout/api/current.txt
+++ b/ui/ui-layout/api/current.txt
@@ -357,7 +357,7 @@
public final class LayoutOffsetKt {
method @androidx.compose.Stable public static androidx.ui.core.Modifier offset-qJOR85M(androidx.ui.core.Modifier, float x = 0.dp, float y = 0.dp);
- method public static androidx.ui.core.Modifier offsetPx(androidx.ui.core.Modifier, androidx.compose.State<androidx.ui.unit.Px> x = mutableStateOf(Px.Zero), androidx.compose.State<androidx.ui.unit.Px> y = mutableStateOf(Px.Zero));
+ method public static androidx.ui.core.Modifier offsetPx(androidx.ui.core.Modifier, androidx.compose.State<java.lang.Float> x = mutableStateOf(0.0), androidx.compose.State<java.lang.Float> y = mutableStateOf(0.0));
}
public final class LayoutPaddingKt {
diff --git a/ui/ui-layout/api/public_plus_experimental_0.1.0-dev14.txt b/ui/ui-layout/api/public_plus_experimental_0.1.0-dev14.txt
index d1db5d8..8b810dc 100644
--- a/ui/ui-layout/api/public_plus_experimental_0.1.0-dev14.txt
+++ b/ui/ui-layout/api/public_plus_experimental_0.1.0-dev14.txt
@@ -357,7 +357,7 @@
public final class LayoutOffsetKt {
method @androidx.compose.Stable public static androidx.ui.core.Modifier offset-qJOR85M(androidx.ui.core.Modifier, float x = 0.dp, float y = 0.dp);
- method public static androidx.ui.core.Modifier offsetPx(androidx.ui.core.Modifier, androidx.compose.State<androidx.ui.unit.Px> x = mutableStateOf(Px.Zero), androidx.compose.State<androidx.ui.unit.Px> y = mutableStateOf(Px.Zero));
+ method public static androidx.ui.core.Modifier offsetPx(androidx.ui.core.Modifier, androidx.compose.State<java.lang.Float> x = mutableStateOf(0.0), androidx.compose.State<java.lang.Float> y = mutableStateOf(0.0));
}
public final class LayoutPaddingKt {
diff --git a/ui/ui-layout/api/public_plus_experimental_current.txt b/ui/ui-layout/api/public_plus_experimental_current.txt
index d1db5d8..8b810dc 100644
--- a/ui/ui-layout/api/public_plus_experimental_current.txt
+++ b/ui/ui-layout/api/public_plus_experimental_current.txt
@@ -357,7 +357,7 @@
public final class LayoutOffsetKt {
method @androidx.compose.Stable public static androidx.ui.core.Modifier offset-qJOR85M(androidx.ui.core.Modifier, float x = 0.dp, float y = 0.dp);
- method public static androidx.ui.core.Modifier offsetPx(androidx.ui.core.Modifier, androidx.compose.State<androidx.ui.unit.Px> x = mutableStateOf(Px.Zero), androidx.compose.State<androidx.ui.unit.Px> y = mutableStateOf(Px.Zero));
+ method public static androidx.ui.core.Modifier offsetPx(androidx.ui.core.Modifier, androidx.compose.State<java.lang.Float> x = mutableStateOf(0.0), androidx.compose.State<java.lang.Float> y = mutableStateOf(0.0));
}
public final class LayoutPaddingKt {
diff --git a/ui/ui-layout/api/restricted_0.1.0-dev14.txt b/ui/ui-layout/api/restricted_0.1.0-dev14.txt
index d1db5d8..8b810dc 100644
--- a/ui/ui-layout/api/restricted_0.1.0-dev14.txt
+++ b/ui/ui-layout/api/restricted_0.1.0-dev14.txt
@@ -357,7 +357,7 @@
public final class LayoutOffsetKt {
method @androidx.compose.Stable public static androidx.ui.core.Modifier offset-qJOR85M(androidx.ui.core.Modifier, float x = 0.dp, float y = 0.dp);
- method public static androidx.ui.core.Modifier offsetPx(androidx.ui.core.Modifier, androidx.compose.State<androidx.ui.unit.Px> x = mutableStateOf(Px.Zero), androidx.compose.State<androidx.ui.unit.Px> y = mutableStateOf(Px.Zero));
+ method public static androidx.ui.core.Modifier offsetPx(androidx.ui.core.Modifier, androidx.compose.State<java.lang.Float> x = mutableStateOf(0.0), androidx.compose.State<java.lang.Float> y = mutableStateOf(0.0));
}
public final class LayoutPaddingKt {
diff --git a/ui/ui-layout/api/restricted_current.txt b/ui/ui-layout/api/restricted_current.txt
index d1db5d8..8b810dc 100644
--- a/ui/ui-layout/api/restricted_current.txt
+++ b/ui/ui-layout/api/restricted_current.txt
@@ -357,7 +357,7 @@
public final class LayoutOffsetKt {
method @androidx.compose.Stable public static androidx.ui.core.Modifier offset-qJOR85M(androidx.ui.core.Modifier, float x = 0.dp, float y = 0.dp);
- method public static androidx.ui.core.Modifier offsetPx(androidx.ui.core.Modifier, androidx.compose.State<androidx.ui.unit.Px> x = mutableStateOf(Px.Zero), androidx.compose.State<androidx.ui.unit.Px> y = mutableStateOf(Px.Zero));
+ method public static androidx.ui.core.Modifier offsetPx(androidx.ui.core.Modifier, androidx.compose.State<java.lang.Float> x = mutableStateOf(0.0), androidx.compose.State<java.lang.Float> y = mutableStateOf(0.0));
}
public final class LayoutPaddingKt {
diff --git a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/LayoutOffsetSample.kt b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/LayoutOffsetSample.kt
index 1e69347..2342975 100644
--- a/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/LayoutOffsetSample.kt
+++ b/ui/ui-layout/samples/src/main/java/androidx/ui/layout/samples/LayoutOffsetSample.kt
@@ -28,7 +28,6 @@
import androidx.ui.layout.offsetPx
import androidx.ui.layout.wrapContentSize
import androidx.ui.unit.dp
-import androidx.ui.unit.px
@Sampled
@Composable
@@ -46,11 +45,11 @@
@Composable
fun LayoutOffsetPxModifier() {
// This text will be offset in steps of 10.dp from the top left of the available space.
- val offset = state { 0.px }
+ val offset = state { 0f }
Text(
"Layout offset modifier sample",
Modifier
- .tapGestureFilter { offset.value += 10.px }
+ .tapGestureFilter { offset.value += 10f }
.offsetPx(offset, offset)
)
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AlignmentLineTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AlignmentLineTest.kt
index 7e5788a..f2fddbc 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AlignmentLineTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AlignmentLineTest.kt
@@ -88,10 +88,10 @@
Assert.assertEquals(childSize.value!!.height, parentSize.value!!.height)
Assert.assertNotNull(childPosition.value)
Assert.assertEquals(
- beforeDp.toIntPx().toPx() - lineDp.toIntPx().toPx(),
+ (beforeDp.toIntPx().toPx() - lineDp.toIntPx().toPx()).value,
childPosition.value!!.x
)
- Assert.assertEquals(0.px, childPosition.value!!.y)
+ Assert.assertEquals(0f, childPosition.value!!.y)
}
@Test
@@ -134,9 +134,9 @@
Assert.assertNotNull(parentSize.value)
Assert.assertEquals(beforeDp.toIntPx() + afterDp.toIntPx(), parentSize.value!!.height)
Assert.assertNotNull(childPosition.value)
- Assert.assertEquals(0.px, childPosition.value!!.x)
+ Assert.assertEquals(0f, childPosition.value!!.x)
Assert.assertEquals(
- beforeDp.toIntPx().toPx() - lineDp.toIntPx().toPx(),
+ (beforeDp.toIntPx().toPx() - lineDp.toIntPx().toPx()).value,
childPosition.value!!.y
)
}
@@ -171,8 +171,8 @@
Assert.assertNotNull(childSize.value)
Assert.assertEquals(childSize.value, parentSize.value)
Assert.assertNotNull(childPosition.value)
- Assert.assertEquals(0.px, childPosition.value!!.x)
- Assert.assertEquals(0.px, childPosition.value!!.y)
+ Assert.assertEquals(0f, childPosition.value!!.x)
+ Assert.assertEquals(0f, childPosition.value!!.y)
}
@Test
@@ -205,8 +205,8 @@
Assert.assertNotNull(childSize.value)
Assert.assertEquals(childSize.value, parentSize.value)
Assert.assertNotNull(childPosition.value)
- Assert.assertEquals(0.px, childPosition.value!!.x)
- Assert.assertEquals(0.px, childPosition.value!!.y)
+ Assert.assertEquals(0f, childPosition.value!!.x)
+ Assert.assertEquals(0f, childPosition.value!!.y)
}
@Test
@@ -246,8 +246,8 @@
Assert.assertNotNull(childSize.value)
Assert.assertEquals(childSize.value!!.height, parentSize.value!!.height)
Assert.assertNotNull(childPosition.value)
- Assert.assertEquals(5.px, childPosition.value!!.x)
- Assert.assertEquals(0.px, childPosition.value!!.y)
+ Assert.assertEquals(5f, childPosition.value!!.x)
+ Assert.assertEquals(0f, childPosition.value!!.y)
}
@Test
@@ -287,8 +287,8 @@
Assert.assertNotNull(parentSize.value)
Assert.assertEquals(maxHeight.toIntPx(), parentSize.value!!.height)
Assert.assertNotNull(childPosition.value)
- Assert.assertEquals(0.px, childPosition.value!!.x)
- Assert.assertEquals(5.px, childPosition.value!!.y)
+ Assert.assertEquals(0f, childPosition.value!!.x)
+ Assert.assertEquals(5f, childPosition.value!!.y)
}
@Test
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ContainerTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ContainerTest.kt
index cc62f65..381712a 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ContainerTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ContainerTest.kt
@@ -37,7 +37,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
-import androidx.ui.unit.px
import androidx.ui.unit.round
import androidx.ui.unit.toPx
import org.junit.Assert.assertEquals
@@ -94,7 +93,7 @@
) {
EmptyBox(width = sizeDp, height = sizeDp,
modifier = Modifier.onPositioned { coordinates ->
- childPosition.value = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition.value = coordinates.localToGlobal(PxPosition(0f, 0f))
positionedLatch.countDown()
}
)
@@ -198,7 +197,7 @@
height = sizeDp,
modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize.value = coordinates.size
- childPosition.value = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition.value = coordinates.localToGlobal(PxPosition(0f, 0f))
positionedLatch.countDown()
})
}
@@ -244,7 +243,7 @@
modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize.value = coordinates.size
childPosition.value =
- coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ coordinates.localToGlobal(PxPosition(0f, 0f))
positionedLatch.countDown()
})
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/IntrinsicTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/IntrinsicTest.kt
index ade1f50..1016f91 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/IntrinsicTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/IntrinsicTest.kt
@@ -35,7 +35,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
-import androidx.ui.unit.px
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
@@ -74,7 +73,7 @@
assertEquals(IntPxSize(10.dp.toIntPx(), 50.dp.toIntPx()), minIntrinsicWidthSize.value)
assertEquals(IntPxSize(10.dp.toIntPx(), 50.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0.px, 0.px), childPosition.value)
+ assertEquals(PxPosition(0f, 0f), childPosition.value)
}
@Test
@@ -103,7 +102,7 @@
assertEquals(IntPxSize(20.dp.toIntPx(), 40.dp.toIntPx()), minIntrinsicHeightSize.value)
assertEquals(IntPxSize(20.dp.toIntPx(), 40.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0.px, 0.px), childPosition.value)
+ assertEquals(PxPosition(0f, 0f), childPosition.value)
}
@Test
@@ -132,7 +131,7 @@
assertEquals(IntPxSize(30.dp.toIntPx(), 50.dp.toIntPx()), maxIntrinsicWidthSize.value)
assertEquals(IntPxSize(30.dp.toIntPx(), 50.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0.px, 0.px), childPosition.value)
+ assertEquals(PxPosition(0f, 0f), childPosition.value)
}
@Test
@@ -161,7 +160,7 @@
assertEquals(IntPxSize(20.dp.toIntPx(), 60.dp.toIntPx()), maxIntrinsicHeightSize.value)
assertEquals(IntPxSize(20.dp.toIntPx(), 60.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0.px, 0.px), childPosition.value)
+ assertEquals(PxPosition(0f, 0f), childPosition.value)
}
@Test
@@ -194,7 +193,7 @@
assertEquals(IntPxSize(5.dp.toIntPx(), 50.dp.toIntPx()), minIntrinsicWidthSize.value)
assertEquals(IntPxSize(5.dp.toIntPx(), 50.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0.px, 0.px), childPosition.value)
+ assertEquals(PxPosition(0f, 0f), childPosition.value)
}
@Test
@@ -227,7 +226,7 @@
assertEquals(IntPxSize(15.dp.toIntPx(), 50.dp.toIntPx()), minIntrinsicWidthSize.value)
assertEquals(IntPxSize(15.dp.toIntPx(), 50.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0.px, 0.px), childPosition.value)
+ assertEquals(PxPosition(0f, 0f), childPosition.value)
}
@Test
@@ -258,7 +257,7 @@
assertEquals(IntPxSize(20.dp.toIntPx(), 35.dp.toIntPx()), minIntrinsicHeightSize.value)
assertEquals(IntPxSize(20.dp.toIntPx(), 35.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0.px, 0.px), childPosition.value)
+ assertEquals(PxPosition(0f, 0f), childPosition.value)
}
@Test
@@ -289,7 +288,7 @@
assertEquals(IntPxSize(20.dp.toIntPx(), 45.dp.toIntPx()), minIntrinsicHeightSize.value)
assertEquals(IntPxSize(20.dp.toIntPx(), 45.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0.px, 0.px), childPosition.value)
+ assertEquals(PxPosition(0f, 0f), childPosition.value)
}
@Test
@@ -320,7 +319,7 @@
assertEquals(IntPxSize(25.dp.toIntPx(), 50.dp.toIntPx()), maxIntrinsicWidthSize.value)
assertEquals(IntPxSize(25.dp.toIntPx(), 50.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0.px, 0.px), childPosition.value)
+ assertEquals(PxPosition(0f, 0f), childPosition.value)
}
@Test
@@ -351,7 +350,7 @@
assertEquals(IntPxSize(35.dp.toIntPx(), 50.dp.toIntPx()), maxIntrinsicWidthSize.value)
assertEquals(IntPxSize(35.dp.toIntPx(), 50.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0.px, 0.px), childPosition.value)
+ assertEquals(PxPosition(0f, 0f), childPosition.value)
}
@Test
@@ -382,7 +381,7 @@
assertEquals(IntPxSize(20.dp.toIntPx(), 55.dp.toIntPx()), maxIntrinsicHeightSize.value)
assertEquals(IntPxSize(20.dp.toIntPx(), 55.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0.px, 0.px), childPosition.value)
+ assertEquals(PxPosition(0f, 0f), childPosition.value)
}
@Test
@@ -413,7 +412,7 @@
assertEquals(IntPxSize(20.dp.toIntPx(), 65.dp.toIntPx()), maxIntrinsicHeightSize.value)
assertEquals(IntPxSize(20.dp.toIntPx(), 65.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0.px, 0.px), childPosition.value)
+ assertEquals(PxPosition(0f, 0f), childPosition.value)
}
@Test
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAlignTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAlignTest.kt
index 6b23d3f..5ec5cb0 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAlignTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAlignTest.kt
@@ -80,10 +80,10 @@
waitForDraw(root)
assertEquals(IntPxSize(root.width.ipx, root.height.ipx), alignSize.value)
- assertEquals(PxPosition(0.px, 0.px), alignPosition.value)
+ assertEquals(PxPosition(0f, 0f), alignPosition.value)
assertEquals(IntPxSize(size, size), childSize.value)
assertEquals(
- PxPosition(root.width.px - size, root.height.px - size),
+ PxPosition((root.width.px - size).value, (root.height.px - size).value),
childPosition.value
)
}
@@ -121,9 +121,9 @@
waitForDraw(root)
assertEquals(IntPxSize(root.width.ipx, root.height.ipx), alignSize.value)
- assertEquals(PxPosition(0.px, 0.px), alignPosition.value)
+ assertEquals(PxPosition(0f, 0f), alignPosition.value)
assertEquals(IntPxSize(size, root.height.ipx), childSize.value)
- assertEquals(PxPosition(root.width.px - size, 0.px), childPosition.value)
+ assertEquals(PxPosition((root.width.px - size).value, 0f), childPosition.value)
}
@Test
@@ -236,9 +236,9 @@
waitForDraw(root)
assertEquals(IntPxSize(size, size), alignSize.value)
- assertEquals(PxPosition(0.px, 0.px), alignPosition.value)
+ assertEquals(PxPosition(0f, 0f), alignPosition.value)
assertEquals(IntPxSize(size, size), childSize.value)
- assertEquals(PxPosition(0.px, 0.px), childPosition.value)
+ assertEquals(PxPosition(0f, 0f), childPosition.value)
}
@Test
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutOffsetTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutOffsetTest.kt
index 715e6ed..d5e06eb 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutOffsetTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutOffsetTest.kt
@@ -47,6 +47,7 @@
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
+import kotlin.math.roundToInt
@SmallTest
@RunWith(JUnit4::class)
@@ -74,8 +75,8 @@
.wrapContentSize(Alignment.TopStart)
.offset(offsetX, offsetY)
.onPositioned { coordinates: LayoutCoordinates ->
- positionX = coordinates.globalPosition.x.round()
- positionY = coordinates.globalPosition.y.round()
+ positionX = coordinates.globalPosition.x.px.round()
+ positionY = coordinates.globalPosition.y.px.round()
}
) {
}
@@ -105,8 +106,8 @@
.wrapContentSize(Alignment.TopStart)
.offset(offsetX, offsetY)
.onPositioned { coordinates: LayoutCoordinates ->
- positionX = coordinates.globalPosition.x.round()
- positionY = coordinates.globalPosition.y.round()
+ positionX = coordinates.globalPosition.x.px.round()
+ positionY = coordinates.globalPosition.y.px.round()
}
) {
// TODO(popam): this box should not be needed after b/154758475 is fixed.
@@ -123,10 +124,10 @@
@Test
fun positionIsModified_px() = with(density) {
- val offsetX = 10.px
- val offsetY = 20.px
- var positionX = 0.px
- var positionY = 0.px
+ val offsetX = 10f
+ val offsetY = 20f
+ var positionX = 0f
+ var positionY = 0f
composeTestRule.setContent {
Stack(
Modifier.testTag("stack")
@@ -150,11 +151,11 @@
@Test
fun positionIsModified_px_rtl() = with(density) {
val containerWidth = 30.dp
- val boxSize = 1.ipx
- val offsetX = 10.px
- val offsetY = 20.px
- var positionX = 0.px
- var positionY = 0.px
+ val boxSize = 1f
+ val offsetX = 10f
+ val offsetY = 20f
+ var positionX = 0f
+ var positionY = 0f
composeTestRule.setContent {
Stack(
Modifier.testTag("stack")
@@ -164,8 +165,8 @@
.wrapContentSize(Alignment.TopStart)
.offsetPx(state { offsetX }, state { offsetY })
.onPositioned { coordinates: LayoutCoordinates ->
- positionX = coordinates.globalPosition.x
- positionY = coordinates.globalPosition.y
+ positionX = coordinates.globalPosition.x.roundToInt().toFloat()
+ positionY = coordinates.globalPosition.y.roundToInt().toFloat()
}
) {
// TODO(popam): this box should not be needed after b/154758475 is fixed.
@@ -176,8 +177,9 @@
findByTag("stack").assertExists()
runOnIdleCompose {
Assert.assertEquals(
- containerWidth.toIntPx() - offsetX.round() - boxSize,
- positionX.round()
+ containerWidth.toIntPx().value.toFloat() -
+ offsetX.roundToInt().toFloat() - boxSize,
+ positionX.roundToInt().toFloat()
)
Assert.assertEquals(offsetY, positionY)
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutPaddingTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutPaddingTest.kt
index a3e00a3..4619854 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutPaddingTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutPaddingTest.kt
@@ -45,7 +45,6 @@
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import androidx.ui.unit.min
-import androidx.ui.unit.px
import androidx.ui.unit.toPx
import androidx.ui.unit.toPxSize
import org.junit.Assert
@@ -252,7 +251,7 @@
val drawLatch = CountDownLatch(3)
val childSize = Array(3) { IntPxSize(0.ipx, 0.ipx) }
- val childPosition = Array(3) { PxPosition(0.px, 0.px) }
+ val childPosition = Array(3) { PxPosition(0f, 0f) }
// ltr: P1 S P2 | S P3 | P1 S
// rtl: S P1 | P3 S | P2 S P1
@@ -263,7 +262,7 @@
.preferredSize(sizeDp, sizeDp)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -274,7 +273,7 @@
.preferredSize(sizeDp, sizeDp)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -285,7 +284,7 @@
.preferredSize(sizeDp, sizeDp)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[2] = coordinates.size
- childPosition[2] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[2] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -366,7 +365,7 @@
val drawLatch = CountDownLatch(1)
var childSize = IntPxSize(-1.ipx, -1.ipx)
- var childPosition = PxPosition(-1.px, -1.px)
+ var childPosition = PxPosition(-1f, -1f)
show {
Stack(Modifier.fillMaxSize()) {
ConstrainedBox(
@@ -376,7 +375,7 @@
val children = @Composable {
Container(Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize = coordinates.size
- childPosition = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}) {
}
@@ -395,7 +394,7 @@
val left = ((root.width.ipx - size) / 2) + paddingPx
val top = ((root.height.ipx - size) / 2) + paddingPx
assertEquals(
- PxPosition(left.toPx(), top.toPx()),
+ PxPosition(left.toPx().value, top.toPx().value),
childPosition
)
}
@@ -412,7 +411,7 @@
val drawLatch = CountDownLatch(1)
var childSize = IntPxSize(-1.ipx, -1.ipx)
- var childPosition = PxPosition(-1.px, -1.px)
+ var childPosition = PxPosition(-1f, -1f)
show {
Stack(Modifier.fillMaxSize()) {
ConstrainedBox(
@@ -422,7 +421,7 @@
val children = @Composable {
Container(Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize = coordinates.size
- childPosition = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}) {
}
@@ -450,7 +449,7 @@
val viewLeft = ((root.width.ipx - size) / 2) + paddingLeft
val viewTop = ((root.height.ipx - size) / 2) + paddingTop
assertEquals(
- PxPosition(viewLeft.toPx(), viewTop.toPx()),
+ PxPosition(viewLeft.toPx().value, viewTop.toPx().value),
childPosition
)
}
@@ -465,7 +464,7 @@
val drawLatch = CountDownLatch(1)
var childSize = IntPxSize(-1.ipx, -1.ipx)
- var childPosition = PxPosition(-1.px, -1.px)
+ var childPosition = PxPosition(-1f, -1f)
show {
Stack(Modifier.fillMaxSize()) {
ConstrainedBox(
@@ -475,7 +474,7 @@
paddingContainer {
Container(Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize = coordinates.size
- childPosition = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}) {
}
@@ -491,7 +490,7 @@
assertEquals(IntPxSize(0.ipx, 0.ipx), childSize)
val left = ((root.width.ipx - size) / 2) + paddingPx
val top = ((root.height.ipx - size) / 2) + paddingPx
- assertEquals(PxPosition(left.toPx(), top.toPx()), childPosition)
+ assertEquals(PxPosition(left.toPx().value, top.toPx().value), childPosition)
}
/**
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt
index 66abc3d..d657203 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt
@@ -145,7 +145,7 @@
positionedLatch: CountDownLatch
): Modifier = this.onPositioned { coordinates ->
size.value = IntPxSize(coordinates.size.width, coordinates.size.height)
- position.value = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ position.value = coordinates.localToGlobal(PxPosition(0f, 0f))
positionedLatch.countDown()
}
@@ -274,21 +274,21 @@
actual as PxPosition
assertEquals(
- "Expected x ${expected.x.value} but obtained ${actual.x.value}",
- expected.x.value,
- actual.x.value,
+ "Expected x ${expected.x} but obtained ${actual.x}",
+ expected.x,
+ actual.x,
0f
)
assertEquals(
- "Expected y ${expected.y.value} but obtained ${actual.y.value}",
- expected.y.value,
- actual.y.value,
+ "Expected y ${expected.y} but obtained ${actual.y}",
+ expected.y,
+ actual.y,
0f
)
- if (actual.x.value != actual.x.value.toInt().toFloat()) {
+ if (actual.x != actual.x.toInt().toFloat()) {
fail("Expected integer x coordinate")
}
- if (actual.y.value != actual.y.value.toInt().toFloat()) {
+ if (actual.y != actual.y.toInt().toFloat()) {
fail("Expected integer y coordinate")
}
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/OnPositionedTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/OnPositionedTest.kt
index 8b19a37..751f701 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/OnPositionedTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/OnPositionedTest.kt
@@ -69,8 +69,8 @@
Modifier.fillMaxSize()
.padding(start = paddingLeftPx.toDp(), top = paddingTopPx.toDp())
.onPositioned {
- realLeft = it.positionInParent.x.value
- realTop = it.positionInParent.y.value
+ realLeft = it.positionInParent.x
+ realTop = it.positionInParent.y
positionedLatch.countDown()
}
) {
@@ -92,8 +92,8 @@
val positionedLatch = CountDownLatch(1)
show {
Container(Modifier.onChildPositioned {
- realLeft = it.positionInParent.x.value
- realTop = it.positionInParent.y.value
+ realLeft = it.positionInParent.x
+ realTop = it.positionInParent.y
positionedLatch.countDown()
}) {
Container(
@@ -146,12 +146,12 @@
// global position
val gPos = childCoordinates!!.localToGlobal(PxPosition.Origin).x
- assertThat(gPos).isEqualTo(firstPaddingPx + secondPaddingPx + thirdPaddingPx)
+ assertThat(gPos).isEqualTo((firstPaddingPx + secondPaddingPx + thirdPaddingPx).value)
// Position in grandparent Px(value=50.0)
val gpPos = gpCoordinates!!.childToLocal(childCoordinates!!, PxPosition.Origin).x
- assertThat(gpPos).isEqualTo(secondPaddingPx + thirdPaddingPx)
+ assertThat(gpPos).isEqualTo((secondPaddingPx + thirdPaddingPx).value)
// local position
- assertThat(childCoordinates!!.positionInParent.x).isEqualTo(thirdPaddingPx)
+ assertThat(childCoordinates!!.positionInParent.x).isEqualTo(thirdPaddingPx.value)
}
@Test
@@ -177,8 +177,8 @@
}
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
- assertThat(0.0f).isEqualTo(firstCoordinates!!.positionInParent.x.value)
- assertThat(size).isEqualTo(secondCoordinates!!.positionInParent.x.value)
+ assertThat(0.0f).isEqualTo(firstCoordinates!!.positionInParent.x)
+ assertThat(size).isEqualTo(secondCoordinates!!.positionInParent.x)
}
@Test
@@ -244,7 +244,7 @@
Stack {
Container(
Modifier.onPositioned {
- realLeft = it.positionInParent.x.value
+ realLeft = it.positionInParent.x
positionedLatch.countDown()
}
.fillMaxSize()
@@ -279,7 +279,7 @@
Container(width = 10.dp, height = 10.dp) {
Container(
Modifier.onPositioned {
- realLeft = it.positionInRoot.x.value
+ realLeft = it.positionInRoot.x
positionedLatch.countDown()
},
width = 10.dp,
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/RowColumnTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/RowColumnTest.kt
index 176200a..3a8a3f5 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/RowColumnTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/RowColumnTest.kt
@@ -81,7 +81,7 @@
val drawLatch = CountDownLatch(2)
val childSize = arrayOf(IntPxSize(-1.ipx, -1.ipx), IntPxSize(-1.ipx, -1.ipx))
- val childPosition = arrayOf(PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px))
+ val childPosition = arrayOf(PxPosition(-1f, -1f), PxPosition(-1f, -1f))
show {
Container(alignment = Alignment.TopStart) {
Row {
@@ -90,7 +90,7 @@
height = sizeDp,
modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -101,7 +101,7 @@
height = (sizeDp * 2),
modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -119,8 +119,8 @@
IntPxSize((sizeDp.toPx() * 2).roundToInt().ipx, (sizeDp.toPx() * 2).roundToInt().ipx),
childSize[1]
)
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
- assertEquals(PxPosition(size.toPx(), 0.px), childPosition[1])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(PxPosition(size.toPx().value, 0f), childPosition[1])
}
@Test
@@ -139,7 +139,7 @@
Modifier.weight(1f)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
},
width = width,
@@ -151,7 +151,7 @@
Modifier.weight(2f)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
},
width = width,
@@ -175,8 +175,8 @@
IntPxSize((rootWidth * 2 / 3).round(), childrenHeight),
childSize[1]
)
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
- assertEquals(PxPosition((rootWidth / 3).round().toPx(), 0.px), childPosition[1])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(PxPosition((rootWidth / 3).round().toPx().value, 0f), childPosition[1])
}
@Test
@@ -196,7 +196,7 @@
Modifier.weight(1f, fill = false)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
},
width = width,
@@ -208,7 +208,7 @@
Modifier.weight(2f, fill = false)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
},
width = width,
@@ -225,8 +225,8 @@
assertEquals(IntPxSize(childrenWidth, childrenHeight), childSize[0])
assertEquals(IntPxSize(childrenWidth, childrenHeight * 2), childSize[1])
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
- assertEquals(PxPosition(childrenWidth.toPx(), 0.px), childPosition[1])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(PxPosition(childrenWidth.toPx().value, 0f), childPosition[1])
}
@Test
@@ -236,7 +236,7 @@
val drawLatch = CountDownLatch(2)
val childSize = arrayOf(IntPxSize(-1.ipx, -1.ipx), IntPxSize(-1.ipx, -1.ipx))
- val childPosition = arrayOf(PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px))
+ val childPosition = arrayOf(PxPosition(-1f, -1f), PxPosition(-1f, -1f))
show {
Container(alignment = Alignment.TopStart) {
Column {
@@ -245,7 +245,7 @@
height = sizeDp,
modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -255,7 +255,7 @@
height = (sizeDp * 2),
modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -273,8 +273,8 @@
IntPxSize((sizeDp.toPx() * 2).roundToInt().ipx, (sizeDp.toPx() * 2).roundToInt().ipx),
childSize[1]
)
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
- assertEquals(PxPosition(0.px, size.toPx()), childPosition[1])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(PxPosition(0f, size.toPx().value), childPosition[1])
}
@Test
@@ -293,7 +293,7 @@
Modifier.weight(1f)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
},
width = width,
@@ -305,7 +305,7 @@
Modifier.weight(2f)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
},
width = width,
@@ -327,8 +327,8 @@
assertEquals(
IntPxSize(childrenWidth, (rootHeight * 2 / 3).round()), childSize[1]
)
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
- assertEquals(PxPosition(0.px, (rootHeight / 3).round().toPx()), childPosition[1])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(PxPosition(0f, (rootHeight / 3).round().toPx().value), childPosition[1])
}
@Test
@@ -348,7 +348,7 @@
Modifier.weight(1f, fill = false)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
},
width = width,
@@ -359,7 +359,7 @@
Modifier.weight(2f, fill = false)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
},
width = width,
@@ -378,8 +378,8 @@
assertEquals(
IntPxSize(childrenWidth, childrenHeight), childSize[1]
)
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
- assertEquals(PxPosition(0.px, childrenHeight.toPx()), childPosition[1])
+ assertEquals(PxPosition(0.0f, 0.0f), childPosition[0])
+ assertEquals(PxPosition(0.0f, childrenHeight.toPx().value), childPosition[1])
}
@Test
@@ -403,7 +403,7 @@
Modifier.weight(1f)
.onPositioned { coordinates: LayoutCoordinates ->
width[0] = coordinates.size.width
- x[0] = coordinates.globalPosition.x
+ x[0] = coordinates.globalPosition.x.px
latch.countDown()
}
) {
@@ -412,7 +412,7 @@
Modifier.weight(1f)
.onPositioned { coordinates: LayoutCoordinates ->
width[1] = coordinates.size.width
- x[1] = coordinates.globalPosition.x
+ x[1] = coordinates.globalPosition.x.px
latch.countDown()
}
) {
@@ -449,7 +449,7 @@
Modifier.weight(2f)
.onPositioned { coordinates: LayoutCoordinates ->
width[0] = coordinates.size.width
- x[0] = coordinates.globalPosition.x
+ x[0] = coordinates.globalPosition.x.px
latch.countDown()
}
) {
@@ -458,7 +458,7 @@
Modifier.weight(2f)
.onPositioned { coordinates: LayoutCoordinates ->
width[1] = coordinates.size.width
- x[1] = coordinates.globalPosition.x
+ x[1] = coordinates.globalPosition.x.px
latch.countDown()
}
) {
@@ -467,7 +467,7 @@
Modifier.weight(3f)
.onPositioned { coordinates: LayoutCoordinates ->
width[2] = coordinates.size.width
- x[2] = coordinates.globalPosition.x
+ x[2] = coordinates.globalPosition.x.px
latch.countDown()
}
) {
@@ -505,7 +505,7 @@
Modifier.weight(1f)
.onPositioned { coordinates: LayoutCoordinates ->
height[0] = coordinates.size.height
- y[0] = coordinates.globalPosition.y
+ y[0] = coordinates.globalPosition.y.px
latch.countDown()
}
) {
@@ -514,7 +514,7 @@
Modifier.weight(1f)
.onPositioned { coordinates: LayoutCoordinates ->
height[1] = coordinates.size.height
- y[1] = coordinates.globalPosition.y
+ y[1] = coordinates.globalPosition.y.px
latch.countDown()
}
) {
@@ -523,7 +523,7 @@
Modifier.weight(1f)
.onPositioned { coordinates: LayoutCoordinates ->
height[2] = coordinates.size.height
- y[2] = coordinates.globalPosition.y
+ y[2] = coordinates.globalPosition.y.px
latch.countDown()
}
) {
@@ -561,7 +561,7 @@
Modifier.weight(1f)
.onPositioned { coordinates: LayoutCoordinates ->
height[0] = coordinates.size.height
- y[0] = coordinates.globalPosition.y
+ y[0] = coordinates.globalPosition.y.px
latch.countDown()
}
) {
@@ -570,7 +570,7 @@
Modifier.weight(1f)
.onPositioned { coordinates: LayoutCoordinates ->
height[1] = coordinates.size.height
- y[1] = coordinates.globalPosition.y
+ y[1] = coordinates.globalPosition.y.px
latch.countDown()
}
) {
@@ -596,7 +596,7 @@
val drawLatch = CountDownLatch(2)
val childSize = arrayOf(IntPxSize(-1.ipx, -1.ipx), IntPxSize(-1.ipx, -1.ipx))
- val childPosition = arrayOf(PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px))
+ val childPosition = arrayOf(PxPosition(-1f, -1f), PxPosition(-1f, -1f))
show {
Row {
Container(
@@ -605,7 +605,7 @@
modifier = Modifier.fillMaxHeight()
.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -617,7 +617,7 @@
modifier = Modifier.fillMaxHeight()
.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -634,8 +634,8 @@
IntPxSize((sizeDp.toPx() * 2).roundToInt().ipx, root.height.ipx),
childSize[1]
)
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
- assertEquals(PxPosition(size.toPx(), 0.px), childPosition[1])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(PxPosition(size.toPx().value, 0f), childPosition[1])
}
@Test
@@ -689,16 +689,18 @@
val rootHeight = root.height.px
assertEquals(IntPxSize(size, size), childSize[0])
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
assertEquals(IntPxSize(size, size), childSize[1])
assertEquals(
- PxPosition(size.toPx(), ((rootHeight - size.toPx()) / 2).round().toPx()),
+ PxPosition(size.toPx().value, ((rootHeight - size.toPx()) / 2).round().toPx().value),
childPosition[1]
)
assertEquals(IntPxSize(size, size), childSize[2])
- assertEquals(PxPosition(size.toPx() * 2, rootHeight - size.toPx()), childPosition[2])
+ assertEquals(PxPosition((size.toPx() * 2).value,
+ (rootHeight - size.toPx()).value),
+ childPosition[2])
}
@Test
@@ -753,16 +755,18 @@
val rootHeight = root.height.px
assertEquals(IntPxSize(size, size), childSize[0])
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
assertEquals(IntPxSize(size, size), childSize[1])
assertEquals(
- PxPosition(size.toPx(), ((rootHeight - size.toPx()) / 2).round().toPx()),
+ PxPosition(size.toPx().value, ((rootHeight - size.toPx()) / 2).round().toPx().value),
childPosition[1]
)
assertEquals(IntPxSize(size, size), childSize[2])
- assertEquals(PxPosition(size.toPx() * 2, rootHeight - size.toPx()), childPosition[2])
+ assertEquals(
+ PxPosition((size.toPx() * 2).value, (rootHeight - size.toPx()).value),
+ childPosition[2])
}
@Test
@@ -830,23 +834,23 @@
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
assertEquals(IntPxSize(size, size), childSize[0])
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
assertEquals(IntPxSize(size, size), childSize[1])
assertEquals(
- PxPosition(size.toPx(), (baseline1 - (size.toPx() / 2).round()).toPx()),
+ PxPosition(size.toPx().value, (baseline1 - (size.toPx() / 2).round()).toPx().value),
childPosition[1]
)
assertEquals(IntPxSize(size, size), childSize[2])
assertEquals(
- PxPosition(size.toPx() * 2, (baseline1 - baseline2).toPx()),
+ PxPosition((size.toPx() * 2).value, (baseline1 - baseline2).toPx().value),
childPosition[2]
)
assertEquals(IntPxSize(size, size), childSize[3])
assertEquals(
- PxPosition(size.toPx() * 3, 0.px),
+ PxPosition((size.toPx() * 3).value, 0f),
childPosition[3]
)
}
@@ -891,10 +895,13 @@
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
assertEquals(IntPxSize(size, size), childSize[0])
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
assertEquals(size, childSize[1]!!.height)
- assertEquals(PxPosition(size.toPx(), (baseline - size / 2).toPx()), childPosition[1])
+ assertEquals(
+ PxPosition(size.toPx().value, (baseline - size / 2).toPx().value),
+ childPosition[1]
+ )
}
// endregion
@@ -906,7 +913,7 @@
val drawLatch = CountDownLatch(2)
val childSize = arrayOf(IntPxSize(-1.ipx, -1.ipx), IntPxSize(-1.ipx, -1.ipx))
- val childPosition = arrayOf(PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px))
+ val childPosition = arrayOf(PxPosition(-1f, -1f), PxPosition(-1f, -1f))
show {
Column {
Container(
@@ -915,7 +922,7 @@
modifier = Modifier.fillMaxWidth()
.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -927,7 +934,7 @@
modifier = Modifier.fillMaxWidth()
.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -944,8 +951,8 @@
IntPxSize(root.width.ipx, (sizeDp * 2).toIntPx()),
childSize[1]
)
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
- assertEquals(PxPosition(0.px, size.toPx()), childPosition[1])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(PxPosition(0f, size.toPx().value), childPosition[1])
}
@Test
@@ -1000,16 +1007,22 @@
val rootWidth = root.width.px
assertEquals(IntPxSize(size, size), childSize[0])
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
assertEquals(IntPxSize(size, size), childSize[1])
assertEquals(
- PxPosition(((rootWidth - size.toPx()) / 2).round().toPx(), size.toPx()),
+ PxPosition(
+ ((rootWidth - size.toPx()) / 2).round().toPx().value,
+ size.toPx().value
+ ),
childPosition[1]
)
assertEquals(IntPxSize(size, size), childSize[2])
- assertEquals(PxPosition(rootWidth - size.toPx(), size.toPx() * 2), childPosition[2])
+ assertEquals(
+ PxPosition((rootWidth - size.toPx()).value, size.toPx().value * 2),
+ childPosition[2]
+ )
}
@Test
@@ -1063,16 +1076,22 @@
val rootWidth = root.width.px
assertEquals(IntPxSize(size, size), childSize[0])
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
assertEquals(IntPxSize(size, size), childSize[1])
assertEquals(
- PxPosition(((rootWidth - size.toPx()) / 2).round().toPx(), size.toPx()),
+ PxPosition(
+ ((rootWidth - size.toPx()) / 2).round().toPx().value,
+ size.toPx().value
+ ),
childPosition[1]
)
assertEquals(IntPxSize(size, size), childSize[2])
- assertEquals(PxPosition(rootWidth - size.toPx(), size.toPx() * 2), childPosition[2])
+ assertEquals(
+ PxPosition((rootWidth - size.toPx()).value, size.toPx().value * 2),
+ childPosition[2]
+ )
}
@Test
@@ -1138,20 +1157,26 @@
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
assertEquals(IntPxSize(size, size), childSize[0])
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
assertEquals(IntPxSize(size, size), childSize[1])
- assertEquals(PxPosition(size.toPx(), size.toPx()), childPosition[1])
+ assertEquals(PxPosition(size.toPx().value, size.toPx().value), childPosition[1])
assertEquals(IntPxSize(size, size), childSize[2])
assertEquals(
- PxPosition((size - firstBaseline1Dp.toIntPx()).toPx(), size.toPx() * 2),
+ PxPosition(
+ (size - firstBaseline1Dp.toIntPx()).toPx().value,
+ size.toPx().value * 2
+ ),
childPosition[2]
)
assertEquals(IntPxSize(size, size), childSize[3])
assertEquals(
- PxPosition((size - firstBaseline2Dp.toIntPx()).toPx(), size.toPx() * 3),
+ PxPosition(
+ (size - firstBaseline2Dp.toIntPx()).toPx().value,
+ size.toPx().value * 3
+ ),
childPosition[3]
)
}
@@ -1196,10 +1221,13 @@
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
assertEquals(IntPxSize(size, size), childSize[0])
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
assertEquals(size, childSize[1]!!.width)
- assertEquals(PxPosition((baseline - (size / 2)).toPx(), size.toPx()), childPosition[1])
+ assertEquals(
+ PxPosition((baseline - (size / 2)).toPx().value, size.toPx().value),
+ childPosition[1]
+ )
}
// endregion
@@ -2108,7 +2136,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px)
+ PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2141,9 +2169,9 @@
val root = findOwnerView()
waitForDraw(root)
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
- assertEquals(PxPosition(size.toPx(), 0.px), childPosition[1])
- assertEquals(PxPosition(size.toPx() * 2, 0.px), childPosition[2])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(PxPosition(size.toPx().value, 0f), childPosition[1])
+ assertEquals(PxPosition(size.toPx().value * 2, 0f), childPosition[2])
}
@Test
@@ -2153,7 +2181,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px)
+ PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2184,9 +2212,9 @@
val root = findOwnerView()
waitForDraw(root)
- assertEquals(PxPosition(root.width.px - size.toPx() * 3, 0.px), childPosition[0])
- assertEquals(PxPosition(root.width.px - size.toPx() * 2, 0.px), childPosition[1])
- assertEquals(PxPosition(root.width.px - size.toPx(), 0.px), childPosition[2])
+ assertEquals(PxPosition((root.width.px - size.toPx() * 3).value, 0f), childPosition[0])
+ assertEquals(PxPosition((root.width.px - size.toPx() * 2).value, 0f), childPosition[1])
+ assertEquals(PxPosition((root.width.px - size.toPx()).value, 0f), childPosition[2])
}
@Test
@@ -2196,7 +2224,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px)
+ PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2228,9 +2256,18 @@
waitForDraw(root)
val extraSpace = root.width.px.round() - size * 3
- assertEquals(PxPosition((extraSpace / 2).toPx(), 0.px), childPosition[0])
- assertEquals(PxPosition((extraSpace / 2).toPx() + size.toPx(), 0.px), childPosition[1])
- assertEquals(PxPosition((extraSpace / 2).toPx() + size.toPx() * 2, 0.px), childPosition[2])
+ assertEquals(PxPosition((extraSpace / 2).toPx().value, 0f), childPosition[0])
+ assertEquals(
+ PxPosition(((extraSpace / 2).toPx() + size.toPx()).value, 0f),
+ childPosition[1]
+ )
+ assertEquals(
+ PxPosition(
+ ((extraSpace / 2).toPx() + size.toPx() * 2).value,
+ 0f
+ ),
+ childPosition[2]
+ )
}
@Test
@@ -2240,7 +2277,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px)
+ PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2272,9 +2309,15 @@
waitForDraw(root)
val gap = (root.width.px - size.toPx() * 3) / 4
- assertEquals(PxPosition(gap.round().toPx(), 0.px), childPosition[0])
- assertEquals(PxPosition((size.toPx() + gap * 2).round().toPx(), 0.px), childPosition[1])
- assertEquals(PxPosition((size.toPx() * 2 + gap * 3).round().toPx(), 0.px), childPosition[2])
+ assertEquals(PxPosition(gap.round().toPx().value, 0f), childPosition[0])
+ assertEquals(
+ PxPosition((size.toPx() + gap * 2).round().toPx().value, 0f),
+ childPosition[1]
+ )
+ assertEquals(
+ PxPosition((size.toPx() * 2 + gap * 3).round().toPx().value, 0f),
+ childPosition[2]
+ )
}
@Test
@@ -2284,7 +2327,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px)
+ PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2316,9 +2359,12 @@
waitForDraw(root)
val gap = (root.width.px - size.toPx() * 3) / 2
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
- assertEquals(PxPosition((gap + size.toPx()).round().toPx(), 0.px), childPosition[1])
- assertEquals(PxPosition((gap * 2 + size.toPx() * 2).round().toPx(), 0.px), childPosition[2])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(PxPosition((gap + size.toPx()).round().toPx().value, 0f), childPosition[1])
+ assertEquals(
+ PxPosition((gap * 2 + size.toPx() * 2).round().toPx().value, 0f),
+ childPosition[2]
+ )
}
@Test
@@ -2328,7 +2374,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px)
+ PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2363,9 +2409,15 @@
waitForDraw(root)
val gap = (root.width.px.round() - size * 3) / 3
- assertEquals(PxPosition((gap / 2).toPx(), 0.px), childPosition[0])
- assertEquals(PxPosition((gap * 3 / 2).toPx() + size.toPx(), 0.px), childPosition[1])
- assertEquals(PxPosition((gap * 5 / 2).toPx() + size.toPx() * 2, 0.px), childPosition[2])
+ assertEquals(PxPosition((gap / 2).toPx().value, 0f), childPosition[0])
+ assertEquals(
+ PxPosition(((gap * 3 / 2).toPx() + size.toPx()).value, 0f),
+ childPosition[1]
+ )
+ assertEquals(
+ PxPosition(((gap * 5 / 2).toPx() + size.toPx() * 2).value, 0f),
+ childPosition[2]
+ )
}
@Test
@@ -2407,10 +2459,13 @@
waitForDraw(root)
val step = (root.width.px - size.toPx() * 3) / 3
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
- assertEquals(PxPosition((step + size.toPx()).round().toPx(), 0.px), childPosition[1])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
assertEquals(
- PxPosition((step * 3 + size.toPx() * 2).round().toPx(), 0.px),
+ PxPosition((step + size.toPx()).round().toPx().value, 0f),
+ childPosition[1]
+ )
+ assertEquals(
+ PxPosition((step * 3 + size.toPx() * 2).round().toPx().value, 0f),
childPosition[2]
)
}
@@ -2424,7 +2479,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px)
+ PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2455,9 +2510,9 @@
val root = findOwnerView()
waitForDraw(root)
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
- assertEquals(PxPosition(0.px, size.toPx()), childPosition[1])
- assertEquals(PxPosition(0.px, size.toPx() * 2), childPosition[2])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(PxPosition(0f, size.toPx().value), childPosition[1])
+ assertEquals(PxPosition(0f, size.toPx().value * 2), childPosition[2])
}
@Test
@@ -2467,7 +2522,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px)
+ PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2498,9 +2553,9 @@
val root = findOwnerView()
waitForDraw(root)
- assertEquals(PxPosition(0.px, root.height.px - size.toPx() * 3), childPosition[0])
- assertEquals(PxPosition(0.px, root.height.px - size.toPx() * 2), childPosition[1])
- assertEquals(PxPosition(0.px, root.height.px - size.toPx()), childPosition[2])
+ assertEquals(PxPosition(0f, (root.height.px - size.toPx() * 3).value), childPosition[0])
+ assertEquals(PxPosition(0f, (root.height.px - size.toPx() * 2).value), childPosition[1])
+ assertEquals(PxPosition(0f, (root.height.px - size.toPx()).value), childPosition[2])
}
@Test
@@ -2510,7 +2565,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px)
+ PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2542,9 +2597,21 @@
waitForDraw(root)
val extraSpace = root.height.px.round() - size * 3
- assertEquals(PxPosition(0.px, (extraSpace / 2).toPx()), childPosition[0])
- assertEquals(PxPosition(0.px, (extraSpace / 2).toPx() + size.toPx()), childPosition[1])
- assertEquals(PxPosition(0.px, (extraSpace / 2).toPx() + size.toPx() * 2), childPosition[2])
+ assertEquals(
+ PxPosition(0f, (extraSpace / 2).toPx().value),
+ childPosition[0]
+ )
+ assertEquals(
+ PxPosition(0f, ((extraSpace / 2).toPx() + size.toPx()).value),
+ childPosition[1]
+ )
+ assertEquals(
+ PxPosition(
+ 0f,
+ ((extraSpace / 2).toPx() + size.toPx() * 2).value
+ ),
+ childPosition[2]
+ )
}
@Test
@@ -2554,7 +2621,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px)
+ PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2586,9 +2653,12 @@
waitForDraw(root)
val gap = (root.height.px - size.toPx() * 3) / 4
- assertEquals(PxPosition(0.px, gap.round().toPx()), childPosition[0])
- assertEquals(PxPosition(0.px, (size.toPx() + gap * 2).round().toPx()), childPosition[1])
- assertEquals(PxPosition(0.px, (size.toPx() * 2 + gap * 3).round().toPx()), childPosition[2])
+ assertEquals(PxPosition(0f, gap.round().toPx().value), childPosition[0])
+ assertEquals(PxPosition(0f, (size.toPx() + gap * 2).round().toPx().value), childPosition[1])
+ assertEquals(
+ PxPosition(0f, (size.toPx() * 2 + gap * 3).round().toPx().value),
+ childPosition[2]
+ )
}
private fun calculateChildPositions(
@@ -2598,7 +2668,7 @@
) {
for (i in childPosition.indices) {
childPosition[i] = parentLayoutCoordinates!!
- .childToLocal(childLayoutCoordinates[i]!!, PxPosition(0.px, 0.px))
+ .childToLocal(childLayoutCoordinates[i]!!, PxPosition(0f, 0f))
}
}
@@ -2609,7 +2679,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px)
+ PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2641,9 +2711,12 @@
waitForDraw(root)
val gap = (root.height.px - size.toPx() * 3) / 2
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
- assertEquals(PxPosition(0.px, (gap + size.toPx()).round().toPx()), childPosition[1])
- assertEquals(PxPosition(0.px, (gap * 2 + size.toPx() * 2).round().toPx()), childPosition[2])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(PxPosition(0f, (gap + size.toPx()).round().toPx().value), childPosition[1])
+ assertEquals(
+ PxPosition(0f, (gap * 2 + size.toPx() * 2).round().toPx().value),
+ childPosition[2]
+ )
}
@Test
@@ -2653,7 +2726,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px), PxPosition(-1.px, -1.px)
+ PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2685,13 +2758,13 @@
waitForDraw(root)
val gap = (root.height.px - size.toPx() * 3) / 3
- assertEquals(PxPosition(0.px, (gap / 2).round().toPx()), childPosition[0])
+ assertEquals(PxPosition(0f, (gap / 2).round().toPx().value), childPosition[0])
assertEquals(
- PxPosition(0.px, ((gap * 3 / 2) + size.toPx()).round().toPx()),
+ PxPosition(0f, ((gap * 3 / 2) + size.toPx()).round().toPx().value),
childPosition[1]
)
assertEquals(
- PxPosition(0.px, ((gap * 5 / 2) + size.toPx() * 2).round().toPx()),
+ PxPosition(0f, ((gap * 5 / 2) + size.toPx() * 2).round().toPx().value),
childPosition[2]
)
}
@@ -2735,10 +2808,10 @@
waitForDraw(root)
val step = (root.height.px - size.toPx() * 3) / 3
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
- assertEquals(PxPosition(0.px, (step + size.toPx()).round().toPx()), childPosition[1])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(PxPosition(0f, (step + size.toPx()).round().toPx().value), childPosition[1])
assertEquals(
- PxPosition(0.px, (step * 3 + size.toPx() * 2).round().toPx()),
+ PxPosition(0f, (step * 3 + size.toPx() * 2).round().toPx().value),
childPosition[2]
)
}
@@ -3429,7 +3502,7 @@
Row(Modifier.fillMaxWidth().rtl) {
Container(
Modifier.preferredSize(sizeDp).onPositioned { coordinates: LayoutCoordinates ->
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3438,7 +3511,7 @@
Container(
Modifier.preferredSize(sizeDp * 2)
.onPositioned { coordinates: LayoutCoordinates ->
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3451,9 +3524,9 @@
waitForDraw(root)
val rootWidth = root.width.px
- assertEquals(PxPosition(rootWidth - size.toPx(), 0.px), childPosition[0])
+ assertEquals(PxPosition((rootWidth - size.toPx()).value, 0f), childPosition[0])
assertEquals(
- PxPosition(rootWidth - (sizeDp.toPx() * 3).roundToInt().px, 0.px),
+ PxPosition((rootWidth - (sizeDp.toPx() * 3).roundToInt().px).value, 0f),
childPosition[1]
)
}
@@ -3471,7 +3544,7 @@
) {
Container(
Modifier.preferredSize(sizeDp).onPositioned { coordinates: LayoutCoordinates ->
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3480,7 +3553,7 @@
Container(
Modifier.preferredSize(sizeDp * 2)
.onPositioned { coordinates: LayoutCoordinates ->
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3490,8 +3563,14 @@
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- assertEquals(PxPosition((sizeDp.toPx() * 2).roundToInt().px, 0.px), childPosition[0])
- assertEquals(PxPosition(0.px, 0.px), childPosition[1])
+ assertEquals(
+ PxPosition(
+ (sizeDp.toPx() * 2).roundToInt().toFloat(),
+ 0f
+ ),
+ childPosition[0]
+ )
+ assertEquals(PxPosition(0f, 0f), childPosition[1])
}
@Test
@@ -3509,7 +3588,7 @@
width = sizeDp,
height = sizeDp,
modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3519,7 +3598,7 @@
width = (sizeDp * 2),
height = (sizeDp * 2),
modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3531,8 +3610,11 @@
val root = findOwnerView()
waitForDraw(root)
- assertEquals(PxPosition((sizeDp.toPx() * 2).roundToInt().px, 0.px), childPosition[0])
- assertEquals(PxPosition(0.px, 0.px), childPosition[1])
+ assertEquals(
+ PxPosition((sizeDp.toPx() * 2).roundToInt().toFloat(), 0f),
+ childPosition[0]
+ )
+ assertEquals(PxPosition(0f, 0f), childPosition[1])
}
@Test
@@ -3546,7 +3628,7 @@
Column(Modifier.fillMaxWidth().rtl) {
Container(
Modifier.preferredSize(sizeDp).onPositioned { coordinates: LayoutCoordinates ->
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3555,7 +3637,7 @@
Container(
Modifier.preferredSize(sizeDp * 2)
.onPositioned { coordinates: LayoutCoordinates ->
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3568,9 +3650,12 @@
waitForDraw(root)
val rootWidth = root.width.px
- assertEquals(PxPosition(rootWidth - size.toPx(), 0.px), childPosition[0])
+ assertEquals(PxPosition((rootWidth - size.toPx()).value, 0f), childPosition[0])
assertEquals(
- PxPosition((rootWidth.value - (sizeDp * 2).toPx()).roundToInt().px, size.toPx()),
+ PxPosition(
+ (rootWidth.value - (sizeDp * 2).toPx()).roundToInt().toFloat(),
+ size.toPx().value
+ ),
childPosition[1]
)
}
@@ -3588,7 +3673,7 @@
Modifier.preferredSize(sizeDp)
.gravity(Alignment.End)
.onPositioned { coordinates: LayoutCoordinates ->
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3598,7 +3683,7 @@
Modifier.preferredSize(sizeDp * 2)
.gravity(Alignment.End)
.onPositioned { coordinates: LayoutCoordinates ->
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3608,8 +3693,8 @@
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- assertEquals(PxPosition(0.px, 0.px), childPosition[0])
- assertEquals(PxPosition(0.px, size.toPx()), childPosition[1])
+ assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(PxPosition(0f, size.toPx().value), childPosition[1])
}
@Test
@@ -3625,7 +3710,7 @@
Modifier.preferredSize(sizeDp)
.alignWithSiblings { it.width }
.onPositioned { coordinates: LayoutCoordinates ->
- childPosition[0] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3635,7 +3720,7 @@
Modifier.preferredSize(sizeDp)
.alignWithSiblings { it.width / 2 }
.onPositioned { coordinates: LayoutCoordinates ->
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3648,9 +3733,9 @@
waitForDraw(root)
val rootWidth = root.width.px
- assertEquals(PxPosition(rootWidth - size.toPx(), 0.px), childPosition[0])
+ assertEquals(PxPosition((rootWidth - size.toPx()).value, 0f), childPosition[0])
assertEquals(
- PxPosition((rootWidth - size.toPx() * 1.5f).round().toPx(), size.toPx()),
+ PxPosition((rootWidth - size.toPx() * 1.5f).round().toPx().value, size.toPx().value),
childPosition[1]
)
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/StackTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/StackTest.kt
index f526ad5..b938841 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/StackTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/StackTest.kt
@@ -36,7 +36,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
-import androidx.ui.unit.px
import androidx.ui.unit.toPx
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
@@ -92,7 +91,7 @@
assertEquals(IntPxSize(size, size), stackSize.value)
assertEquals(IntPxSize(size, size), alignedChildSize.value)
- assertEquals(PxPosition(0.px, 0.px), alignedChildPosition.value)
+ assertEquals(PxPosition(0f, 0f), alignedChildPosition.value)
assertEquals(IntPxSize(30.dp.toIntPx(), 30.dp.toIntPx()), positionedChildSize.value)
assertEquals(PxPosition(10.dp.toIntPx(), 10.dp.toIntPx()), positionedChildPosition.value)
}
@@ -145,7 +144,7 @@
assertEquals(IntPxSize(size, size), childSize[0].value)
assertEquals(PxPosition(size, size), childPosition[0].value)
assertEquals(IntPxSize(doubleSize, doubleSize), childSize[1].value)
- assertEquals(PxPosition(0.px, 0.px), childPosition[1].value)
+ assertEquals(PxPosition(0f, 0f), childPosition[1].value)
}
@Test
@@ -215,11 +214,11 @@
assertEquals(IntPxSize(size, size), stackSize.value)
assertEquals(IntPxSize(size, size), childSize[0].value)
- assertEquals(PxPosition(0.px, 0.px), childPosition[0].value)
+ assertEquals(PxPosition(0f, 0f), childPosition[0].value)
assertEquals(IntPxSize(size - inset, size - inset), childSize[1].value)
assertEquals(PxPosition(inset, inset), childPosition[1].value)
assertEquals(IntPxSize(size - inset, size - inset), childSize[2].value)
- assertEquals(PxPosition(0.px, 0.px), childPosition[2].value)
+ assertEquals(PxPosition(0f, 0f), childPosition[2].value)
assertEquals(IntPxSize(size - inset * 2, size), childSize[3].value)
assertEquals(PxPosition(inset, 0.ipx), childPosition[3].value)
assertEquals(IntPxSize(size, size - inset * 2), childSize[4].value)
@@ -307,13 +306,19 @@
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
assertEquals(IntPxSize(tripleSize, tripleSize), stackSize.value)
- assertEquals(PxPosition((size * 2).toPx(), 0.px), childPosition[0].value)
+ assertEquals(PxPosition((size * 2).value.toFloat(), 0f), childPosition[0].value)
assertEquals(PxPosition(size, 0.ipx), childPosition[1].value)
assertEquals(PxPosition(0.ipx, 0.ipx), childPosition[2].value)
- assertEquals(PxPosition((size * 2).toPx(), size.toPx()), childPosition[3].value)
+ assertEquals(PxPosition((size * 2).toPx().value, size.toPx().value), childPosition[3].value)
assertEquals(PxPosition(size, size), childPosition[4].value)
assertEquals(PxPosition(0.ipx, size), childPosition[5].value)
- assertEquals(PxPosition((size * 2).toPx(), (size * 2).toPx()), childPosition[6].value)
+ assertEquals(
+ PxPosition(
+ (size * 2).toPx().value,
+ (size * 2).toPx().value
+ ),
+ childPosition[6].value
+ )
assertEquals(PxPosition(size, size * 2), childPosition[7].value)
assertEquals(PxPosition(0.ipx, size * 2), childPosition[8].value)
}
@@ -360,7 +365,7 @@
assertEquals(IntPxSize(size, size), stackSize.value)
assertEquals(IntPxSize(size, size), childSize[0].value)
- assertEquals(PxPosition(0.px, 0.px), childPosition[0].value)
+ assertEquals(PxPosition(0f, 0f), childPosition[0].value)
assertEquals(IntPxSize(halfSize, halfSize), childSize[1].value)
assertEquals(PxPosition(size - halfSize, size - halfSize), childPosition[1].value)
}
diff --git a/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutOffset.kt b/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutOffset.kt
index 6e1288a..11859141 100644
--- a/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutOffset.kt
+++ b/ui/ui-layout/src/main/java/androidx/ui/layout/LayoutOffset.kt
@@ -26,9 +26,9 @@
import androidx.ui.core.MeasureScope
import androidx.ui.core.Modifier
import androidx.ui.unit.Dp
-import androidx.ui.unit.Px
import androidx.ui.unit.dp
-import androidx.ui.unit.round
+import androidx.ui.unit.ipx
+import kotlin.math.roundToInt
/**
* Offset the content by ([x] dp, [y] dp). The offsets can be positive as well as non positive.
@@ -47,8 +47,8 @@
* @sample androidx.ui.layout.samples.LayoutOffsetPxModifier
*/
fun Modifier.offsetPx(
- x: State<Px> = mutableStateOf(Px.Zero),
- y: State<Px> = mutableStateOf(Px.Zero)
+ x: State<Float> = mutableStateOf(0f),
+ y: State<Float> = mutableStateOf(0f)
) = this + OffsetPxModifier(x, y)
private data class OffsetModifier(val x: Dp, val y: Dp) : LayoutModifier {
@@ -64,7 +64,7 @@
}
}
-private data class OffsetPxModifier(val x: State<Px>, val y: State<Px>) : LayoutModifier {
+private data class OffsetPxModifier(val x: State<Float>, val y: State<Float>) : LayoutModifier {
override fun MeasureScope.measure(
measurable: Measurable,
constraints: Constraints,
@@ -72,7 +72,7 @@
): MeasureScope.MeasureResult {
val placeable = measurable.measure(constraints)
return layout(placeable.width, placeable.height) {
- placeable.place(x.value.round(), y.value.round())
+ placeable.place(x.value.roundToInt().ipx, y.value.roundToInt().ipx)
}
}
}
diff --git a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ColorPickerDemo.kt b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ColorPickerDemo.kt
index c836622..23d1bfd 100644
--- a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ColorPickerDemo.kt
+++ b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ColorPickerDemo.kt
@@ -341,8 +341,8 @@
* or the color is partially transparent.
*/
private fun ColorWheel.colorForPosition(position: PxPosition): Color {
- val x = position.x.value.toInt().coerceAtLeast(0)
- val y = position.y.value.toInt().coerceAtLeast(0)
+ val x = position.x.toInt().coerceAtLeast(0)
+ val y = position.y.toInt().coerceAtLeast(0)
with(image.toPixelMap()) {
if (x >= width || y >= height) return Color.Unset
return this[x, y].takeIf { it.alpha == 1f } ?: Color.Unset
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt
index e5c5c54..f60edec 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt
@@ -105,37 +105,37 @@
}
composeTestRule.runOnIdleComposeWithDensity {
- val appBarBottomEdgeY = appBarCoords!!.globalPosition.y.value +
+ val appBarBottomEdgeY = appBarCoords!!.globalPosition.y +
appBarCoords!!.size.height.value
// Navigation icon should be 4.dp from the start
val navigationIconPositionX = navigationIconCoords!!.globalPosition.x
- val navigationIconExpectedPositionX = AppBarStartAndEndPadding.toIntPx().toPx()
+ val navigationIconExpectedPositionX = AppBarStartAndEndPadding.toIntPx().toPx().value
assertThat(navigationIconPositionX).isEqualTo(navigationIconExpectedPositionX)
// Navigation icon should be 4.dp from the bottom
val navigationIconPositionY = navigationIconCoords!!.globalPosition.y
val navigationIconExpectedPositionY = (appBarBottomEdgeY -
AppBarStartAndEndPadding.toPx() - FakeIconSize.toPx()
- ).roundToInt().px
+ ).roundToInt().toFloat()
assertThat(navigationIconPositionY).isEqualTo(navigationIconExpectedPositionY)
// Title should be 72.dp from the start
val titlePositionX = titleCoords!!.globalPosition.x
// 4.dp padding for the whole app bar + 68.dp inset
- val titleExpectedPositionX = (4.dp.toIntPx() + 68.dp.toIntPx()).toPx()
+ val titleExpectedPositionX = (4.dp.toIntPx() + 68.dp.toIntPx()).value.toFloat()
assertThat(titlePositionX).isEqualTo(titleExpectedPositionX)
// Absolute position of the baseline
val titleLastBaselinePositionY = titleLastBaselineRelativePosition!! +
- titleCoords!!.globalPosition.y.value
+ titleCoords!!.globalPosition.y
// Baseline should be 20.sp from the bottom of the app bar
val titleExpectedLastBaselinePositionY = (appBarBottomEdgeY.px - 20.sp.toIntPx()
.toPx()).value
assertThat(titleLastBaselinePositionY).isEqualTo(titleExpectedLastBaselinePositionY)
// Action should be placed at the end
- val actionPositionX = actionCoords!!.globalPosition.x.value
+ val actionPositionX = actionCoords!!.globalPosition.x
val actionExpectedPositionX =
expectedActionPosition(appBarCoords!!.size.width.toPx().value)
assertThat(actionPositionX).isEqualTo(actionExpectedPositionX)
@@ -144,7 +144,7 @@
val actionPositionY = actionCoords!!.globalPosition.y
val actionExpectedPositionY = (appBarBottomEdgeY - AppBarStartAndEndPadding.toPx() -
FakeIconSize.toPx()
- ).roundToInt().px
+ ).roundToInt()
assertThat(actionPositionY).isEqualTo(actionExpectedPositionY)
}
}
@@ -172,11 +172,11 @@
// Title should now be placed 16.dp from the start, as there is no navigation icon
val titlePositionX = titleCoords!!.globalPosition.x
// 4.dp padding for the whole app bar + 12.dp inset
- val titleExpectedPositionX = (4.dp.toIntPx() + 12.dp.toIntPx()).toPx()
+ val titleExpectedPositionX = (4.dp.toIntPx() + 12.dp.toIntPx()).toPx().value
assertThat(titlePositionX).isEqualTo(titleExpectedPositionX)
// Action should still be placed at the end
- val actionPositionX = actionCoords!!.globalPosition.x.value
+ val actionPositionX = actionCoords!!.globalPosition.x
val actionExpectedPositionX =
expectedActionPosition(appBarCoords!!.size.width.toPx().value)
assertThat(actionPositionX).isEqualTo(actionExpectedPositionX)
@@ -228,17 +228,17 @@
composeTestRule.runOnIdleComposeWithDensity {
// Child icon should be 4.dp from the start
val childIconPositionX = childCoords!!.globalPosition.x
- val childIconExpectedPositionX = AppBarStartAndEndPadding.toIntPx().toPx()
+ val childIconExpectedPositionX = AppBarStartAndEndPadding.toIntPx().toPx().value
assertThat(childIconPositionX).isEqualTo(childIconExpectedPositionX)
- val appBarBottomEdgeY = appBarCoords!!.globalPosition.y.value +
+ val appBarBottomEdgeY = appBarCoords!!.globalPosition.y +
appBarCoords!!.size.height.value
// Child icon should be 4.dp from the bottom
val childIconPositionY = childCoords!!.globalPosition.y
val childIconExpectedPositionY = (appBarBottomEdgeY - AppBarStartAndEndPadding.toPx() -
FakeIconSize.toPx()
- ).roundToInt().px
+ ).roundToInt().toFloat()
assertThat(childIconPositionY).isEqualTo(childIconExpectedPositionY)
}
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/BottomNavigationTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/BottomNavigationTest.kt
index fede650..4da8b00 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/BottomNavigationTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/BottomNavigationTest.kt
@@ -105,7 +105,7 @@
Truth.assertThat(coord.size.width).isEqualTo(expectedItemWidth)
Truth.assertThat(coord.size.height).isEqualTo(expectedItemHeight)
Truth.assertThat(coord.globalPosition.x)
- .isEqualTo((expectedItemWidth * index).toPx())
+ .isEqualTo((expectedItemWidth * index).value.toFloat())
}
}
}
@@ -142,14 +142,15 @@
composeTestRule.runOnIdleComposeWithDensity {
// Distance from the bottom to the text baseline and from the text baseline to the
// bottom of the icon
- val textBaseline = 12.dp.toIntPx().toPx()
+ val textBaseline = 12.dp.toIntPx().value.toFloat()
// Relative position of the baseline to the top of text
- val relativeTextBaseline = textCoords[LastBaseline]!!.toPx()
+ val relativeTextBaseline = textCoords[LastBaseline]!!.toPx().value
// Absolute y position of the text baseline
val absoluteTextBaseline = textCoords.globalPosition.y + relativeTextBaseline
- val itemBottom = itemCoords.size.height.toPx() + itemCoords.globalPosition.y
+ val itemBottom = itemCoords.size.height.toPx().value +
+ itemCoords.globalPosition.y
// Text baseline should be 12.dp from the bottom of the item
Truth.assertThat(absoluteTextBaseline).isEqualTo(itemBottom - textBaseline)
@@ -157,9 +158,10 @@
val iconExpectedX = (itemCoords.size.width.toPx() - iconCoords.size.width.toPx()) / 2
// The bottom of the icon is 12.dp above the text baseline
val iconExpectedY =
- absoluteTextBaseline - 12.dp.toIntPx().toPx() - iconCoords.size.height
+ absoluteTextBaseline - 12.dp.toIntPx().value.toFloat() -
+ iconCoords.size.height.value
- Truth.assertThat(iconCoords.globalPosition.x.value).isWithin(1f).of(iconExpectedX.value)
+ Truth.assertThat(iconCoords.globalPosition.x).isWithin(1f).of(iconExpectedX.value)
Truth.assertThat(iconCoords.globalPosition.y).isEqualTo(iconExpectedY)
}
}
@@ -206,8 +208,8 @@
val iconExpectedX = (itemCoords.size.width.toPx() - iconCoords.size.width.toPx()) / 2
val iconExpectedY = (itemCoords.size.height - iconCoords.size.height) / 2
- Truth.assertThat(iconCoords.globalPosition.x.value).isWithin(1f).of(iconExpectedX.value)
- Truth.assertThat(iconCoords.globalPosition.y).isEqualTo(iconExpectedY.toPx())
+ Truth.assertThat(iconCoords.globalPosition.x).isWithin(1f).of(iconExpectedX.value)
+ Truth.assertThat(iconCoords.globalPosition.y).isEqualTo(iconExpectedY.toPx().value)
}
}
@@ -240,8 +242,8 @@
val iconExpectedX = (itemCoords.size.width.toPx() - iconCoords.size.width.toPx()) / 2
val iconExpectedY = (itemCoords.size.height - iconCoords.size.height) / 2
- Truth.assertThat(iconCoords.globalPosition.x.value).isWithin(1f).of(iconExpectedX.value)
- Truth.assertThat(iconCoords.globalPosition.y).isEqualTo(iconExpectedY.toPx())
+ Truth.assertThat(iconCoords.globalPosition.x).isWithin(1f).of(iconExpectedX.value)
+ Truth.assertThat(iconCoords.globalPosition.y).isEqualTo(iconExpectedY.toPx().value)
}
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
index ac60d2b..5514a48 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
@@ -553,7 +553,7 @@
val topLeft = childCoordinates!!.localToGlobal(PxPosition.Origin).x -
parentCoordinates!!.localToGlobal(PxPosition.Origin).x
val currentPadding = with(composeTestRule.density) {
- padding.toIntPx().toPx()
+ padding.toIntPx().value.toFloat()
}
assertThat(currentPadding).isEqualTo(topLeft)
}
@@ -561,8 +561,8 @@
}
fun assertWithinOnePixel(expected: PxPosition, actual: PxPosition) {
- assertWithinOnePixel(expected.x.value, actual.x.value)
- assertWithinOnePixel(expected.y.value, actual.y.value)
+ assertWithinOnePixel(expected.x, actual.x)
+ assertWithinOnePixel(expected.y, actual.y)
}
fun assertWithinOnePixel(expected: Float, actual: Float) {
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt
index ed3afdc..8c75f3f 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt
@@ -70,7 +70,7 @@
}, bodyContent = emptyContent())
}
runOnIdleCompose {
- assertThat(position!!.x.value).isEqualTo(0f)
+ assertThat(position!!.x).isEqualTo(0f)
}
}
@@ -86,7 +86,7 @@
}
val width = composeTestRule.displayMetrics.widthPixels
runOnIdleCompose {
- assertThat(position!!.x.round().value).isEqualTo(-width)
+ assertThat(position!!.x.px.round().value).isEqualTo(-width)
}
}
@@ -124,7 +124,7 @@
// temporary calculation of landscape screen
val expectedHeight = if (width > height) 0 else (height / 2f).roundToInt()
runOnIdleCompose {
- assertThat(position!!.y.round().value).isEqualTo(expectedHeight)
+ assertThat(position!!.y.px.round().value).isEqualTo(expectedHeight)
}
}
@@ -140,7 +140,7 @@
}
val height = composeTestRule.displayMetrics.heightPixels
runOnIdleCompose {
- assertThat(position!!.y.round().value).isEqualTo(height)
+ assertThat(position!!.y.px.round().value).isEqualTo(height)
}
}
@@ -157,10 +157,10 @@
Box(
Modifier.fillMaxSize().onPositioned { info: LayoutCoordinates ->
val pos = info.localToGlobal(PxPosition.Origin)
- if (pos.x == 0.px) {
+ if (pos.x == 0.0f) {
// If fully opened, mark the openedLatch if present
openedLatch?.countDown()
- } else if (-pos.x.round() == contentWidth) {
+ } else if (-pos.x.px.round() == contentWidth) {
// If fully closed, mark the closedLatch if present
closedLatch?.countDown()
}
@@ -227,8 +227,8 @@
// Click on the left-center pixel of the drawer
findByTag("Drawer").doGesture {
- val left = 1.px
- val centerY = globalBounds.height / 2
+ val left = 1.0f
+ val centerY = (globalBounds.height / 2).value
sendClick(PxPosition(left, centerY))
}
@@ -251,10 +251,10 @@
drawerContent = {
Box(Modifier.fillMaxSize().onPositioned { info: LayoutCoordinates ->
val pos = info.localToGlobal(PxPosition.Origin)
- if (pos.y.round() == openedHeight) {
+ if (pos.y.px.round() == openedHeight) {
// If fully opened, mark the openedLatch if present
openedLatch?.countDown()
- } else if (pos.y.round() == contentHeight) {
+ } else if (pos.y.px.round() == contentHeight) {
// If fully closed, mark the closedLatch if present
closedLatch?.countDown()
}
@@ -326,8 +326,8 @@
// Click on the bottom-center pixel of the drawer
findByTag("Drawer").doGesture {
val bounds = globalBounds
- val centerX = bounds.width / 2
- val bottom = bounds.height - 1.px
+ val centerX = (bounds.width / 2).value
+ val bottom = (bounds.height - 1.px).value
sendClick(PxPosition(centerX, bottom))
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/FilledTextFieldTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/FilledTextFieldTest.kt
index d95ef48..6955ac6 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/FilledTextFieldTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/FilledTextFieldTest.kt
@@ -60,6 +60,7 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
+import androidx.ui.unit.px
import androidx.ui.unit.sp
import androidx.ui.unit.toPx
import com.google.common.truth.Truth.assertThat
@@ -200,10 +201,11 @@
assertThat(labelSize.value?.width).isGreaterThan(0.ipx)
// centered position
assertThat(labelPosition.value?.x).isEqualTo(
- ExpectedPadding.toIntPx().toPx()
+ ExpectedPadding.toIntPx().value.toFloat()
)
assertThat(labelPosition.value?.y).isEqualTo(
- ((ExpectedMinimumTextFieldHeight.toIntPx() - labelSize.value!!.height) / 2f).toPx()
+ ((ExpectedMinimumTextFieldHeight.toIntPx() - labelSize.value!!.height) / 2f)
+ .value.toFloat()
)
}
}
@@ -236,10 +238,10 @@
assertThat(labelSize.value?.width).isGreaterThan(0.ipx)
// centered position
assertThat(labelPosition.value?.x).isEqualTo(
- ExpectedPadding.toIntPx().toPx()
+ ExpectedPadding.toIntPx().toPx().value
)
assertThat(labelPosition.value?.y).isEqualTo(
- ((height.toIntPx() - labelSize.value!!.height) / 2f).toPx()
+ ((height.toIntPx() - labelSize.value!!.height) / 2f).toPx().value
)
}
}
@@ -248,7 +250,7 @@
fun testLabelPosition_whenFocused() {
val labelSize = Ref<IntPxSize>()
val labelPosition = Ref<PxPosition>()
- val baseline = Ref<Px>()
+ val baseline = Ref<Float>()
testRule.setMaterialContent {
Box {
FilledTextField(
@@ -260,7 +262,7 @@
labelPosition.value = it.globalPosition
labelSize.value = it.size
baseline.value =
- it[FirstBaseline]!!.toPx() + labelPosition.value!!.y
+ (it[FirstBaseline]!!.toPx() + labelPosition.value!!.y.px).value
})
}
)
@@ -277,10 +279,10 @@
assertThat(labelSize.value?.width).isGreaterThan(0.ipx)
// label's top position
assertThat(labelPosition.value?.x).isEqualTo(
- ExpectedPadding.toIntPx().toPx()
+ ExpectedPadding.toIntPx().toPx().value
)
assertThat(baseline.value).isEqualTo(
- ExpectedBaselineOffset.toIntPx().toPx()
+ ExpectedBaselineOffset.toIntPx().toPx().value
)
}
}
@@ -289,7 +291,7 @@
fun testLabelPosition_whenInput() {
val labelSize = Ref<IntPxSize>()
val labelPosition = Ref<PxPosition>()
- val baseline = Ref<Px>()
+ val baseline = Ref<Float>()
testRule.setMaterialContent {
Box {
FilledTextField(
@@ -300,7 +302,7 @@
labelPosition.value = it.globalPosition
labelSize.value = it.size
baseline.value =
- it[FirstBaseline]!!.toPx() + labelPosition.value!!.y
+ (it[FirstBaseline]!!.toPx() + labelPosition.value!!.y.px).value
})
}
)
@@ -314,10 +316,10 @@
assertThat(labelSize.value?.width).isGreaterThan(0.ipx)
// label's top position
assertThat(labelPosition.value?.x).isEqualTo(
- ExpectedPadding.toIntPx().toPx()
+ ExpectedPadding.toIntPx().toPx().value
)
assertThat(baseline.value).isEqualTo(
- ExpectedBaselineOffset.toIntPx().toPx()
+ ExpectedBaselineOffset.toIntPx().toPx().value
)
}
}
@@ -326,7 +328,7 @@
fun testPlaceholderPosition_withLabel() {
val placeholderSize = Ref<IntPxSize>()
val placeholderPosition = Ref<PxPosition>()
- val placeholderBaseline = Ref<Px>()
+ val placeholderBaseline = Ref<Float>()
testRule.setMaterialContent {
Box {
FilledTextField(
@@ -339,7 +341,8 @@
placeholderPosition.value = it.globalPosition
placeholderSize.value = it.size
placeholderBaseline.value =
- it[FirstBaseline]!!.toPx() + placeholderPosition.value!!.y
+ (it[FirstBaseline]!!.toPx() + placeholderPosition.value!!.y
+ .px).value
})
}
)
@@ -355,10 +358,10 @@
assertThat(placeholderSize.value?.width).isGreaterThan(0.ipx)
// placeholder's position
assertThat(placeholderPosition.value?.x).isEqualTo(
- ExpectedPadding.toIntPx().toPx()
+ ExpectedPadding.toIntPx().toPx().value
)
assertThat(placeholderBaseline.value).isEqualTo(
- ExpectedBaselineOffset.toIntPx().toPx() * 2
+ (ExpectedBaselineOffset.toIntPx().toPx() * 2).value
)
}
}
@@ -381,7 +384,7 @@
placeholderPosition.value = it.globalPosition
placeholderSize.value = it.size
placeholderBaseline.value =
- it[FirstBaseline]!!.toPx() + placeholderPosition.value!!.y
+ it[FirstBaseline]!!.toPx() + placeholderPosition.value!!.y.px
})
}
)
@@ -397,10 +400,10 @@
assertThat(placeholderSize.value?.width).isGreaterThan(0.ipx)
// centered position
assertThat(placeholderPosition.value?.x).isEqualTo(
- ExpectedPadding.toIntPx().toPx()
+ ExpectedPadding.toIntPx().toPx().value
)
assertThat(placeholderPosition.value?.y).isEqualTo(
- ((height.toIntPx() - placeholderSize.value!!.height) / 2f).toPx()
+ ((height.toIntPx() - placeholderSize.value!!.height) / 2f).toPx().value
)
}
}
@@ -490,18 +493,18 @@
testRule.runOnIdleComposeWithDensity {
// leading
assertThat(leadingSize.value).isEqualTo(IntPxSize(size.toIntPx(), size.toIntPx()))
- assertThat(leadingPosition.value?.x).isEqualTo(IconPadding.toIntPx().toPx())
+ assertThat(leadingPosition.value?.x).isEqualTo(IconPadding.toIntPx().toPx().value)
assertThat(leadingPosition.value?.y).isEqualTo(
- ((textFieldHeight.toIntPx() - leadingSize.value!!.height) / 2f).toPx()
+ ((textFieldHeight.toIntPx() - leadingSize.value!!.height) / 2f).toPx().value
)
// trailing
assertThat(trailingSize.value).isEqualTo(IntPxSize(size.toIntPx(), size.toIntPx()))
assertThat(trailingPosition.value?.x).isEqualTo(
(textFieldWidth.toIntPx() - IconPadding.toIntPx() - trailingSize.value!!.width)
- .toPx()
+ .toPx().value
)
assertThat(trailingPosition.value?.y).isEqualTo(
- ((textFieldHeight.toIntPx() - trailingSize.value!!.height) / 2f).toPx()
+ ((textFieldHeight.toIntPx() - trailingSize.value!!.height) / 2f).toPx().value
)
}
}
@@ -530,7 +533,8 @@
testRule.runOnIdleComposeWithDensity {
assertThat(labelPosition.value?.x).isEqualTo(
- (ExpectedPadding.toIntPx() + IconPadding.toIntPx() + iconSize.toIntPx()).toPx()
+ (ExpectedPadding.toIntPx() + IconPadding.toIntPx() + iconSize.toIntPx())
+ .toPx().value
)
}
}
@@ -558,7 +562,7 @@
testRule.runOnIdleComposeWithDensity {
assertThat(labelPosition.value?.x).isEqualTo(
- ExpectedPadding.toIntPx().toPx()
+ ExpectedPadding.toIntPx().toPx().value
)
}
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonTest.kt
index 59c481b..68495e1 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonTest.kt
@@ -45,6 +45,7 @@
import androidx.ui.unit.center
import androidx.ui.unit.dp
import androidx.ui.unit.height
+import androidx.ui.unit.px
import androidx.ui.unit.round
import androidx.ui.unit.toPx
import androidx.ui.unit.width
@@ -296,12 +297,12 @@
assertThat(iconBounds.width).isEqualTo(10.dp.toIntPx().toPx())
assertThat(iconBounds.height).isEqualTo(10.dp.toIntPx().toPx())
- assertWithinOnePixel(buttonBounds.center().y.value, iconBounds.center().y.value)
- assertWithinOnePixel(buttonBounds.center().y.value, textBounds.center().y.value)
+ assertWithinOnePixel(buttonBounds.center().y, iconBounds.center().y)
+ assertWithinOnePixel(buttonBounds.center().y, textBounds.center().y)
val halfPadding = 6.dp.toIntPx().toPx()
assertWithinOnePixel(
- (iconBounds.center().x + iconBounds.width / 2 + halfPadding).value,
- (textBounds.center().x - textBounds.width / 2 - halfPadding).value
+ (iconBounds.center().x.px + iconBounds.width / 2 + halfPadding).value,
+ (textBounds.center().x.px - textBounds.width / 2 - halfPadding).value
)
}
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/IconButtonTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/IconButtonTest.kt
index 3722f51..dd359ac 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/IconButtonTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/IconButtonTest.kt
@@ -79,8 +79,8 @@
val iconX = iconCoords.positionInParent.x
val iconY = iconCoords.positionInParent.y
// Icon should be centered inside the IconButton
- Truth.assertThat(iconX).isEqualTo(12.dp.toIntPx().toPx())
- Truth.assertThat(iconY).isEqualTo(12.dp.toIntPx().toPx())
+ Truth.assertThat(iconX).isEqualTo(12.dp.toIntPx().toPx().value)
+ Truth.assertThat(iconY).isEqualTo(12.dp.toIntPx().toPx().value)
}
}
@@ -104,8 +104,8 @@
val iconX = iconCoords.positionInParent.x
val iconY = iconCoords.positionInParent.y
- val expectedX = ((48.dp - width) / 2).toIntPx().toPx()
- val expectedY = ((48.dp - height) / 2).toIntPx().toPx()
+ val expectedX = ((48.dp - width) / 2).toIntPx().toPx().value
+ val expectedY = ((48.dp - height) / 2).toIntPx().toPx().value
// Icon should be centered inside the IconButton
Truth.assertThat(iconX).isEqualTo(expectedX)
Truth.assertThat(iconY).isEqualTo(expectedY)
@@ -143,8 +143,8 @@
val iconX = iconCoords.positionInParent.x
val iconY = iconCoords.positionInParent.y
// Icon should be centered inside the IconButton
- Truth.assertThat(iconX).isEqualTo(12.dp.toIntPx().toPx())
- Truth.assertThat(iconY).isEqualTo(12.dp.toIntPx().toPx())
+ Truth.assertThat(iconX).isEqualTo(12.dp.toIntPx().toPx().value)
+ Truth.assertThat(iconY).isEqualTo(12.dp.toIntPx().toPx().value)
}
}
@@ -167,8 +167,8 @@
val iconX = iconCoords.positionInParent.x
val iconY = iconCoords.positionInParent.y
- val expectedX = ((48.dp - width) / 2).toIntPx().toPx()
- val expectedY = ((48.dp - height) / 2).toIntPx().toPx()
+ val expectedX = ((48.dp - width) / 2).toIntPx().toPx().value
+ val expectedY = ((48.dp - height) / 2).toIntPx().toPx().value
// Icon should be centered inside the IconButton
Truth.assertThat(iconX).isEqualTo(expectedX)
Truth.assertThat(iconY).isEqualTo(expectedY)
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt
index 456dd83..0db9b50 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt
@@ -29,12 +29,9 @@
import androidx.ui.test.createComposeRule
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.Px
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
-import androidx.ui.unit.px
-import androidx.ui.unit.toPx
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -205,17 +202,18 @@
}
}
composeTestRule.runOnIdleComposeWithDensity {
- assertThat(textPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().toPx())
+ assertThat(textPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().value
+ .toFloat())
assertThat(textPosition.value!!.y).isEqualTo(
- ((listItemHeight.toIntPx() - textSize.value!!.height) / 2).toPx()
+ ((listItemHeight.toIntPx() - textSize.value!!.height) / 2).value.toFloat()
)
val dm = composeTestRule.displayMetrics
assertThat(trailingPosition.value!!.x).isEqualTo(
- dm.widthPixels.px - trailingSize.value!!.width -
- expectedRightPadding.toIntPx().toPx()
+ dm.widthPixels - trailingSize.value!!.width.value.toFloat() -
+ expectedRightPadding.toIntPx().value.toFloat()
)
assertThat(trailingPosition.value!!.y).isEqualTo(
- ((listItemHeight.toIntPx() - trailingSize.value!!.height) / 2).toPx()
+ ((listItemHeight.toIntPx() - trailingSize.value!!.height) / 2).value.toFloat()
)
}
}
@@ -239,16 +237,18 @@
}
}
composeTestRule.runOnIdleComposeWithDensity {
- assertThat(iconPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().toPx())
+ assertThat(iconPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx()
+ .value.toFloat())
assertThat(iconPosition.value!!.y).isEqualTo(
- ((listItemHeight.toIntPx() - iconSize.value!!.height) / 2).toPx()
+ ((listItemHeight.toIntPx() - iconSize.value!!.height) / 2).value.toFloat()
)
assertThat(textPosition.value!!.x).isEqualTo(
- expectedLeftPadding.toIntPx().toPx() + iconSize.value!!.width +
- expectedTextLeftPadding.toIntPx().toPx()
+ expectedLeftPadding.toIntPx().value.toFloat() +
+ iconSize.value!!.width.value.toFloat() +
+ expectedTextLeftPadding.toIntPx().value.toFloat()
)
assertThat(textPosition.value!!.y).isEqualTo(
- ((listItemHeight.toIntPx() - textSize.value!!.height) / 2).toPx()
+ ((listItemHeight.toIntPx() - textSize.value!!.height) / 2).value.toFloat()
)
}
}
@@ -261,13 +261,13 @@
val expectedSecondaryTextBaselineOffset = 20.dp
val textPosition = Ref<PxPosition>()
- val textBaseline = Ref<Px>()
+ val textBaseline = Ref<Float>()
val textSize = Ref<IntPxSize>()
val secondaryTextPosition = Ref<PxPosition>()
- val secondaryTextBaseline = Ref<Px>()
+ val secondaryTextBaseline = Ref<Float>()
val secondaryTextSize = Ref<IntPxSize>()
val trailingPosition = Ref<PxPosition>()
- val trailingBaseline = Ref<Px>()
+ val trailingBaseline = Ref<Float>()
val trailingSize = Ref<IntPxSize>()
composeTestRule.setMaterialContent {
Box {
@@ -292,22 +292,24 @@
}
}
composeTestRule.runOnIdleComposeWithDensity {
- assertThat(textPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().toPx())
- assertThat(textBaseline.value!!).isEqualTo(expectedTextBaseline.toIntPx().toPx())
+ assertThat(textPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().value
+ .toFloat())
+ assertThat(textBaseline.value!!).isEqualTo(expectedTextBaseline.toIntPx().value
+ .toFloat())
assertThat(secondaryTextPosition.value!!.x).isEqualTo(
- expectedLeftPadding.toIntPx().toPx()
+ expectedLeftPadding.toIntPx().value.toFloat()
)
assertThat(secondaryTextBaseline.value!!).isEqualTo(
- expectedTextBaseline.toIntPx().toPx() +
- expectedSecondaryTextBaselineOffset.toIntPx().toPx()
+ expectedTextBaseline.toIntPx().value.toFloat() +
+ expectedSecondaryTextBaselineOffset.toIntPx().value.toFloat()
)
val dm = composeTestRule.displayMetrics
assertThat(trailingPosition.value!!.x).isEqualTo(
- dm.widthPixels.px - trailingSize.value!!.width -
- expectedRightPadding.toIntPx().toPx()
+ dm.widthPixels - trailingSize.value!!.width.value.toFloat() -
+ expectedRightPadding.toIntPx().value.toFloat()
)
assertThat(trailingBaseline.value!!).isEqualTo(
- expectedTextBaseline.toIntPx().toPx()
+ expectedTextBaseline.toIntPx().value.toFloat()
)
}
}
@@ -321,10 +323,10 @@
val expectedSecondaryTextBaselineOffset = 20.dp
val textPosition = Ref<PxPosition>()
- val textBaseline = Ref<Px>()
+ val textBaseline = Ref<Float>()
val textSize = Ref<IntPxSize>()
val secondaryTextPosition = Ref<PxPosition>()
- val secondaryTextBaseline = Ref<Px>()
+ val secondaryTextBaseline = Ref<Float>()
val secondaryTextSize = Ref<IntPxSize>()
val iconPosition = Ref<PxPosition>()
val iconSize = Ref<IntPxSize>()
@@ -352,21 +354,26 @@
}
composeTestRule.runOnIdleComposeWithDensity {
assertThat(textPosition.value!!.x).isEqualTo(
- expectedLeftPadding.toIntPx().toPx() + iconSize.value!!.width +
- expectedContentLeftPadding.toIntPx().toPx()
+ expectedLeftPadding.toIntPx().value.toFloat() +
+ iconSize.value!!.width.value.toFloat() +
+ expectedContentLeftPadding.toIntPx().value.toFloat()
)
- assertThat(textBaseline.value!!).isEqualTo(expectedTextBaseline.toIntPx().toPx())
+ assertThat(textBaseline.value!!).isEqualTo(expectedTextBaseline.toIntPx().value
+ .toFloat())
assertThat(secondaryTextPosition.value!!.x).isEqualTo(
- expectedLeftPadding.toIntPx().toPx() + iconSize.value!!.width +
- expectedContentLeftPadding.toIntPx().toPx()
+ expectedLeftPadding.toIntPx().value.toFloat() +
+ iconSize.value!!.width.value.toFloat() +
+ expectedContentLeftPadding.toIntPx().value.toFloat()
)
assertThat(secondaryTextBaseline.value!!).isEqualTo(
- expectedTextBaseline.toIntPx().toPx() +
- expectedSecondaryTextBaselineOffset.toIntPx().toPx()
+ expectedTextBaseline.toIntPx().value.toFloat() +
+ expectedSecondaryTextBaselineOffset.toIntPx().value.toFloat()
)
- assertThat(iconPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().toPx())
+ assertThat(iconPosition.value!!.x).isEqualTo(
+ expectedLeftPadding.toIntPx().value.toFloat()
+ )
assertThat(iconPosition.value!!.y).isEqualTo(
- expectedIconTopPadding.toIntPx().toPx()
+ expectedIconTopPadding.toIntPx().value.toFloat()
)
}
}
@@ -382,10 +389,10 @@
val expectedRightPadding = 16.dp
val textPosition = Ref<PxPosition>()
- val textBaseline = Ref<Px>()
+ val textBaseline = Ref<Float>()
val textSize = Ref<IntPxSize>()
val secondaryTextPosition = Ref<PxPosition>()
- val secondaryTextBaseline = Ref<Px>()
+ val secondaryTextBaseline = Ref<Float>()
val secondaryTextSize = Ref<IntPxSize>()
val iconPosition = Ref<PxPosition>()
val iconSize = Ref<IntPxSize>()
@@ -418,29 +425,33 @@
}
composeTestRule.runOnIdleComposeWithDensity {
assertThat(textPosition.value!!.x).isEqualTo(
- expectedLeftPadding.toIntPx().toPx() + iconSize.value!!.width +
- expectedContentLeftPadding.toIntPx().toPx()
+ expectedLeftPadding.toIntPx().value.toFloat() +
+ iconSize.value!!.width.value.toFloat() +
+ expectedContentLeftPadding.toIntPx().value.toFloat()
)
- assertThat(textBaseline.value!!).isEqualTo(expectedTextBaseline.toIntPx().toPx())
+ assertThat(textBaseline.value!!).isEqualTo(expectedTextBaseline.toIntPx().value
+ .toFloat())
assertThat(secondaryTextPosition.value!!.x).isEqualTo(
- expectedLeftPadding.toIntPx().toPx() + iconSize.value!!.width +
- expectedContentLeftPadding.toIntPx().toPx()
+ expectedLeftPadding.toIntPx().value.toFloat() +
+ iconSize.value!!.width.value.toFloat() +
+ expectedContentLeftPadding.toIntPx().value.toFloat()
)
assertThat(secondaryTextBaseline.value!!).isEqualTo(
- expectedTextBaseline.toIntPx().toPx() +
- expectedSecondaryTextBaselineOffset.toIntPx().toPx()
+ expectedTextBaseline.toIntPx().value.toFloat() +
+ expectedSecondaryTextBaselineOffset.toIntPx().value.toFloat()
)
- assertThat(iconPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().toPx())
+ assertThat(iconPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().value
+ .toFloat())
assertThat(iconPosition.value!!.y).isEqualTo(
- expectedIconTopPadding.toIntPx().toPx()
+ expectedIconTopPadding.toIntPx().value.toFloat()
)
val dm = composeTestRule.displayMetrics
assertThat(trailingPosition.value!!.x).isEqualTo(
- dm.widthPixels.px - trailingSize.value!!.width -
- expectedRightPadding.toIntPx().toPx()
+ dm.widthPixels - trailingSize.value!!.width.value.toFloat() -
+ expectedRightPadding.toIntPx().value.toFloat()
)
assertThat(trailingPosition.value!!.y).isEqualTo(
- ((listItemHeight.toIntPx() - trailingSize.value!!.height) / 2).toPx()
+ ((listItemHeight.toIntPx() - trailingSize.value!!.height) / 2).value.toFloat()
)
}
}
@@ -455,10 +466,10 @@
val expectedRightPadding = 16.dp
val textPosition = Ref<PxPosition>()
- val textBaseline = Ref<Px>()
+ val textBaseline = Ref<Float>()
val textSize = Ref<IntPxSize>()
val secondaryTextPosition = Ref<PxPosition>()
- val secondaryTextBaseline = Ref<Px>()
+ val secondaryTextBaseline = Ref<Float>()
val secondaryTextSize = Ref<IntPxSize>()
val iconPosition = Ref<PxPosition>()
val iconSize = Ref<IntPxSize>()
@@ -492,29 +503,33 @@
}
composeTestRule.runOnIdleComposeWithDensity {
assertThat(textPosition.value!!.x).isEqualTo(
- expectedLeftPadding.toIntPx().toPx() + iconSize.value!!.width +
- expectedContentLeftPadding.toIntPx().toPx()
+ expectedLeftPadding.toIntPx().value.toFloat() +
+ iconSize.value!!.width.value.toFloat() +
+ expectedContentLeftPadding.toIntPx().value.toFloat()
)
- assertThat(textBaseline.value!!).isEqualTo(expectedTextBaseline.toIntPx().toPx())
+ assertThat(textBaseline.value!!).isEqualTo(expectedTextBaseline.toIntPx().value
+ .toFloat())
assertThat(secondaryTextPosition.value!!.x).isEqualTo(
- expectedLeftPadding.toIntPx().toPx() + iconSize.value!!.width +
- expectedContentLeftPadding.toIntPx().toPx()
+ expectedLeftPadding.toIntPx().value.toFloat() +
+ iconSize.value!!.width.value.toFloat() +
+ expectedContentLeftPadding.toIntPx().value.toFloat()
)
assertThat(secondaryTextBaseline.value!!).isEqualTo(
- expectedTextBaseline.toIntPx().toPx() +
- expectedSecondaryTextBaselineOffset.toIntPx().toPx()
+ expectedTextBaseline.toIntPx().value.toFloat() +
+ expectedSecondaryTextBaselineOffset.toIntPx().value.toFloat()
)
- assertThat(iconPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().toPx())
+ assertThat(iconPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().value
+ .toFloat())
assertThat(iconPosition.value!!.y).isEqualTo(
- expectedIconTopPadding.toIntPx().toPx()
+ expectedIconTopPadding.toIntPx().value.toFloat()
)
val dm = composeTestRule.displayMetrics
assertThat(trailingPosition.value!!.x).isEqualTo(
- dm.widthPixels.px - trailingSize.value!!.width -
- expectedRightPadding.toIntPx().toPx()
+ dm.widthPixels - trailingSize.value!!.width.value.toFloat() -
+ expectedRightPadding.toIntPx().value.toFloat()
)
assertThat(trailingPosition.value!!.y).isEqualTo(
- expectedIconTopPadding.toIntPx().toPx()
+ expectedIconTopPadding.toIntPx().value.toFloat()
)
}
}
@@ -530,19 +545,19 @@
val expectedRightPadding = 16.dp
val textPosition = Ref<PxPosition>()
- val textBaseline = Ref<Px>()
+ val textBaseline = Ref<Float>()
val textSize = Ref<IntPxSize>()
val overlineTextPosition = Ref<PxPosition>()
- val overlineTextBaseline = Ref<Px>()
+ val overlineTextBaseline = Ref<Float>()
val overlineTextSize = Ref<IntPxSize>()
val secondaryTextPosition = Ref<PxPosition>()
- val secondaryTextBaseline = Ref<Px>()
+ val secondaryTextBaseline = Ref<Float>()
val secondaryTextSize = Ref<IntPxSize>()
val iconPosition = Ref<PxPosition>()
val iconSize = Ref<IntPxSize>()
val trailingPosition = Ref<PxPosition>()
val trailingSize = Ref<IntPxSize>()
- val trailingBaseline = Ref<Px>()
+ val trailingBaseline = Ref<Float>()
composeTestRule.setMaterialContent {
Box {
ListItem(
@@ -590,40 +605,44 @@
}
composeTestRule.runOnIdleComposeWithDensity {
assertThat(textPosition.value!!.x).isEqualTo(
- expectedLeftPadding.toIntPx().toPx() + iconSize.value!!.width +
- expectedContentLeftPadding.toIntPx().toPx()
+ expectedLeftPadding.toIntPx().value.toFloat() +
+ iconSize.value!!.width.value.toFloat() +
+ expectedContentLeftPadding.toIntPx().value.toFloat()
)
assertThat(textBaseline.value!!).isEqualTo(
- expectedOverlineBaseline.toIntPx().toPx() +
- expectedTextBaselineOffset.toIntPx().toPx()
+ expectedOverlineBaseline.toIntPx().value.toFloat() +
+ expectedTextBaselineOffset.toIntPx().value.toFloat()
)
assertThat(overlineTextPosition.value!!.x).isEqualTo(
- expectedLeftPadding.toIntPx().toPx() + iconSize.value!!.width +
- expectedContentLeftPadding.toIntPx().toPx()
+ expectedLeftPadding.toIntPx().value.toFloat() +
+ iconSize.value!!.width.value.toFloat() +
+ expectedContentLeftPadding.toIntPx().value.toFloat()
)
assertThat(overlineTextBaseline.value!!).isEqualTo(
- expectedOverlineBaseline.toIntPx().toPx()
+ expectedOverlineBaseline.toIntPx().value.toFloat()
)
assertThat(secondaryTextPosition.value!!.x).isEqualTo(
- expectedLeftPadding.toIntPx().toPx() + iconSize.value!!.width +
- expectedContentLeftPadding.toIntPx().toPx()
+ expectedLeftPadding.toIntPx().value.toFloat() +
+ iconSize.value!!.width.value.toFloat() +
+ expectedContentLeftPadding.toIntPx().value.toFloat()
)
assertThat(secondaryTextBaseline.value!!).isEqualTo(
- expectedOverlineBaseline.toIntPx().toPx() +
- expectedTextBaselineOffset.toIntPx().toPx() +
- expectedSecondaryTextBaselineOffset.toIntPx().toPx()
+ expectedOverlineBaseline.toIntPx().value.toFloat() +
+ expectedTextBaselineOffset.toIntPx().value.toFloat() +
+ expectedSecondaryTextBaselineOffset.toIntPx().value.toFloat()
)
- assertThat(iconPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().toPx())
+ assertThat(iconPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().value
+ .toFloat())
assertThat(iconPosition.value!!.y).isEqualTo(
- expectedIconTopPadding.toIntPx().toPx()
+ expectedIconTopPadding.toIntPx().value.toFloat()
)
val dm = composeTestRule.displayMetrics
assertThat(trailingPosition.value!!.x).isEqualTo(
- dm.widthPixels.px - trailingSize.value!!.width -
- expectedRightPadding.toIntPx().toPx()
+ dm.widthPixels - trailingSize.value!!.width.value.toFloat() -
+ expectedRightPadding.toIntPx().value.toFloat()
)
assertThat(trailingBaseline.value!!).isEqualTo(
- expectedOverlineBaseline.toIntPx().toPx()
+ expectedOverlineBaseline.toIntPx().value.toFloat()
)
}
}
@@ -633,11 +652,11 @@
private fun saveLayout(
coords: Ref<PxPosition>,
size: Ref<IntPxSize>,
- baseline: Ref<Px> = Ref()
+ baseline: Ref<Float> = Ref()
): Modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
coords.value = coordinates.localToGlobal(PxPosition.Origin)
- baseline.value = coordinates[FirstBaseline]?.toPx()?.let {
- it + coords.value!!.y
+ baseline.value = coordinates[FirstBaseline]?.value?.toFloat()?.let {
+ (it + coords.value!!.y)
}
size.value = coordinates.size
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt
index 7e8f4ef..96945bc 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt
@@ -132,7 +132,8 @@
)
}
}
- assertThat(appbarPosition.y + appbarSize.height).isEqualTo(contentPosition.y)
+ assertThat(appbarPosition.y + appbarSize.height.value.toFloat())
+ .isEqualTo(contentPosition.y)
}
@Test
@@ -166,8 +167,8 @@
)
}
}
- val appBarBottom = appbarPosition.y + appbarSize.height
- val contentBottom = contentPosition.y + contentSize.height
+ val appBarBottom = appbarPosition.y + appbarSize.height.value
+ val contentBottom = contentPosition.y + contentSize.height.value
assertThat(appBarBottom).isEqualTo(contentBottom)
}
@@ -200,15 +201,15 @@
}
}
}
- assertThat(drawerChildPosition.x).isLessThan(0.px)
+ assertThat(drawerChildPosition.x).isLessThan(0f)
findByTag(scaffoldTag).doGesture {
sendSwipeRight()
}
- assertThat(drawerChildPosition.x).isLessThan(0.px)
+ assertThat(drawerChildPosition.x).isLessThan(0f)
findByTag(scaffoldTag).doGesture {
sendSwipeLeft()
}
- assertThat(drawerChildPosition.x).isLessThan(0.px)
+ assertThat(drawerChildPosition.x).isLessThan(0f)
runOnUiThread {
scaffoldState.isDrawerGesturesEnabled = true
@@ -217,11 +218,11 @@
findByTag(scaffoldTag).doGesture {
sendSwipeRight()
}
- assertThat(drawerChildPosition.x).isEqualTo(0.px)
+ assertThat(drawerChildPosition.x).isEqualTo(0f)
findByTag(scaffoldTag).doGesture {
sendSwipeLeft()
}
- assertThat(drawerChildPosition.x).isLessThan(0.px)
+ assertThat(drawerChildPosition.x).isLessThan(0f)
}
@Test
@@ -253,15 +254,15 @@
}
}
}
- assertThat(drawerChildPosition.x).isLessThan(0.px)
+ assertThat(drawerChildPosition.x).isLessThan(0f)
runOnUiThread {
scaffoldState.drawerState = DrawerState.Opened
}
- assertThat(drawerChildPosition.x).isLessThan(0.px)
+ assertThat(drawerChildPosition.x).isLessThan(0f)
runOnUiThread {
scaffoldState.drawerState = DrawerState.Closed
}
- assertThat(drawerChildPosition.x).isLessThan(0.px)
+ assertThat(drawerChildPosition.x).isLessThan(0f)
}
@Test
@@ -298,7 +299,7 @@
Text("body")
}
}
- val expectedFabY = bottomBarPosition.y - fabSize.height / 2
+ val expectedFabY = bottomBarPosition.y - (fabSize.height / 2).value
assertThat(fabPosition.y).isEqualTo(expectedFabY)
}
@@ -337,7 +338,7 @@
Text("body")
}
}
- val expectedFabY = bottomBarPosition.y - fabSize.height / 2
+ val expectedFabY = bottomBarPosition.y - (fabSize.height / 2).value
assertThat(fabPosition.y).isEqualTo(expectedFabY)
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
index 9068ae4..8b504e6 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
@@ -44,13 +44,14 @@
import androidx.ui.unit.IntPx
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
-import androidx.ui.unit.round
+import androidx.ui.unit.ipx
import androidx.ui.unit.toPx
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
+import kotlin.math.roundToInt
@MediumTest
@RunWith(JUnit4::class)
@@ -110,7 +111,8 @@
assertThat(it[FirstBaseline])
.isEqualTo(it[LastBaseline])
// TODO(aelias): Remove 'parentCoordinates!!' when Semantics no longer using PassThroughLayout
- assertThat(it.parentCoordinates!!.positionInParent.y.round() + it[FirstBaseline]!!)
+ assertThat(it.parentCoordinates!!.positionInParent.y.roundToInt().ipx +
+ it[FirstBaseline]!!)
.isEqualTo(30.dp.toIntPx())
}
}
@@ -167,11 +169,11 @@
assertThat(localTextCoords[FirstBaseline]).isNotEqualTo(IntPx.Zero)
assertThat(localButtonTextCoords[FirstBaseline]).isNotEqualTo(IntPx.Zero)
assertThat(
- localTextCoords.globalPosition.y.round() +
+ localTextCoords.globalPosition.y.roundToInt().ipx +
localTextCoords[FirstBaseline]!!
).isEqualTo(30.dp.toIntPx())
assertThat(
- buttonTextPos.y.round() + localButtonTextCoords[FirstBaseline]!!
+ buttonTextPos.y.roundToInt().ipx + localButtonTextCoords[FirstBaseline]!!
).isEqualTo(30.dp.toIntPx())
}
}
@@ -201,7 +203,8 @@
assertThat(it[FirstBaseline]).isNotEqualTo(it[LastBaseline])
// TODO(aelias): Remove 'parentCoordinates!!' when Semantics no longer using PassThroughLayout
assertThat(
- it.parentCoordinates!!.positionInParent.y.round() + it[FirstBaseline]!!
+ it.parentCoordinates!!.positionInParent.y.roundToInt().ipx +
+ it[FirstBaseline]!!
).isEqualTo(30.dp.toIntPx())
}
}
@@ -246,18 +249,20 @@
val buttonPositionInSnack =
localSnackCoords.childToLocal(localButtonCoords, PxPosition.Origin)
val buttonCenter =
- buttonPositionInSnack.y + localButtonCoords.size.height / 2
+ buttonPositionInSnack.y.roundToInt() +
+ (localButtonCoords.size.height / 2).value.toFloat()
assertThat(localTextCoords[FirstBaseline]).isNotEqualTo(IntPx.Zero)
assertThat(localTextCoords[LastBaseline]).isNotEqualTo(IntPx.Zero)
assertThat(localTextCoords[FirstBaseline])
.isNotEqualTo(localTextCoords[LastBaseline])
assertThat(
- localTextCoords.globalPosition.y.round() +
+ localTextCoords.globalPosition.y.roundToInt().ipx +
localTextCoords[FirstBaseline]!!
).isEqualTo(30.dp.toIntPx())
- assertThat(buttonCenter).isEqualTo((localSnackCoords.size.height / 2).toPx())
+ assertThat(buttonCenter)
+ .isEqualTo((localSnackCoords.size.height / 2).value.toFloat())
}
}
}
@@ -303,21 +308,22 @@
localSnackCoords.childToLocal(localTextCoords, PxPosition.Origin)
assertThat(
- textPositionInSnack.y.round() + localTextCoords[FirstBaseline]!!
+ textPositionInSnack.y.roundToInt().ipx + localTextCoords[FirstBaseline]!!
).isEqualTo(30.dp.toIntPx())
assertThat(
- buttonPositionInSnack.y.round() - textPositionInSnack.y.round() -
+ buttonPositionInSnack.y.roundToInt().ipx -
+ textPositionInSnack.y.roundToInt().ipx -
localTextCoords[LastBaseline]!!
).isEqualTo(18.dp.toIntPx())
assertThat(
- localSnackCoords.size.height - buttonPositionInSnack.y.round() -
+ localSnackCoords.size.height - buttonPositionInSnack.y.roundToInt().ipx -
localButtonCoords.size.height
).isEqualTo(8.dp.toIntPx())
assertThat(
- localSnackCoords.size.width - buttonPositionInSnack.x.round() -
+ localSnackCoords.size.width - buttonPositionInSnack.x.roundToInt().ipx -
localButtonCoords.size.width
).isEqualTo(8.dp.toIntPx())
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/TabTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/TabTest.kt
index e8cb5a6..c61b4b7 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/TabTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/TabTest.kt
@@ -45,7 +45,6 @@
import androidx.ui.test.findAll
import androidx.ui.test.isInMutuallyExclusiveGroup
import androidx.ui.test.runOnIdleCompose
-import androidx.ui.unit.Px
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.toPx
@@ -147,12 +146,12 @@
val tabRowWidth = tabRowCoords.size.width
val tabRowHeight = tabRowCoords.size.height
- val indicatorPositionX = indicatorCoords.localToGlobal(PxPosition.Origin).x.value
+ val indicatorPositionX = indicatorCoords.localToGlobal(PxPosition.Origin).x
val expectedPositionX = 0.dp.toPx()
assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
val indicatorPositionY = indicatorCoords.localToGlobal(PxPosition.Origin).y
- val expectedPositionY = (tabRowHeight - indicatorHeight.toIntPx()).toPx()
+ val expectedPositionY = (tabRowHeight - indicatorHeight.toIntPx()).toPx().value
assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
tabRowWidth to tabRowHeight
@@ -166,11 +165,11 @@
runOnIdleCompose {
with(composeTestRule.density) {
val indicatorPositionX = indicatorCoords.localToGlobal(PxPosition.Origin).x
- val expectedPositionX = tabRowWidth / 2
- assertThat(indicatorPositionX).isEqualTo(expectedPositionX.toPx())
+ val expectedPositionX = (tabRowWidth / 2).value.toFloat()
+ assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
val indicatorPositionY = indicatorCoords.localToGlobal(PxPosition.Origin).y
- val expectedPositionY = (tabRowHeight - indicatorHeight.toIntPx()).toPx()
+ val expectedPositionY = (tabRowHeight - indicatorHeight.toIntPx()).toPx().value
assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
}
}
@@ -180,7 +179,7 @@
fun singleLineTab_textBaseline() {
lateinit var tabRowCoords: LayoutCoordinates
lateinit var textCoords: LayoutCoordinates
- var textBaseline: Px = Px(Float.NEGATIVE_INFINITY)
+ var textBaseline = Float.NEGATIVE_INFINITY
composeTestRule.setMaterialContent {
var state by state { 0 }
@@ -196,7 +195,7 @@
text = {
Text(text, Modifier.onPositioned { coords: LayoutCoordinates ->
textCoords = coords
- textBaseline = coords[LastBaseline]!!.toPx()
+ textBaseline = coords[LastBaseline]!!.toPx().value
})
},
selected = state == index,
@@ -216,7 +215,7 @@
val textPositionY = textCoords.localToGlobal(PxPosition.Origin).y
val baselinePositionY = textPositionY + textBaseline
- val expectedPositionY = tabRowHeight.toPx() - expectedBaselineDistance
+ val expectedPositionY = (tabRowHeight.toPx() - expectedBaselineDistance).value
assertThat(baselinePositionY).isEqualTo(expectedPositionY)
}
}
@@ -225,7 +224,7 @@
fun singleLineTab_withIcon_textBaseline() {
lateinit var tabRowCoords: LayoutCoordinates
lateinit var textCoords: LayoutCoordinates
- var textBaseline: Px = Px(Float.NEGATIVE_INFINITY)
+ var textBaseline = Float.NEGATIVE_INFINITY
composeTestRule.setMaterialContent {
var state by state { 0 }
@@ -241,7 +240,7 @@
text = {
Text(text, Modifier.onPositioned { coords: LayoutCoordinates ->
textCoords = coords
- textBaseline = coords[LastBaseline]!!.toPx()
+ textBaseline = coords[LastBaseline]!!.toPx().value
})
},
icon = { Icon(Icons.Filled.Favorite) },
@@ -262,7 +261,7 @@
val textPositionY = textCoords.localToGlobal(PxPosition.Origin).y
val baselinePositionY = textPositionY + textBaseline
- val expectedPositionY = tabRowHeight.toPx() - expectedBaselineDistance
+ val expectedPositionY = (tabRowHeight.toPx() - expectedBaselineDistance).value
assertThat(baselinePositionY).isEqualTo(expectedPositionY)
}
}
@@ -271,7 +270,7 @@
fun twoLineTab_textBaseline() {
lateinit var tabRowCoords: LayoutCoordinates
lateinit var textCoords: LayoutCoordinates
- var textBaseline: Px = Px(Float.NEGATIVE_INFINITY)
+ var textBaseline = Float.NEGATIVE_INFINITY
composeTestRule.setMaterialContent {
var state by state { 0 }
@@ -287,7 +286,7 @@
text = {
Text(text, Modifier.preferredWidth(100.dp).onPositioned { coords ->
textCoords = coords
- textBaseline = coords[LastBaseline]!!.toPx()
+ textBaseline = coords[LastBaseline]!!.toPx().value
}, maxLines = 2)
},
selected = state == index,
@@ -307,7 +306,7 @@
val textPositionY = textCoords.localToGlobal(PxPosition.Origin).y
val baselinePositionY = textPositionY + textBaseline
- val expectedPositionY = tabRowHeight.toPx() - expectedBaselineDistance
+ val expectedPositionY = (tabRowHeight.toPx() - expectedBaselineDistance).value
assertThat(baselinePositionY).isEqualTo(expectedPositionY)
}
}
@@ -358,11 +357,11 @@
// Indicator should be placed in the bottom left of the first tab
val indicatorPositionX = indicatorCoords.localToGlobal(PxPosition.Origin).x
// Tabs in a scrollable tab row are offset 52.dp from each end
- val expectedPositionX = scrollableTabRowOffset.toIntPx().toPx()
+ val expectedPositionX = scrollableTabRowOffset.toIntPx().toPx().value
assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
val indicatorPositionY = indicatorCoords.localToGlobal(PxPosition.Origin).y
- val expectedPositionY = (tabRowHeight - indicatorHeight.toIntPx()).toPx()
+ val expectedPositionY = (tabRowHeight - indicatorHeight.toIntPx()).toPx().value
assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
tabRowHeight
@@ -375,11 +374,12 @@
// should be in the middle of the TabRow
composeTestRule.runOnIdleComposeWithDensity {
val indicatorPositionX = indicatorCoords.localToGlobal(PxPosition.Origin).x
- val expectedPositionX = (scrollableTabRowOffset + minimumTabWidth).toIntPx().toPx()
+ val expectedPositionX = (scrollableTabRowOffset + minimumTabWidth).toIntPx()
+ .toPx().value
assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
val indicatorPositionY = indicatorCoords.localToGlobal(PxPosition.Origin).y
- val expectedPositionY = (tabRowHeight - indicatorHeight.toIntPx()).toPx()
+ val expectedPositionY = (tabRowHeight - indicatorHeight.toIntPx()).toPx().value
assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
}
}
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Slider.kt b/ui/ui-material/src/main/java/androidx/ui/material/Slider.kt
index 4ede707..a502104 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/Slider.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/Slider.kt
@@ -127,7 +127,7 @@
val pressed = state { false }
val press = Modifier.pressIndicatorGestureFilter(
pos ->
- position.holder.snapTo(pos.x.value)
+ position.holder.snapTo(pos.x)
pressed.value = true
},
>
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/ripple/DefaultRippleEffect.kt b/ui/ui-material/src/main/java/androidx/ui/material/ripple/DefaultRippleEffect.kt
index 20b689e..321f2fd 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/ripple/DefaultRippleEffect.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/ripple/DefaultRippleEffect.kt
@@ -247,7 +247,8 @@
* - fits within the border of the surface it belongs to for unbounded ripples
*/
internal fun Density.getRippleEndRadius(bounded: Boolean, size: PxSize): Float {
- val radiusCoveringBounds = (PxPosition(size.width, size.height).getDistance() / 2f).value
+ val radiusCoveringBounds =
+ (PxPosition(size.width.value, size.height.value).getDistance() / 2f).value
return if (bounded) {
radiusCoveringBounds + BoundedRippleExtraRadius.toPx()
} else {
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/LayoutCoordinatesHelperTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/LayoutCoordinatesHelperTest.kt
index ac1cf65..65a8f4a 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/LayoutCoordinatesHelperTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/LayoutCoordinatesHelperTest.kt
@@ -30,7 +30,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
-import androidx.ui.unit.px
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Rule
@@ -105,7 +104,7 @@
assertTrue(latch.await(1, TimeUnit.SECONDS))
assertEquals(
- PxPosition(5.px, 0.px),
+ PxPosition(5f, 0f),
parentCoordinates!!.childToLocal(childCoordinates!!, PxPosition.Origin)
)
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendPinchTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendPinchTest.kt
index 8752360..d3900f7 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendPinchTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendPinchTest.kt
@@ -33,7 +33,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.inMilliseconds
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -62,10 +61,10 @@
}
}
- val start0 = PxPosition(40.px, 50.px)
- val end0 = PxPosition(8.px, 50.px)
- val start1 = PxPosition(60.px, 50.px)
- val end1 = PxPosition(92.px, 50.px)
+ val start0 = PxPosition(40f, 50f)
+ val end0 = PxPosition(8f, 50f)
+ val start1 = PxPosition(60f, 50f)
+ val end1 = PxPosition(92f, 50f)
val duration = 400.milliseconds
findByTag(TAG).doGesture {
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendSwipeTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendSwipeTest.kt
index ec32f44..3b77635 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendSwipeTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendSwipeTest.kt
@@ -120,7 +120,7 @@
// Last event must be above first event
assertThat(events.last().position.y).isLessThan(events.first().position.y)
// All events in between only move up
- events.map { it.position.x.value }.assertSame(tolerance = 0.001f)
+ events.map { it.position.x }.assertSame(tolerance = 0.001f)
events.map { it.position.y }.assertDecreasing()
}
@@ -130,7 +130,7 @@
// Last event must be below first event
assertThat(events.last().position.y).isGreaterThan(events.first().position.y)
// All events in between only move down
- events.map { it.position.x.value }.assertSame(tolerance = 0.001f)
+ events.map { it.position.x }.assertSame(tolerance = 0.001f)
events.map { it.position.y }.assertIncreasing()
}
@@ -141,7 +141,7 @@
assertThat(events.last().position.x).isLessThan(events.first().position.x)
// All events in between only move to the left
events.map { it.position.x }.assertDecreasing()
- events.map { it.position.y.value }.assertSame(tolerance = 0.001f)
+ events.map { it.position.y }.assertSame(tolerance = 0.001f)
}
private fun PointerInputRecorder.assertSwipeIsRight() {
@@ -151,7 +151,7 @@
assertThat(events.last().position.x).isGreaterThan(events.first().position.x)
// All events in between only move to the right
events.map { it.position.x }.assertIncreasing()
- events.map { it.position.y.value }.assertSame(tolerance = 0.001f)
+ events.map { it.position.y }.assertSame(tolerance = 0.001f)
}
private fun List<Float>.assertSame(tolerance: Float = 0f) {
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendSwipeVelocityTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendSwipeVelocityTest.kt
index 1ce3782..9474a88 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendSwipeVelocityTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendSwipeVelocityTest.kt
@@ -159,8 +159,8 @@
// Check velocity
val actualVelocity = recordedVelocity.pixelsPerSecond
- assertThat(actualVelocity.x.value).isWithin(.1f).of(expectedXVelocity)
- assertThat(actualVelocity.y.value).isWithin(.1f).of(expectedYVelocity)
+ assertThat(actualVelocity.x).isWithin(.1f).of(expectedXVelocity)
+ assertThat(actualVelocity.y).isWithin(.1f).of(expectedYVelocity)
assertThat(actualVelocity.getDistance().value)
.isWithin(velocity * 0.001f).of(velocity)
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendCancelTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendCancelTest.kt
index df12790..7eda547 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendCancelTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendCancelTest.kt
@@ -24,7 +24,6 @@
import androidx.ui.test.util.expectError
import androidx.ui.test.util.verify
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.After
import org.junit.Rule
@@ -45,7 +44,7 @@
)
companion object {
- private val downPosition = PxPosition(5.px, 5.px)
+ private val downPosition = PxPosition(5f, 5f)
@JvmStatic
@Parameterized.Parameters(name = "{0}")
@@ -54,7 +53,7 @@
listOf(0f, -10f).map { y ->
TestConfig(x, y)
}
- }.plus(TestConfig(downPosition.x.value, downPosition.y.value))
+ }.plus(TestConfig(downPosition.x, downPosition.y))
}
}
@@ -64,7 +63,7 @@
@get:Rule
val inputDispatcherRule: TestRule = dispatcherRule
- private val position = PxPosition(config.x.px, config.y.px)
+ private val position = PxPosition(config.x, config.y)
private val recorder = MotionEventRecorder()
private val subject = AndroidInputDispatcher(recorder::recordEvent)
@@ -95,8 +94,8 @@
*/
@SmallTest
class SendCancelAfterFinishedTest {
- private val downPosition = PxPosition(5.px, 5.px)
- private val position = PxPosition(1.px, 1.px)
+ private val downPosition = PxPosition(5f, 5f)
+ private val position = PxPosition(1f, 1f)
@get:Rule
val inputDispatcherRule: TestRule = AndroidInputDispatcher.TestRule(
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendClickTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendClickTest.kt
index 1878214..c3a199c 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendClickTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendClickTest.kt
@@ -23,7 +23,6 @@
import androidx.ui.test.util.assertHasValidEventTimes
import androidx.ui.test.util.verify
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.After
import org.junit.Rule
@@ -61,7 +60,7 @@
@get:Rule
val inputDispatcherRule: TestRule = dispatcherRule
- private val position = PxPosition(config.x.px, config.y.px)
+ private val position = PxPosition(config.x, config.y)
private val recorder = MotionEventRecorder()
private val subject = AndroidInputDispatcher(recorder::recordEvent)
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendDownTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendDownTest.kt
index 23896cd..3d8a539 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendDownTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendDownTest.kt
@@ -24,7 +24,6 @@
import androidx.ui.test.util.expectError
import androidx.ui.test.util.verify
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.After
import org.junit.Rule
@@ -62,7 +61,7 @@
disableDispatchInRealTime = true
)
- private val position = PxPosition(config.x.px, config.y.px)
+ private val position = PxPosition(config.x, config.y)
private val recorder = MotionEventRecorder()
private val subject = AndroidInputDispatcher(recorder::recordEvent)
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendMoveTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendMoveTest.kt
index 8422956..bd20abe 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendMoveTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendMoveTest.kt
@@ -24,7 +24,6 @@
import androidx.ui.test.util.expectError
import androidx.ui.test.util.verify
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.After
import org.junit.Rule
@@ -45,7 +44,7 @@
)
companion object {
- private val downPosition = PxPosition(5.px, 5.px)
+ private val downPosition = PxPosition(5f, 5f)
@JvmStatic
@Parameterized.Parameters(name = "{0}")
@@ -54,7 +53,7 @@
listOf(0f, -10f).map { y ->
TestConfig(x, y)
}
- }.plus(TestConfig(downPosition.x.value, downPosition.y.value))
+ }.plus(TestConfig(downPosition.x, downPosition.y))
}
}
@@ -64,7 +63,7 @@
@get:Rule
val inputDispatcherRule: TestRule = dispatcherRule
- private val position = PxPosition(config.x.px, config.y.px)
+ private val position = PxPosition(config.x, config.y)
private val recorder = MotionEventRecorder()
private val subject = AndroidInputDispatcher(recorder::recordEvent)
@@ -95,8 +94,8 @@
*/
@SmallTest
class SendMoveAfterFinishedTest {
- private val downPosition = PxPosition(5.px, 5.px)
- private val position = PxPosition(1.px, 1.px)
+ private val downPosition = PxPosition(5f, 5f)
+ private val position = PxPosition(1f, 1f)
@get:Rule
val inputDispatcherRule: TestRule = AndroidInputDispatcher.TestRule(
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeFunctionTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeFunctionTest.kt
index 4d80f2b6..676a6a7 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeFunctionTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeFunctionTest.kt
@@ -33,7 +33,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.inMilliseconds
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.After
import org.junit.Before
@@ -45,8 +44,8 @@
private val curve = { t: Long ->
PxPosition(
- t.toFloat().px,
- (-t).toFloat().px
+ t.toFloat(),
+ (-t).toFloat()
)
}
@@ -317,8 +316,8 @@
// Check that coordinates are the function's value at the respective timestamps
forEach {
- assertThat(it.x).isEqualTo(curve(it.relativeTime).x.value)
- assertThat(it.y).isEqualTo(curve(it.relativeTime).y.value)
+ assertThat(it.x).isEqualTo(curve(it.relativeTime).x)
+ assertThat(it.y).isEqualTo(curve(it.relativeTime).y)
}
// The given keyTimes must occur as event timestamps
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeLineTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeLineTest.kt
index 9757975..ffd3ead 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeLineTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeLineTest.kt
@@ -27,7 +27,6 @@
import androidx.ui.test.util.verify
import androidx.ui.unit.PxPosition
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.After
import org.junit.Rule
@@ -50,8 +49,8 @@
)
companion object {
- private val start = PxPosition(5f.px, 7f.px)
- private val end = PxPosition(23f.px, 29f.px)
+ private val start = PxPosition(5f, 7f)
+ private val end = PxPosition(23f, 29f)
@JvmStatic
@Parameterized.Parameters(name = "{0}")
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendUpTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendUpTest.kt
index c7c11cb..a470d2d 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendUpTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendUpTest.kt
@@ -24,7 +24,6 @@
import androidx.ui.test.util.expectError
import androidx.ui.test.util.verify
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.After
import org.junit.Rule
@@ -45,7 +44,7 @@
)
companion object {
- private val downPosition = PxPosition(5.px, 5.px)
+ private val downPosition = PxPosition(5f, 5f)
@JvmStatic
@Parameterized.Parameters(name = "{0}")
@@ -54,7 +53,7 @@
listOf(0f, -10f).map { y ->
TestConfig(x, y)
}
- }.plus(TestConfig(downPosition.x.value, downPosition.y.value))
+ }.plus(TestConfig(downPosition.x, downPosition.y))
}
}
@@ -64,7 +63,7 @@
@get:Rule
val inputDispatcherRule: TestRule = dispatcherRule
- private val position = PxPosition(config.x.px, config.y.px)
+ private val position = PxPosition(config.x, config.y)
private val recorder = MotionEventRecorder()
private val subject = AndroidInputDispatcher(recorder::recordEvent)
@@ -95,8 +94,8 @@
*/
@SmallTest
class SendUpAfterFinishedTest {
- private val downPosition = PxPosition(5.px, 5.px)
- private val position = PxPosition(1.px, 1.px)
+ private val downPosition = PxPosition(5f, 5f)
+ private val position = PxPosition(1f, 1f)
@get:Rule
val inputDispatcherRule: TestRule = AndroidInputDispatcher.TestRule(
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/DoPartialGestureTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/DoPartialGestureTest.kt
index 6231969..20f9298 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/DoPartialGestureTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/DoPartialGestureTest.kt
@@ -35,7 +35,6 @@
import androidx.ui.test.util.expectError
import androidx.ui.test.util.timeDiffWith
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Rule
@@ -45,7 +44,7 @@
import org.junit.runners.Parameterized
private const val tag = "widget"
-private val anyPosition = PxPosition(1.px, 1.px)
+private val anyPosition = PxPosition(1f, 1f)
private val (PartialGestureScope.(PxPosition) -> Unit).string: String
get() = when (this) {
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendCancelTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendCancelTest.kt
index ba35892..fc43746 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendCancelTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendCancelTest.kt
@@ -28,7 +28,6 @@
import androidx.ui.test.util.PointerInputRecorder
import androidx.ui.test.util.assertTimestampsAreIncreasing
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -40,7 +39,7 @@
@RunWith(Parameterized::class)
class SendCancelTest(private val config: TestConfig) {
data class TestConfig(val cancelPosition: PxPosition?) {
- val downPosition = PxPosition(1.px, 1.px)
+ val downPosition = PxPosition(1f, 1f)
}
companion object {
@@ -50,8 +49,8 @@
@Parameterized.Parameters(name = "{0}")
fun createTestSet(): List<TestConfig> {
return mutableListOf<TestConfig>().apply {
- for (x in listOf(2.px, 99.px)) {
- for (y in listOf(3.px, 53.px)) {
+ for (x in listOf(2f, 99f)) {
+ for (y in listOf(3f, 53f)) {
add(TestConfig(PxPosition(x, y)))
}
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendDownTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendDownTest.kt
index 13fce7d..cab37d0 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendDownTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendDownTest.kt
@@ -27,7 +27,6 @@
import androidx.ui.test.util.PointerInputRecorder
import androidx.ui.test.util.assertTimestampsAreIncreasing
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -47,8 +46,8 @@
@Parameterized.Parameters(name = "{0}")
fun createTestSet(): List<TestConfig> {
return mutableListOf<TestConfig>().apply {
- for (x in listOf(1.px, 99.px)) {
- for (y in listOf(2.px, 53.px)) {
+ for (x in listOf(1f, 99f)) {
+ for (y in listOf(2f, 53f)) {
add(TestConfig(PxPosition(x, y)))
}
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveByTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveByTest.kt
index 4eed637..f9fbe33 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveByTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveByTest.kt
@@ -28,7 +28,6 @@
import androidx.ui.test.util.PointerInputRecorder
import androidx.ui.test.util.assertTimestampsAreIncreasing
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -40,7 +39,7 @@
@RunWith(Parameterized::class)
class SendMoveByTest(private val config: TestConfig) {
data class TestConfig(val moveByDelta: PxPosition) {
- val downPosition = PxPosition(1.px, 1.px)
+ val downPosition = PxPosition(1f, 1f)
}
companion object {
@@ -50,8 +49,8 @@
@Parameterized.Parameters(name = "{0}")
fun createTestSet(): List<TestConfig> {
return mutableListOf<TestConfig>().apply {
- for (x in listOf(2.px, (-100).px)) {
- for (y in listOf(3.px, (-530).px)) {
+ for (x in listOf(2f, -100f)) {
+ for (y in listOf(3f, -530f)) {
add(TestConfig(PxPosition(x, y)))
}
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveToTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveToTest.kt
index a616143..f4ba029 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveToTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveToTest.kt
@@ -28,7 +28,6 @@
import androidx.ui.test.util.PointerInputRecorder
import androidx.ui.test.util.assertTimestampsAreIncreasing
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -40,7 +39,7 @@
@RunWith(Parameterized::class)
class SendMoveToTest(private val config: TestConfig) {
data class TestConfig(val moveToPosition: PxPosition) {
- val downPosition = PxPosition(1.px, 1.px)
+ val downPosition = PxPosition(1f, 1f)
}
companion object {
@@ -50,8 +49,8 @@
@Parameterized.Parameters(name = "{0}")
fun createTestSet(): List<TestConfig> {
return mutableListOf<TestConfig>().apply {
- for (x in listOf(2.px, 99.px)) {
- for (y in listOf(3.px, 53.px)) {
+ for (x in listOf(2f, 99f)) {
+ for (y in listOf(3f, 53f)) {
add(TestConfig(PxPosition(x, y)))
}
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendUpTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendUpTest.kt
index eccbca8..95148ec 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendUpTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendUpTest.kt
@@ -28,7 +28,6 @@
import androidx.ui.test.util.PointerInputRecorder
import androidx.ui.test.util.assertTimestampsAreIncreasing
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -40,7 +39,7 @@
@RunWith(Parameterized::class)
class SendUpTest(private val config: TestConfig) {
data class TestConfig(val upPosition: PxPosition?) {
- val downPosition = PxPosition(1.px, 1.px)
+ val downPosition = PxPosition(1f, 1f)
}
companion object {
@@ -50,8 +49,8 @@
@Parameterized.Parameters(name = "{0}")
fun createTestSet(): List<TestConfig> {
return mutableListOf<TestConfig>().apply {
- for (x in listOf(2.px, 99.px)) {
- for (y in listOf(3.px, 53.px)) {
+ for (x in listOf(2f, 99f)) {
+ for (y in listOf(3f, 53f)) {
add(TestConfig(PxPosition(x, y)))
}
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/util/MotionEvents.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/util/MotionEvents.kt
index f10439f..54e0f1e 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/util/MotionEvents.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/util/MotionEvents.kt
@@ -70,8 +70,8 @@
assertThat(relativeTime).isEqualTo(expectedRelativeTime)
// x and y can just be taken from the function. We're not testing the function, we're
// testing if the MotionEvent sampled the function at the correct point
- assertThat(x).isEqualTo(expectedPosition.x.value)
- assertThat(y).isEqualTo(expectedPosition.y.value)
+ assertThat(x).isEqualTo(expectedPosition.x)
+ assertThat(y).isEqualTo(expectedPosition.y)
}
/**
@@ -85,8 +85,8 @@
* Checks that the coordinates are progressing in a monotonous direction
*/
fun List<MotionEvent>.isMonotonicBetween(start: PxPosition, end: PxPosition) {
- map { it.x }.isMonotonicBetween(start.x.value, end.x.value, 1e-6f)
- map { it.y }.isMonotonicBetween(start.y.value, end.y.value, 1e-6f)
+ map { it.x }.isMonotonicBetween(start.x, end.x, 1e-6f)
+ map { it.y }.isMonotonicBetween(start.y, end.y, 1e-6f)
}
/**
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/util/PointerInputs.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/util/PointerInputs.kt
index 20d0eed..7434a89 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/util/PointerInputs.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/util/PointerInputs.kt
@@ -101,6 +101,6 @@
* Checks that the coordinates are progressing in a monotonous direction
*/
fun List<DataPoint>.isMonotonicBetween(start: PxPosition, end: PxPosition) {
- map { it.x.value }.isMonotonicBetween(start.x.value, end.x.value, 1e-3f)
- map { it.y.value }.isMonotonicBetween(start.y.value, end.y.value, 1e-3f)
+ map { it.x }.isMonotonicBetween(start.x, end.x, 1e-3f)
+ map { it.y }.isMonotonicBetween(start.y, end.y, 1e-3f)
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/util/Truth.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/util/Truth.kt
index 6aa4643..ec5d32d 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/util/Truth.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/util/Truth.kt
@@ -34,8 +34,8 @@
* tolerance is 0.001.
*/
fun PxPosition.isAlmostEqualTo(position: PxPosition, tolerance: Float = 1e-3f) {
- assertThat(x.value).isAlmostEqualTo(position.x.value, tolerance)
- assertThat(y.value).isAlmostEqualTo(position.y.value, tolerance)
+ assertThat(x).isAlmostEqualTo(position.x, tolerance)
+ assertThat(y).isAlmostEqualTo(position.y, tolerance)
}
/**
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/Actions.kt b/ui/ui-test/src/main/java/androidx/ui/test/Actions.kt
index 28ab006..3608d7f 100644
--- a/ui/ui-test/src/main/java/androidx/ui/test/Actions.kt
+++ b/ui/ui-test/src/main/java/androidx/ui/test/Actions.kt
@@ -67,12 +67,12 @@
"No Layout Node found!"
)
- val position = layoutNode.coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ val position = layoutNode.coordinates.localToGlobal(PxPosition(0.0f, 0.0f))
runOnUiThread {
scrollableSemanticsNode.config[SemanticsActions.ScrollTo].action(
- globalPosition.x - position.x,
- globalPosition.y - position.y
+ (globalPosition.x - position.x).px,
+ (globalPosition.y - position.y).px
)
}
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/GestureScope.kt b/ui/ui-test/src/main/java/androidx/ui/test/GestureScope.kt
index 79879d5..ce7d058 100644
--- a/ui/ui-test/src/main/java/androidx/ui/test/GestureScope.kt
+++ b/ui/ui-test/src/main/java/androidx/ui/test/GestureScope.kt
@@ -25,8 +25,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.inMilliseconds
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.px
-import androidx.ui.unit.toPx
import androidx.ui.util.lerp
import kotlin.math.atan2
import kotlin.math.cos
@@ -100,7 +98,7 @@
*/
fun BaseGestureScope.localToGlobal(position: PxPosition): PxPosition {
val bounds = globalBounds
- return position + PxPosition(bounds.left, bounds.top)
+ return position + PxPosition(bounds.left.value, bounds.top.value)
}
/**
@@ -289,7 +287,7 @@
// Decompose v into it's x and y components
val delta = end - start
- val theta = atan2(delta.y.value, delta.x.value)
+ val theta = atan2(delta.y, delta.x)
// VelocityTracker internally calculates px/s, not px/ms
val vx = cos(theta) * endVelocity / 1000
val vy = sin(theta) * endVelocity / 1000
@@ -305,10 +303,10 @@
// (-age, x) and (-age, y) for vx and vy respectively, which is accounted for in
// f(Long, Long, Float, Float, Float).
val durationMs = duration.inMilliseconds()
- val fx = createFunctionForVelocity(durationMs, globalStart.x.value, globalEnd.x.value, vx)
- val fy = createFunctionForVelocity(durationMs, globalStart.y.value, globalEnd.y.value, vy)
+ val fx = createFunctionForVelocity(durationMs, globalStart.x, globalEnd.x, vx)
+ val fy = createFunctionForVelocity(durationMs, globalStart.y, globalEnd.y, vy)
- inputDispatcher.sendSwipe({ t -> PxPosition(fx(t).px, fy(t).px) }, duration)
+ inputDispatcher.sendSwipe({ t -> PxPosition(fx(t), fy(t)) }, duration)
}
/**
@@ -319,9 +317,9 @@
*/
fun GestureScope.sendSwipeUp() {
val x = center.x
- val y0 = size.height * (1 - edgeFuzzFactor)
- val y1 = 0.px
- val start = PxPosition(x, y0.toPx())
+ val y0 = (size.height * (1 - edgeFuzzFactor)).value.toFloat()
+ val y1 = 0.0f
+ val start = PxPosition(x, y0)
val end = PxPosition(x, y1)
sendSwipe(start, end, 200.milliseconds)
}
@@ -334,10 +332,10 @@
*/
fun GestureScope.sendSwipeDown() {
val x = center.x
- val y0 = size.height * edgeFuzzFactor
- val y1 = size.height
- val start = PxPosition(x, y0.toPx())
- val end = PxPosition(x, y1.toPx())
+ val y0 = (size.height * edgeFuzzFactor).value.toFloat()
+ val y1 = size.height.value.toFloat()
+ val start = PxPosition(x, y0)
+ val end = PxPosition(x, y1)
sendSwipe(start, end, 200.milliseconds)
}
@@ -348,10 +346,10 @@
* Throws [AssertionError] when the component doesn't have a bounding rectangle set
*/
fun GestureScope.sendSwipeLeft() {
- val x0 = size.width * (1 - edgeFuzzFactor)
- val x1 = 0.px
+ val x0 = (size.width * (1 - edgeFuzzFactor)).value.toFloat()
+ val x1 = 0.0f
val y = center.y
- val start = PxPosition(x0.toPx(), y)
+ val start = PxPosition(x0, y)
val end = PxPosition(x1, y)
sendSwipe(start, end, 200.milliseconds)
}
@@ -363,11 +361,11 @@
* Throws [AssertionError] when the component doesn't have a bounding rectangle set
*/
fun GestureScope.sendSwipeRight() {
- val x0 = size.width * edgeFuzzFactor
- val x1 = size.width
+ val x0 = (size.width * edgeFuzzFactor).value.toFloat()
+ val x1 = size.width.value.toFloat()
val y = center.y
- val start = PxPosition(x0.toPx(), y)
- val end = PxPosition(x1.toPx(), y)
+ val start = PxPosition(x0, y)
+ val end = PxPosition(x1, y)
sendSwipe(start, end, 200.milliseconds)
}
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/android/AndroidInputDispatcher.kt b/ui/ui-test/src/main/java/androidx/ui/test/android/AndroidInputDispatcher.kt
index 8152411..6640653 100644
--- a/ui/ui-test/src/main/java/androidx/ui/test/android/AndroidInputDispatcher.kt
+++ b/ui/ui-test/src/main/java/androidx/ui/test/android/AndroidInputDispatcher.kt
@@ -280,8 +280,8 @@
},
Array(coordinates.size) {
MotionEvent.PointerCoords().apply {
- x = coordinates[it].x.value
- y = coordinates[it].y.value
+ x = coordinates[it].x
+ y = coordinates[it].y
}
},
0,
diff --git a/ui/ui-text-core/src/androidTest/java/androidx/ui/text/MultiParagraphIntegrationTest.kt b/ui/ui-text-core/src/androidTest/java/androidx/ui/text/MultiParagraphIntegrationTest.kt
index 0ba70c8..1b09373 100644
--- a/ui/ui-text-core/src/androidTest/java/androidx/ui/text/MultiParagraphIntegrationTest.kt
+++ b/ui/ui-text-core/src/androidTest/java/androidx/ui/text/MultiParagraphIntegrationTest.kt
@@ -32,7 +32,6 @@
import androidx.ui.unit.PxPosition
import androidx.ui.unit.TextUnit
import androidx.ui.unit.em
-import androidx.ui.unit.px
import androidx.ui.unit.sp
import com.google.common.truth.Truth.assertThat
import com.google.common.truth.Truth.assertWithMessage
@@ -224,7 +223,9 @@
val col = i % lineLength
val x = fontSizeInPx * col
- val actualOffset = paragraph.getOffsetForPosition(PxPosition(x.px, y.px))
+ val actualOffset = paragraph.getOffsetForPosition(
+ PxPosition(x.toFloat(), y.toFloat())
+ )
assertWithMessage("getOffsetForPosition($x, $y) failed")
.that(actualOffset).isEqualTo(i)
}
diff --git a/ui/ui-text-core/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt b/ui/ui-text-core/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt
index 6c0ed96e..7eba737 100644
--- a/ui/ui-text-core/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt
+++ b/ui/ui-text-core/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt
@@ -43,7 +43,6 @@
import androidx.ui.unit.Density
import androidx.ui.unit.PxPosition
import androidx.ui.unit.em
-import androidx.ui.unit.px
import androidx.ui.unit.sp
import com.google.common.truth.Truth.assertThat
import com.google.common.truth.Truth.assertWithMessage
@@ -227,7 +226,7 @@
// test positions that are 1, fontSize+1, 2fontSize+1 which maps to chars 0, 1, 2 ...
for (i in 0..text.length) {
- val position = PxPosition((i * fontSizeInPx + 1).px, (fontSizeInPx / 2).px)
+ val position = PxPosition((i * fontSizeInPx + 1), (fontSizeInPx / 2))
val offset = paragraph.getOffsetForPosition(position)
assertWithMessage("offset at index $i, position $position does not match")
.that(offset).isEqualTo(i)
@@ -249,7 +248,7 @@
// test positions that are 1, fontSize+1, 2fontSize+1 which maps to chars .., 2, 1, 0
for (i in 0..text.length) {
- val position = PxPosition((i * fontSizeInPx + 1).px, (fontSizeInPx / 2).px)
+ val position = PxPosition((i * fontSizeInPx + 1), (fontSizeInPx / 2))
val offset = paragraph.getOffsetForPosition(position)
assertWithMessage("offset at index $i, position $position does not match")
.that(offset).isEqualTo(text.length - i)
@@ -274,7 +273,7 @@
// test positions are 1, fontSize+1, 2fontSize+1 and always on the second line
// which maps to chars 3, 4, 5
for (i in 0..secondLine.length) {
- val position = PxPosition((i * fontSizeInPx + 1).px, (fontSizeInPx * 1.5f).px)
+ val position = PxPosition((i * fontSizeInPx + 1), (fontSizeInPx * 1.5f))
val offset = paragraph.getOffsetForPosition(position)
assertWithMessage(
"offset at index $i, position $position, second line does not match"
@@ -300,7 +299,7 @@
// test positions are 1, fontSize+1, 2fontSize+1 and always on the second line
// which maps to chars 5, 4, 3
for (i in 0..secondLine.length) {
- val position = PxPosition((i * fontSizeInPx + 1).px, (fontSizeInPx * 1.5f).px)
+ val position = PxPosition((i * fontSizeInPx + 1), (fontSizeInPx * 1.5f))
val offset = paragraph.getOffsetForPosition(position)
assertWithMessage(
"offset at index $i, position $position, second line does not match"
@@ -322,12 +321,12 @@
)
// greater than width
- var position = PxPosition((fontSizeInPx * text.length * 2).px, (fontSizeInPx / 2).px)
+ var position = PxPosition((fontSizeInPx * text.length * 2), (fontSizeInPx / 2))
var offset = paragraph.getOffsetForPosition(position)
assertThat(offset).isEqualTo(text.length)
// negative
- position = PxPosition((-1 * fontSizeInPx).px, (fontSizeInPx / 2).px)
+ position = PxPosition((-1 * fontSizeInPx), (fontSizeInPx / 2))
offset = paragraph.getOffsetForPosition(position)
assertThat(offset).isZero()
}
@@ -346,12 +345,12 @@
)
// greater than height
- var position = PxPosition((fontSizeInPx / 2).px, (fontSizeInPx * text.length * 2).px)
+ var position = PxPosition((fontSizeInPx / 2), (fontSizeInPx * text.length * 2))
var offset = paragraph.getOffsetForPosition(position)
assertThat(offset).isZero()
// negative
- position = PxPosition((fontSizeInPx / 2).px, (-1 * fontSizeInPx).px)
+ position = PxPosition((fontSizeInPx / 2), (-1 * fontSizeInPx))
offset = paragraph.getOffsetForPosition(position)
assertThat(offset).isZero()
}
@@ -2209,7 +2208,7 @@
)
// The position of the last character in display order.
- val position = PxPosition(("a.".length * fontSizeInPx + 1).px, (fontSizeInPx / 2).px)
+ val position = PxPosition(("a.".length * fontSizeInPx + 1), (fontSizeInPx / 2))
val charIndex = paragraph.getOffsetForPosition(position)
assertThat(charIndex).isEqualTo(2)
}
@@ -2233,7 +2232,7 @@
)
// The position of the first character in display order.
- val position = PxPosition((fontSizeInPx / 2 + 1).px, (fontSizeInPx / 2).px)
+ val position = PxPosition((fontSizeInPx / 2 + 1), (fontSizeInPx / 2))
val charIndex = paragraph.getOffsetForPosition(position)
assertThat(charIndex).isEqualTo(2)
}
@@ -2255,7 +2254,7 @@
for (i in 0..text.length) {
// The position of the i-th character in display order.
- val position = PxPosition((i * fontSizeInPx + 1).px, (fontSizeInPx / 2).px)
+ val position = PxPosition((i * fontSizeInPx + 1), (fontSizeInPx / 2))
val charIndex = paragraph.getOffsetForPosition(position)
assertThat(charIndex).isEqualTo(i)
}
@@ -2278,7 +2277,7 @@
for (i in text.indices) {
// The position of the i-th character in display order.
- val position = PxPosition((i * fontSizeInPx + 1).px, (fontSizeInPx / 2).px)
+ val position = PxPosition((i * fontSizeInPx + 1), (fontSizeInPx / 2))
val charIndex = paragraph.getOffsetForPosition(position)
assertThat(charIndex).isEqualTo(i)
}
@@ -2300,7 +2299,7 @@
)
// The first character in display order should be '.'
- val position = PxPosition((fontSizeInPx / 2 + 1).px, (fontSizeInPx / 2).px)
+ val position = PxPosition((fontSizeInPx / 2 + 1), (fontSizeInPx / 2))
val index = paragraph.getOffsetForPosition(position)
assertThat(index).isEqualTo(2)
}
@@ -3118,7 +3117,7 @@
// This position should point to the first character 'a' if indent is applied.
// Otherwise this position will point to the second character 'b'.
- val position = PxPosition((indentInPx + 1).px, (fontSizeInPx / 2).px)
+ val position = PxPosition((indentInPx + 1), (fontSizeInPx / 2))
// The offset corresponding to the position should be the first char 'a'.
assertThat(paragraph.getOffsetForPosition(position)).isZero()
}
diff --git a/ui/ui-text-core/src/androidTest/java/androidx/ui/text/TextLayoutResultIntegrationTest.kt b/ui/ui-text-core/src/androidTest/java/androidx/ui/text/TextLayoutResultIntegrationTest.kt
index 4bfd686..9052592 100644
--- a/ui/ui-text-core/src/androidTest/java/androidx/ui/text/TextLayoutResultIntegrationTest.kt
+++ b/ui/ui-text-core/src/androidTest/java/androidx/ui/text/TextLayoutResultIntegrationTest.kt
@@ -27,7 +27,6 @@
import androidx.ui.unit.Density
import androidx.ui.unit.PxPosition
import androidx.ui.unit.ipx
-import androidx.ui.unit.px
import androidx.ui.unit.sp
import com.google.common.truth.Truth.assertThat
import org.junit.Test
@@ -160,7 +159,7 @@
val layoutResult = textDelegate.layout(Constraints(), layoutDirection)
val selection = layoutResult.getOffsetForPosition(
- position = PxPosition((fontSize.toPx() * characterIndex + 1).px, 0.px)
+ position = PxPosition((fontSize.toPx() * characterIndex + 1), 0f)
)
assertThat(selection).isEqualTo(characterIndex)
diff --git a/ui/ui-text-core/src/main/java/androidx/ui/text/MultiParagraph.kt b/ui/ui-text-core/src/main/java/androidx/ui/text/MultiParagraph.kt
index 72a854c..ebe528c 100644
--- a/ui/ui-text-core/src/main/java/androidx/ui/text/MultiParagraph.kt
+++ b/ui/ui-text-core/src/main/java/androidx/ui/text/MultiParagraph.kt
@@ -268,9 +268,9 @@
/** Returns the character offset closest to the given graphical position. */
fun getOffsetForPosition(position: PxPosition): Int {
val paragraphIndex = when {
- position.y.value <= 0f -> 0
- position.y.value >= height -> paragraphInfoList.lastIndex
- else -> findParagraphByY(paragraphInfoList, position.y.value)
+ position.y <= 0f -> 0
+ position.y >= height -> paragraphInfoList.lastIndex
+ else -> findParagraphByY(paragraphInfoList, position.y)
}
return with(paragraphInfoList[paragraphIndex]) {
if (length == 0) {
@@ -698,7 +698,7 @@
* relative to the [paragraph].
*/
fun PxPosition.toLocal(): PxPosition {
- return PxPosition(x = x.value, y = y.value - top)
+ return PxPosition(x = x, y = y - top)
}
/**
diff --git a/ui/ui-text-core/src/main/java/androidx/ui/text/platform/AndroidParagraph.kt b/ui/ui-text-core/src/main/java/androidx/ui/text/platform/AndroidParagraph.kt
index c9354fd..7da4b28 100644
--- a/ui/ui-text-core/src/main/java/androidx/ui/text/platform/AndroidParagraph.kt
+++ b/ui/ui-text-core/src/main/java/androidx/ui/text/platform/AndroidParagraph.kt
@@ -206,8 +206,8 @@
get() = paragraphIntrinsics.textPaint
override fun getOffsetForPosition(position: PxPosition): Int {
- val line = layout.getLineForVertical(position.y.value.toInt())
- return layout.getOffsetForHorizontal(line, position.x.value)
+ val line = layout.getLineForVertical(position.y.toInt())
+ return layout.getOffsetForHorizontal(line, position.x)
}
/**
diff --git a/ui/ui-text/src/androidTest/java/androidx/ui/text/selection/TextSelectionDelegateTest.kt b/ui/ui-text/src/androidTest/java/androidx/ui/text/selection/TextSelectionDelegateTest.kt
index 9e60b83..da8b09f 100644
--- a/ui/ui-text/src/androidTest/java/androidx/ui/text/selection/TextSelectionDelegateTest.kt
+++ b/ui/ui-text/src/androidTest/java/androidx/ui/text/selection/TextSelectionDelegateTest.kt
@@ -44,7 +44,6 @@
import androidx.ui.unit.Density
import androidx.ui.unit.PxPosition
import androidx.ui.unit.TextUnit
-import androidx.ui.unit.px
import androidx.ui.unit.sp
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.mock
@@ -233,7 +232,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * startOffset).px, fontSizeInPx.px)
+ PxPosition((fontSizeInPx * startOffset), fontSizeInPx)
)
}
}
@@ -287,7 +286,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * startOffset).px, fontSizeInPx.px)
+ PxPosition((fontSizeInPx * startOffset), fontSizeInPx)
)
}
}
@@ -341,7 +340,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * (text.length - 1 - startOffset)).px, fontSizeInPx.px)
+ PxPosition((fontSizeInPx * (text.length - 1 - startOffset)), fontSizeInPx)
)
}
}
@@ -395,7 +394,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * (text.length - 1 - startOffset)).px, fontSizeInPx.px)
+ PxPosition((fontSizeInPx * (text.length - 1 - startOffset)), fontSizeInPx)
)
}
}
@@ -451,7 +450,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * (text.length)).px, fontSizeInPx.px)
+ PxPosition((fontSizeInPx * (text.length)), fontSizeInPx)
)
}
}
@@ -507,7 +506,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * (textLtr.length)).px, fontSizeInPx.px)
+ PxPosition((fontSizeInPx * (textLtr.length)), fontSizeInPx)
)
}
}
@@ -561,7 +560,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * endOffset).px, fontSizeInPx.px)
+ PxPosition((fontSizeInPx * endOffset), fontSizeInPx)
)
}
}
@@ -615,7 +614,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * endOffset).px, fontSizeInPx.px)
+ PxPosition((fontSizeInPx * endOffset), fontSizeInPx)
)
}
}
@@ -669,7 +668,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * (text.length - 1 - endOffset)).px, fontSizeInPx.px)
+ PxPosition((fontSizeInPx * (text.length - 1 - endOffset)), fontSizeInPx)
)
}
}
@@ -723,7 +722,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * (text.length - 1 - endOffset)).px, fontSizeInPx.px)
+ PxPosition((fontSizeInPx * (text.length - 1 - endOffset)), fontSizeInPx)
)
}
}
@@ -779,7 +778,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * (textLtr.length)).px, fontSizeInPx.px)
+ PxPosition((fontSizeInPx * (textLtr.length)), fontSizeInPx)
)
}
}
@@ -835,7 +834,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * (text.length)).px, fontSizeInPx.px)
+ PxPosition((fontSizeInPx * (text.length)), fontSizeInPx)
)
}
}
@@ -1010,7 +1009,7 @@
density = defaultDensity
)
- val start = PxPosition((fontSizeInPx * 2).px, (fontSizeInPx / 2).px)
+ val start = PxPosition((fontSizeInPx * 2), (fontSizeInPx / 2))
val end = start
// Act.
@@ -1049,7 +1048,7 @@
density = defaultDensity
)
- val start = PxPosition((fontSizeInPx * 2).px, (fontSizeInPx / 2).px)
+ val start = PxPosition((fontSizeInPx * 2), (fontSizeInPx / 2))
val end = start
// Act.
@@ -1090,8 +1089,8 @@
val rawStartOffset = text.indexOf('e')
val rawEndOffset = text.indexOf('r')
- val start = PxPosition((fontSizeInPx * rawStartOffset).px, (fontSizeInPx / 2).px)
- val end = PxPosition((fontSizeInPx * rawEndOffset).px, (fontSizeInPx / 2).px)
+ val start = PxPosition((fontSizeInPx * rawStartOffset), (fontSizeInPx / 2))
+ val end = PxPosition((fontSizeInPx * rawEndOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1133,8 +1132,8 @@
val rawStartOffset = text.indexOf('r')
val rawEndOffset = text.indexOf('e')
- val start = PxPosition((fontSizeInPx * rawStartOffset).px, (fontSizeInPx / 2).px)
- val end = PxPosition((fontSizeInPx * rawEndOffset).px, (fontSizeInPx / 2).px)
+ val start = PxPosition((fontSizeInPx * rawStartOffset), (fontSizeInPx / 2))
+ val end = PxPosition((fontSizeInPx * rawEndOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1178,8 +1177,8 @@
// "llo wor" is selected.
val startOffset = text.indexOf("l")
val endOffset = text.indexOf("r") + 1
- val start = PxPosition((fontSizeInPx * startOffset).px, (fontSizeInPx / 2).px)
- val end = PxPosition((fontSizeInPx * endOffset).px, (fontSizeInPx / 2).px)
+ val start = PxPosition((fontSizeInPx * startOffset), (fontSizeInPx / 2))
+ val end = PxPosition((fontSizeInPx * endOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1223,12 +1222,12 @@
val startOffset = text.indexOf("\u05D1")
val endOffset = text.indexOf("\u05D3") + 1
val start = PxPosition(
- (fontSizeInPx * (text.length - 1 - startOffset)).px,
- (fontSizeInPx / 2).px
+ (fontSizeInPx * (text.length - 1 - startOffset)),
+ (fontSizeInPx / 2)
)
val end = PxPosition(
- (fontSizeInPx * (text.length - 1 - endOffset)).px,
- (fontSizeInPx / 2).px
+ (fontSizeInPx * (text.length - 1 - endOffset)),
+ (fontSizeInPx / 2)
)
// Act.
@@ -1275,12 +1274,12 @@
val startOffset = text.indexOf("l")
val endOffset = text.indexOf("\u05D2") + 1
val start = PxPosition(
- (fontSizeInPx * startOffset).px,
- (fontSizeInPx / 2).px
+ (fontSizeInPx * startOffset),
+ (fontSizeInPx / 2)
)
val end = PxPosition(
- (fontSizeInPx * (textLtr.length + text.length - endOffset)).px,
- (fontSizeInPx / 2).px
+ (fontSizeInPx * (textLtr.length + text.length - endOffset)),
+ (fontSizeInPx / 2)
)
// Act.
@@ -1322,8 +1321,8 @@
// "llo wor" is selected.
val startOffset = text.indexOf("r") + 1
val endOffset = text.indexOf("l")
- val start = PxPosition((fontSizeInPx * startOffset).px, (fontSizeInPx / 2).px)
- val end = PxPosition((fontSizeInPx * endOffset).px, (fontSizeInPx / 2).px)
+ val start = PxPosition((fontSizeInPx * startOffset), (fontSizeInPx / 2))
+ val end = PxPosition((fontSizeInPx * endOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
selectionCoordinates = Pair(start, end),
@@ -1364,12 +1363,12 @@
val startOffset = text.indexOf("\u05D3") + 1
val endOffset = text.indexOf("\u05D1")
val start = PxPosition(
- (fontSizeInPx * (text.length - 1 - startOffset)).px,
- (fontSizeInPx / 2).px
+ (fontSizeInPx * (text.length - 1 - startOffset)),
+ (fontSizeInPx / 2)
)
val end = PxPosition(
- (fontSizeInPx * (text.length - 1 - endOffset)).px,
- (fontSizeInPx / 2).px
+ (fontSizeInPx * (text.length - 1 - endOffset)),
+ (fontSizeInPx / 2)
)
// Act.
@@ -1414,12 +1413,12 @@
val startOffset = text.indexOf("\u05D2") + 1
val endOffset = text.indexOf("l")
val start = PxPosition(
- (fontSizeInPx * (textLtr.length + text.length - startOffset)).px,
- (fontSizeInPx / 2).px
+ (fontSizeInPx * (textLtr.length + text.length - startOffset)),
+ (fontSizeInPx / 2)
)
val end = PxPosition(
- (fontSizeInPx * endOffset).px,
- (fontSizeInPx / 2).px
+ (fontSizeInPx * endOffset),
+ (fontSizeInPx / 2)
)
// Act.
@@ -1476,8 +1475,8 @@
handlesCrossed = false
)
// "l" is selected.
- val start = PxPosition((fontSizeInPx * oldStartOffset).px, (fontSizeInPx / 2).px)
- val end = PxPosition((fontSizeInPx * oldStartOffset).px, (fontSizeInPx / 2).px)
+ val start = PxPosition((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
+ val end = PxPosition((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1533,12 +1532,12 @@
)
// "\u05D1" is selected.
val start = PxPosition(
- (fontSizeInPx * (text.length - 1 - oldStartOffset)).px,
- (fontSizeInPx / 2).px
+ (fontSizeInPx * (text.length - 1 - oldStartOffset)),
+ (fontSizeInPx / 2)
)
val end = PxPosition(
- (fontSizeInPx * (text.length - 1 - oldStartOffset)).px,
- (fontSizeInPx / 2).px
+ (fontSizeInPx * (text.length - 1 - oldStartOffset)),
+ (fontSizeInPx / 2)
)
// Act.
@@ -1594,8 +1593,8 @@
handlesCrossed = false
)
// The Space after "o" is selected.
- val start = PxPosition((fontSizeInPx * oldEndOffset).px, (fontSizeInPx / 2).px)
- val end = PxPosition((fontSizeInPx * oldEndOffset).px, (fontSizeInPx / 2).px)
+ val start = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
+ val end = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1651,8 +1650,8 @@
handlesCrossed = true
)
// "l" is selected.
- val start = PxPosition((fontSizeInPx * oldEndOffset).px, (fontSizeInPx / 2).px)
- val end = PxPosition((fontSizeInPx * oldEndOffset).px, (fontSizeInPx / 2).px)
+ val start = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
+ val end = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1708,8 +1707,8 @@
handlesCrossed = false
)
// "e" should be selected.
- val start = PxPosition((fontSizeInPx * oldEndOffset).px, (fontSizeInPx / 2).px)
- val end = PxPosition((fontSizeInPx * oldEndOffset).px, (fontSizeInPx / 2).px)
+ val start = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
+ val end = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1755,8 +1754,8 @@
handlesCrossed = true
)
// "e" should be selected.
- val start = PxPosition((fontSizeInPx * oldEndOffset).px, (fontSizeInPx / 2).px)
- val end = PxPosition((fontSizeInPx * oldEndOffset).px, (fontSizeInPx / 2).px)
+ val start = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
+ val end = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1802,10 +1801,10 @@
handlesCrossed = false
)
// "d" should be selected.
- val start = PxPosition((fontSizeInPx * oldEndOffset).px - (fontSizeInPx / 2).px,
- (fontSizeInPx / 2).px)
- val end = PxPosition((fontSizeInPx * oldEndOffset).px - 1.px,
- (fontSizeInPx / 2).px)
+ val start = PxPosition((fontSizeInPx * oldEndOffset) - (fontSizeInPx / 2),
+ (fontSizeInPx / 2))
+ val end = PxPosition((fontSizeInPx * oldEndOffset) - 1,
+ (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1851,8 +1850,8 @@
handlesCrossed = true
)
// "e" should be selected.
- val start = PxPosition((fontSizeInPx * oldEndOffset).px, (fontSizeInPx / 2).px)
- val end = PxPosition((fontSizeInPx * oldEndOffset).px, (fontSizeInPx / 2).px)
+ val start = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
+ val end = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1898,8 +1897,8 @@
handlesCrossed = true
)
// The space after "o" is selected.
- val start = PxPosition((fontSizeInPx * oldStartOffset).px, (fontSizeInPx / 2).px)
- val end = PxPosition((fontSizeInPx * oldStartOffset).px, (fontSizeInPx / 2).px)
+ val start = PxPosition((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
+ val end = PxPosition((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1955,8 +1954,8 @@
handlesCrossed = false
)
// "e" should be selected.
- val start = PxPosition((fontSizeInPx * oldStartOffset).px, (fontSizeInPx / 2).px)
- val end = PxPosition((fontSizeInPx * oldStartOffset).px, (fontSizeInPx / 2).px)
+ val start = PxPosition((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
+ val end = PxPosition((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -2002,8 +2001,8 @@
handlesCrossed = true
)
// "e" should be selected.
- val start = PxPosition((fontSizeInPx * oldStartOffset).px, (fontSizeInPx / 2).px)
- val end = PxPosition((fontSizeInPx * oldStartOffset).px, (fontSizeInPx / 2).px)
+ val start = PxPosition((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
+ val end = PxPosition((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -2049,10 +2048,10 @@
handlesCrossed = false
)
// "h" should be selected.
- val start = PxPosition((fontSizeInPx * oldStartOffset).px,
- (fontSizeInPx / 2).px)
- val end = PxPosition((fontSizeInPx * oldStartOffset).px,
- (fontSizeInPx / 2).px)
+ val start = PxPosition((fontSizeInPx * oldStartOffset),
+ (fontSizeInPx / 2))
+ val end = PxPosition((fontSizeInPx * oldStartOffset),
+ (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -2098,10 +2097,10 @@
handlesCrossed = true
)
// "d" should be selected.
- val start = PxPosition((fontSizeInPx * oldStartOffset).px - 1.px,
- (fontSizeInPx / 2).px)
- val end = PxPosition((fontSizeInPx * oldStartOffset).px - 1.px,
- (fontSizeInPx / 2).px)
+ val start = PxPosition((fontSizeInPx * oldStartOffset) - 1,
+ (fontSizeInPx / 2))
+ val end = PxPosition((fontSizeInPx * oldStartOffset) - 1,
+ (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -2131,8 +2130,8 @@
)
// "hello w" is selected.
val endOffset = text.indexOf("w") + 1
- val start = PxPosition(-50.px, -50.px)
- val end = PxPosition((fontSizeInPx * endOffset).px, (fontSizeInPx / 2).px)
+ val start = PxPosition(-50f, -50f)
+ val end = PxPosition((fontSizeInPx * endOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -2171,9 +2170,9 @@
)
// "o world" is selected.
val startOffset = text.indexOf("o")
- val start = PxPosition((fontSizeInPx * startOffset).px, (fontSizeInPx / 2).px)
- val end = PxPosition((fontSizeInPx * text.length * 2).px, (fontSizeInPx * 2)
- .px)
+ val start = PxPosition((fontSizeInPx * startOffset), (fontSizeInPx / 2))
+ val end = PxPosition((fontSizeInPx * text.length * 2), (fontSizeInPx * 2)
+ )
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -2213,8 +2212,8 @@
// "world" is selected.
val endOffset = text.indexOf("w")
val start =
- PxPosition((fontSizeInPx * text.length * 2).px, (fontSizeInPx * 2).px)
- val end = PxPosition((fontSizeInPx * endOffset).px, (fontSizeInPx / 2).px)
+ PxPosition((fontSizeInPx * text.length * 2), (fontSizeInPx * 2))
+ val end = PxPosition((fontSizeInPx * endOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -2255,8 +2254,8 @@
// "hell" is selected.
val startOffset = text.indexOf("o")
val start =
- PxPosition((fontSizeInPx * startOffset).px, (fontSizeInPx / 2).px)
- val end = PxPosition(-50.px, -50.px)
+ PxPosition((fontSizeInPx * startOffset), (fontSizeInPx / 2))
+ val end = PxPosition(-50f, -50f)
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -2293,8 +2292,8 @@
fontSize = fontSize,
density = defaultDensity
)
- val start = PxPosition(-50.px, -50.px)
- val end = PxPosition(-20.px, -20.px)
+ val start = PxPosition(-50f, -50f)
+ val end = PxPosition(-20f, -20f)
// Act.
val textSelectionInfo = getTextSelectionInfo(
selectionCoordinates = Pair(start, end),
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/CoreText.kt b/ui/ui-text/src/main/java/androidx/ui/text/CoreText.kt
index aa879aa..d5e5ccf 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/CoreText.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/CoreText.kt
@@ -47,7 +47,6 @@
import androidx.ui.unit.ipx
import androidx.ui.unit.max
import androidx.ui.unit.min
-import androidx.ui.unit.px
import androidx.ui.util.fastForEach
import kotlin.math.floor
import kotlin.math.roundToInt
@@ -209,7 +208,7 @@
maxHeight = floor(it.height).toInt().ipx
)
),
- PxPosition(it.left.px, it.top.px)
+ PxPosition(it.left, it.top)
)
}
}
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/TextFieldDelegate.kt b/ui/ui-text/src/main/java/androidx/ui/text/TextFieldDelegate.kt
index 53f4185..e480ac7 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/TextFieldDelegate.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/TextFieldDelegate.kt
@@ -42,7 +42,6 @@
import androidx.ui.unit.IntPx
import androidx.ui.unit.PxPosition
import androidx.ui.unit.ipx
-import androidx.ui.unit.px
import kotlin.math.ceil
import kotlin.math.roundToInt
@@ -183,13 +182,13 @@
)
Rect(0f, 0f, 1.0f, lineHeightForEmptyText.value.toFloat())
}
- val globalLT = layoutCoordinates.localToRoot(PxPosition(bbox.left.px, bbox.top.px))
+ val globalLT = layoutCoordinates.localToRoot(PxPosition(bbox.left, bbox.top))
textInputService.notifyFocusedRect(
token,
Rect.fromLTWH(
- globalLT.x.value,
- globalLT.y.value,
+ globalLT.x,
+ globalLT.y,
bbox.width,
bbox.height
)
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/selection/SelectionMode.kt b/ui/ui-text/src/main/java/androidx/ui/text/selection/SelectionMode.kt
index c726621..11a5626 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/selection/SelectionMode.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/selection/SelectionMode.kt
@@ -36,19 +36,19 @@
): Boolean {
// When the end of the selection is above the top of the composable, the composable is outside
// of the selection range.
- if (end.y.value < bounds.top) return false
+ if (end.y < bounds.top) return false
// When the end of the selection is on the left of the composable, and not below the bottom
// of composable, the composable is outside of the selection range.
- if (end.x.value < bounds.left && end.y.value < bounds.bottom) return false
+ if (end.x < bounds.left && end.y < bounds.bottom) return false
// When the start of the selection is below the bottom of the composable, the composable is
// outside of the selection range.
- if (start.y.value >= bounds.bottom) return false
+ if (start.y >= bounds.bottom) return false
// When the start of the selection is on the right of the composable, and not above the top
// of the composable, the composable is outside of the selection range.
- if (start.x.value >= bounds.right && start.y.value >= bounds.top) return false
+ if (start.x >= bounds.right && start.y >= bounds.top) return false
return true
}
@@ -58,8 +58,8 @@
start: PxPosition,
end: PxPosition
): Boolean {
- if (start.y.value >= bounds.top && start.y.value < bounds.bottom &&
- end.y.value >= bounds.top && end.y.value < bounds.bottom
+ if (start.y >= bounds.top && start.y < bounds.bottom &&
+ end.y >= bounds.top && end.y < bounds.bottom
) {
// When the start and end of the selection are in the same row of widgets, check if
// x coordinates of the start and end are crossed each other.
@@ -85,19 +85,19 @@
): Boolean {
// When the end of the selection is on the left of the composable, the composable is outside of
// the selection range.
- if (end.x.value < bounds.left) return false
+ if (end.x < bounds.left) return false
// When the end of the selection is on the top of the composable, and the not on the right
// of the composable, the composable is outside of the selection range.
- if (end.y.value < bounds.top && end.x.value < bounds.right) return false
+ if (end.y < bounds.top && end.x < bounds.right) return false
// When the start of the selection is on the right of the composable, the composable is outside
// of the selection range.
- if (start.x.value >= bounds.right) return false
+ if (start.x >= bounds.right) return false
// When the start of the selection is below the composable, and not on the left of the
// composable, the composable is outside of the selection range.
- if (start.y.value >= bounds.bottom && start.x.value >= bounds.left) return false
+ if (start.y >= bounds.bottom && start.x >= bounds.left) return false
return true
}
@@ -107,8 +107,8 @@
start: PxPosition,
end: PxPosition
): Boolean {
- if (start.x.value >= bounds.left && start.x.value < bounds.right &&
- end.x.value >= bounds.left && end.x.value < bounds.right
+ if (start.x >= bounds.left && start.x < bounds.right &&
+ end.x >= bounds.left && end.x < bounds.right
) {
// When the start and end of the selection are in the same column of widgets,
// check if y coordinates of the start and end are crossed each other.
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/selection/TextSelectionDelegate.kt b/ui/ui-text/src/main/java/androidx/ui/text/selection/TextSelectionDelegate.kt
index 0a7e678..b944012 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/selection/TextSelectionDelegate.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/selection/TextSelectionDelegate.kt
@@ -145,10 +145,10 @@
val lastOffset = textLayoutResult.layoutInput.text.text.length
val containsWholeSelectionStart =
- bounds.contains(Offset(startPosition.x.value, startPosition.y.value))
+ bounds.contains(Offset(startPosition.x, startPosition.y))
val containsWholeSelectionEnd =
- bounds.contains(Offset(endPosition.x.value, endPosition.y.value))
+ bounds.contains(Offset(endPosition.x, endPosition.y))
val rawStartOffset =
if (containsWholeSelectionStart)
diff --git a/ui/ui-text/src/test/java/androidx/ui/text/DragEventTrackerTest.kt b/ui/ui-text/src/test/java/androidx/ui/text/DragEventTrackerTest.kt
index 49fffd3..80cabf9 100644
--- a/ui/ui-text/src/test/java/androidx/ui/text/DragEventTrackerTest.kt
+++ b/ui/ui-text/src/test/java/androidx/ui/text/DragEventTrackerTest.kt
@@ -17,7 +17,6 @@
package androidx.ui.text
import androidx.ui.unit.PxPosition
-import androidx.ui.unit.px
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
@@ -29,38 +28,38 @@
fun test_not_moving() {
val tracker = DragEventTracker()
- tracker.init(PxPosition(10.px, 20.px))
- assertEquals(PxPosition(10.px, 20.px), tracker.getPosition())
+ tracker.init(PxPosition(10f, 20f))
+ assertEquals(PxPosition(10f, 20f), tracker.getPosition())
}
@Test
fun test_drag_one_distance() {
val tracker = DragEventTracker()
- tracker.init(PxPosition(10.px, 20.px))
- tracker.onDrag(PxPosition(30.px, 40.px))
- assertEquals(PxPosition(40.px, 60.px), tracker.getPosition())
+ tracker.init(PxPosition(10f, 20f))
+ tracker.onDrag(PxPosition(30f, 40f))
+ assertEquals(PxPosition(40f, 60f), tracker.getPosition())
}
@Test
fun test_drag_two_distance() {
val tracker = DragEventTracker()
- tracker.init(PxPosition(10.px, 20.px))
- tracker.onDrag(PxPosition(30.px, 40.px))
- tracker.onDrag(PxPosition(50.px, 60.px))
- assertEquals(PxPosition(60.px, 80.px), tracker.getPosition())
+ tracker.init(PxPosition(10f, 20f))
+ tracker.onDrag(PxPosition(30f, 40f))
+ tracker.onDrag(PxPosition(50f, 60f))
+ assertEquals(PxPosition(60f, 80f), tracker.getPosition())
}
@Test
fun test_drag_twice() {
val tracker = DragEventTracker()
- tracker.init(PxPosition(10.px, 20.px))
- tracker.onDrag(PxPosition(30.px, 40.px))
+ tracker.init(PxPosition(10f, 20f))
+ tracker.onDrag(PxPosition(30f, 40f))
- tracker.init(PxPosition(50.px, 60.px))
- tracker.onDrag(PxPosition(70.px, 80.px))
- assertEquals(PxPosition(120.px, 140.px), tracker.getPosition())
+ tracker.init(PxPosition(50f, 60f))
+ tracker.onDrag(PxPosition(70f, 80f))
+ assertEquals(PxPosition(120f, 140f), tracker.getPosition())
}
}
\ No newline at end of file
diff --git a/ui/ui-text/src/test/java/androidx/ui/text/TextFieldDelegateTest.kt b/ui/ui-text/src/test/java/androidx/ui/text/TextFieldDelegateTest.kt
index 476a826..606a496 100644
--- a/ui/ui-text/src/test/java/androidx/ui/text/TextFieldDelegateTest.kt
+++ b/ui/ui-text/src/test/java/androidx/ui/text/TextFieldDelegateTest.kt
@@ -112,7 +112,7 @@
@Test
fun test_on_release() {
- val position = PxPosition(100.px, 200.px)
+ val position = PxPosition(100f, 200f)
val offset = 10
val dummyEditorState = EditorValue(text = "Hello, World", selection = TextRange(1, 1))
val dummyInputSessionToken = 10 // We are not using this value in this test. Just dummy.
@@ -147,7 +147,7 @@
@Test
fun test_on_release_do_not_place_cursor_if_focus_is_out() {
- val position = PxPosition(100.px, 200.px)
+ val position = PxPosition(100f, 200f)
val offset = 10
val dummyInputSessionToken = 10 // We are not using this value in this test. Just dummy.
@@ -231,7 +231,7 @@
fun notify_focused_rect() {
val dummyRect = Rect(0f, 1f, 2f, 3f)
whenever(textLayoutResult.getBoundingBox(any())).thenReturn(dummyRect)
- val dummyPoint = PxPosition(5.px, 6.px)
+ val dummyPoint = PxPosition(5f, 6f)
whenever(layoutCoordinates.localToRoot(any())).thenReturn(dummyPoint)
val dummyEditorState = EditorValue(text = "Hello, World", selection = TextRange(1, 1))
val dummyInputSessionToken = 10 // We are not using this value in this test. Just dummy.
@@ -269,7 +269,7 @@
fun notify_rect_tail() {
val dummyRect = Rect(0f, 1f, 2f, 3f)
whenever(textLayoutResult.getBoundingBox(any())).thenReturn(dummyRect)
- val dummyPoint = PxPosition(5.px, 6.px)
+ val dummyPoint = PxPosition(5f, 6f)
whenever(layoutCoordinates.localToRoot(any())).thenReturn(dummyPoint)
val dummyEditorState = EditorValue(text = "Hello, World", selection = TextRange(12, 12))
val dummyInputSessionToken = 10 // We are not using this value in this test. Just dummy.
@@ -316,7 +316,7 @@
@Test
fun check_notify_rect_uses_offset_map() {
val dummyRect = Rect(0f, 1f, 2f, 3f)
- val dummyPoint = PxPosition(5.px, 6.px)
+ val dummyPoint = PxPosition(5f, 6f)
val dummyEditorState = EditorValue(text = "Hello, World", selection = TextRange(1, 3))
val dummyInputSessionToken = 10 // We are not using this value in this test. Just dummy.
whenever(textLayoutResult.getBoundingBox(any())).thenReturn(dummyRect)
@@ -338,7 +338,7 @@
@Test
fun check_on_release_uses_offset_map() {
- val position = PxPosition(100.px, 200.px)
+ val position = PxPosition(100f, 200f)
val offset = 10
val dummyEditorState = EditorValue(text = "Hello, World", selection = TextRange(1, 1))
val dummyInputSessionToken = 10 // We are not using this value in this test. Just dummy.
diff --git a/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/ModifierInfoTest.kt b/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/ModifierInfoTest.kt
index 790ad32..e9d9588 100644
--- a/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/ModifierInfoTest.kt
+++ b/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/ModifierInfoTest.kt
@@ -31,7 +31,6 @@
import androidx.ui.layout.Column
import androidx.ui.layout.padding
import androidx.ui.layout.size
-import androidx.ui.unit.px
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
@@ -50,8 +49,8 @@
show {
Inspectable(slotTableRecord) {
with(DensityAmbient.current) {
- val px10 = 10.px.toDp()
- val px5 = 5.px.toDp()
+ val px10 = 10f.toDp()
+ val px5 = 5f.toDp()
Box {
Column(Modifier.padding(px10).drawLayer().drawBackground(Color.Blue)) {
Box(Modifier.padding(px5).size(px5))
@@ -80,13 +79,13 @@
assertEquals(2, boxModifierInfo.size)
assertTrue("Box should only have LayoutModifiers, but the first was " +
"${boxModifierInfo[0].modifier}", boxModifierInfo[0].modifier is LayoutModifier)
- assertEquals(10.px, boxModifierInfo[0].coordinates.positionInRoot.x)
+ assertEquals(10f, boxModifierInfo[0].coordinates.positionInRoot.x)
assertTrue("Box should only have LayoutModifiers, but the second was " +
"${boxModifierInfo[1].modifier}",
boxModifierInfo[1].modifier is LayoutModifier
)
- assertEquals(15.px, boxModifierInfo[1].coordinates.positionInRoot.x)
+ assertEquals(15f, boxModifierInfo[1].coordinates.positionInRoot.x)
val columnModifierInfo = modifierInfo[1]
assertEquals(3, columnModifierInfo.size)
@@ -95,20 +94,20 @@
"but was ${columnModifierInfo[0].modifier}",
columnModifierInfo[0].modifier is LayoutModifier
)
- assertEquals(0.px, columnModifierInfo[0].coordinates.positionInRoot.x)
+ assertEquals(0f, columnModifierInfo[0].coordinates.positionInRoot.x)
assertTrue(
"The second modifier in the column should be a DrawLayerModifier" +
"but was ${columnModifierInfo[1].modifier}",
columnModifierInfo[1].modifier is DrawLayerModifier
)
assertTrue(columnModifierInfo[1].extra is OwnedLayer)
- assertEquals(10.px, columnModifierInfo[1].coordinates.positionInRoot.x)
+ assertEquals(10f, columnModifierInfo[1].coordinates.positionInRoot.x)
assertTrue(
"The third modifier in the column should be a DrawModifier" +
"but was ${columnModifierInfo[2].modifier}",
columnModifierInfo[2].modifier is DrawModifier
)
- assertEquals(10.px, columnModifierInfo[2].coordinates.positionInRoot.x)
+ assertEquals(10f, columnModifierInfo[2].coordinates.positionInRoot.x)
}
}
}
\ No newline at end of file
diff --git a/ui/ui-tooling/src/main/java/androidx/ui/tooling/SlotTree.kt b/ui/ui-tooling/src/main/java/androidx/ui/tooling/SlotTree.kt
index ad408c2..a2fedcb 100644
--- a/ui/ui-tooling/src/main/java/androidx/ui/tooling/SlotTree.kt
+++ b/ui/ui-tooling/src/main/java/androidx/ui/tooling/SlotTree.kt
@@ -29,8 +29,8 @@
import androidx.ui.unit.ipx
import androidx.ui.unit.max
import androidx.ui.unit.min
-import androidx.ui.unit.round
import java.lang.reflect.Field
+import kotlin.math.roundToInt
/**
* A group in the slot table. Represents either a call or an emitted node.
@@ -180,8 +180,8 @@
}
val position = node.coordinates.globalPosition
val size = node.coordinates.size
- val left = position.x.round()
- val top = position.y.round()
+ val left = position.x.roundToInt().ipx
+ val top = position.y.roundToInt().ipx
val right = left + size.width
val bottom = top + size.height
return IntPxBounds(left = left, top = top, right = right, bottom = bottom)
diff --git a/ui/ui-unit/api/0.1.0-dev14.txt b/ui/ui-unit/api/0.1.0-dev14.txt
index 68a02a8..2b523bc 100644
--- a/ui/ui-unit/api/0.1.0-dev14.txt
+++ b/ui/ui-unit/api/0.1.0-dev14.txt
@@ -512,7 +512,6 @@
public final class PxKt {
method @androidx.compose.Stable public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.unit.PxPosition topLeft, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition(float x, float y);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition-qHcltEY(float x, float y);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize(float width, float height);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize-qHcltEY(float width, float height);
method @androidx.compose.Stable public static inline float abs-NgWp0Z8(float x);
diff --git a/ui/ui-unit/api/current.txt b/ui/ui-unit/api/current.txt
index 68a02a8..2b523bc 100644
--- a/ui/ui-unit/api/current.txt
+++ b/ui/ui-unit/api/current.txt
@@ -512,7 +512,6 @@
public final class PxKt {
method @androidx.compose.Stable public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.unit.PxPosition topLeft, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition(float x, float y);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition-qHcltEY(float x, float y);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize(float width, float height);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize-qHcltEY(float width, float height);
method @androidx.compose.Stable public static inline float abs-NgWp0Z8(float x);
diff --git a/ui/ui-unit/api/public_plus_experimental_0.1.0-dev14.txt b/ui/ui-unit/api/public_plus_experimental_0.1.0-dev14.txt
index 68a02a8..2b523bc 100644
--- a/ui/ui-unit/api/public_plus_experimental_0.1.0-dev14.txt
+++ b/ui/ui-unit/api/public_plus_experimental_0.1.0-dev14.txt
@@ -512,7 +512,6 @@
public final class PxKt {
method @androidx.compose.Stable public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.unit.PxPosition topLeft, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition(float x, float y);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition-qHcltEY(float x, float y);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize(float width, float height);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize-qHcltEY(float width, float height);
method @androidx.compose.Stable public static inline float abs-NgWp0Z8(float x);
diff --git a/ui/ui-unit/api/public_plus_experimental_current.txt b/ui/ui-unit/api/public_plus_experimental_current.txt
index 68a02a8..2b523bc 100644
--- a/ui/ui-unit/api/public_plus_experimental_current.txt
+++ b/ui/ui-unit/api/public_plus_experimental_current.txt
@@ -512,7 +512,6 @@
public final class PxKt {
method @androidx.compose.Stable public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.unit.PxPosition topLeft, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition(float x, float y);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition-qHcltEY(float x, float y);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize(float width, float height);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize-qHcltEY(float width, float height);
method @androidx.compose.Stable public static inline float abs-NgWp0Z8(float x);
diff --git a/ui/ui-unit/api/restricted_0.1.0-dev14.txt b/ui/ui-unit/api/restricted_0.1.0-dev14.txt
index 05db857..2addb31 100644
--- a/ui/ui-unit/api/restricted_0.1.0-dev14.txt
+++ b/ui/ui-unit/api/restricted_0.1.0-dev14.txt
@@ -516,7 +516,6 @@
public final class PxKt {
method @androidx.compose.Stable public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.unit.PxPosition topLeft, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition(float x, float y);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition-qHcltEY(float x, float y);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize(float width, float height);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize-qHcltEY(float width, float height);
method @androidx.compose.Stable public static inline float abs-NgWp0Z8(float x);
diff --git a/ui/ui-unit/api/restricted_current.txt b/ui/ui-unit/api/restricted_current.txt
index 05db857..2addb31 100644
--- a/ui/ui-unit/api/restricted_current.txt
+++ b/ui/ui-unit/api/restricted_current.txt
@@ -516,7 +516,6 @@
public final class PxKt {
method @androidx.compose.Stable public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.unit.PxPosition topLeft, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition(float x, float y);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition-qHcltEY(float x, float y);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize(float width, float height);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize-qHcltEY(float width, float height);
method @androidx.compose.Stable public static inline float abs-NgWp0Z8(float x);
diff --git a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/IntPx.kt b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/IntPx.kt
index 1f90884..293b4a8 100644
--- a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/IntPx.kt
+++ b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/IntPx.kt
@@ -471,7 +471,8 @@
* Create a [PxPosition] from [IntPx] values.
*/
@Stable
-inline fun PxPosition(x: IntPx, y: IntPx): PxPosition = PxPosition(x = x.toPx(), y = y.toPx())
+inline fun PxPosition(x: IntPx, y: IntPx): PxPosition =
+ PxPosition(x = x.toPx().value, y = y.toPx().value)
/**
* Convert a [IntPxPosition] to a [PxPosition]
diff --git a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Px.kt b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Px.kt
index 753049d..5826d71 100644
--- a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Px.kt
+++ b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Px.kt
@@ -28,6 +28,7 @@
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min
+import kotlin.math.roundToInt
import kotlin.math.sqrt
/**
@@ -604,7 +605,7 @@
*/
@Stable
fun PxSize.center(): PxPosition {
- return PxPosition(width / 2f, height / 2f)
+ return PxPosition(width.value / 2f, height.value / 2f)
}
/**
@@ -621,16 +622,14 @@
/**
* The horizontal aspect of the position in [Px]
*/
- @Stable
- inline val x: Px
- get() = unpackFloat1(value).px
+ inline val x: Float
+ get() = unpackFloat1(value)
/**
* The vertical aspect of the position in [Px]
*/
- @Stable
- inline val y: Px
- get() = unpackFloat2(value).px
+ inline val y: Float
+ get() = unpackFloat2(value)
/**
* Subtract a [PxPosition] from another one.
@@ -651,14 +650,14 @@
*/
@Stable
inline operator fun minus(other: IntPxPosition) =
- PxPosition(x - other.x, y - other.y)
+ PxPosition(x - other.x.value, y - other.y.value)
/**
* Add a [IntPxPosition] to this [PxPosition].
*/
@Stable
inline operator fun plus(other: IntPxPosition) =
- PxPosition(x + other.x, y + other.y)
+ PxPosition(x + other.x.value, y + other.y.value)
/**
* Returns a new PxPosition representing the negation of this point.
@@ -671,39 +670,33 @@
companion object {
@Stable
- val Origin = PxPosition(0.px, 0.px)
+ val Origin = PxPosition(0.0f, 0.0f)
}
}
/**
- * Constructs a [PxPosition] from [x] and [y] position float values.
+ * Constructs a [PxPosition] from [x] and [y] position pixel values.
*/
@Stable
inline fun PxPosition(x: Float, y: Float): PxPosition = PxPosition(packFloats(x, y))
/**
- * Constructs a [PxPosition] from [x] and [y] position [Px] values.
- */
-@Stable
-inline fun PxPosition(x: Px, y: Px): PxPosition = PxPosition(packFloats(x.value, y.value))
-
-/**
* The magnitude of the offset represented by this [PxPosition].
*/
@Stable
-fun PxPosition.getDistance(): Px = Px(sqrt(x.value * x.value + y.value * y.value))
+fun PxPosition.getDistance(): Px = Px(sqrt(x * x + y * y))
/**
* Convert a [PxPosition] to a [Offset].
*/
@Stable
-inline fun PxPosition.toOffset(): Offset = Offset(x.value, y.value)
+inline fun PxPosition.toOffset(): Offset = Offset(x, y)
/**
* Round a [PxPosition] down to the nearest [Int] coordinates.
*/
@Stable
-inline fun PxPosition.round(): IntPxPosition = IntPxPosition(x.round(), y.round())
+inline fun PxPosition.round(): IntPxPosition = IntPxPosition(x.roundToInt().ipx, y.roundToInt().ipx)
/**
* Linearly interpolate between two [PxPosition]s.
@@ -734,10 +727,10 @@
@Stable
inline fun PxBounds(topLeft: PxPosition, size: PxSize) =
PxBounds(
- left = topLeft.x,
- top = topLeft.y,
- right = topLeft.x + size.width,
- bottom = topLeft.y + size.height
+ left = topLeft.x.px,
+ top = topLeft.y.px,
+ right = topLeft.x.px + size.width,
+ bottom = topLeft.y.px + size.height
)
/**
@@ -757,7 +750,7 @@
*/
@Stable
inline fun PxBounds.center(): PxPosition {
- return PxPosition(left + width / 2f, top + height / 2f)
+ return PxPosition(left.value + width.value / 2f, top.value + height.value / 2f)
}
/**
diff --git a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Velocity.kt b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Velocity.kt
index b870169..d86fb0e 100644
--- a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Velocity.kt
+++ b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Velocity.kt
@@ -32,7 +32,7 @@
/**
* Velocity of 0 pixels per second in both x and y.
*/
- val Zero = Velocity(PxPosition(0.px, 0.px))
+ val Zero = Velocity(PxPosition(0f, 0f))
}
}
diff --git a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntPxTest.kt b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntPxTest.kt
index aeb48fe..9748b08 100644
--- a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntPxTest.kt
+++ b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntPxTest.kt
@@ -229,7 +229,7 @@
@Test
fun createPosition() {
- assertEquals(PxPosition(10.px, 20.px), PxPosition(10.ipx, 20.ipx))
+ assertEquals(PxPosition(10f, 20f), PxPosition(10.ipx, 20.ipx))
}
@Test
diff --git a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/PxTest.kt b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/PxTest.kt
index 19efa28..ed228ad 100644
--- a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/PxTest.kt
+++ b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/PxTest.kt
@@ -325,52 +325,52 @@
@Test
fun sizeCenter() {
val size = PxSize(width = 10.px, height = 20.px)
- assertEquals(PxPosition(5.px, 10.px), size.center())
+ assertEquals(PxPosition(5f, 10f), size.center())
}
@Test
fun positionDistance() {
- val position = PxPosition(3.px, 4.px)
+ val position = PxPosition(3f, 4f)
assertEquals(5.px, position.getDistance())
}
@Test
fun lerpPosition() {
- val a = PxPosition(3.px, 10.px)
- val b = PxPosition(5.px, 8.px)
- assertEquals(PxPosition(4.px, 9.px), lerp(a, b, 0.5f))
- assertEquals(PxPosition(3.px, 10.px), lerp(a, b, 0f))
- assertEquals(PxPosition(5.px, 8.px), lerp(a, b, 1f))
+ val a = PxPosition(3f, 10f)
+ val b = PxPosition(5f, 8f)
+ assertEquals(PxPosition(4f, 9f), lerp(a, b, 0.5f))
+ assertEquals(PxPosition(3f, 10f), lerp(a, b, 0f))
+ assertEquals(PxPosition(5f, 8f), lerp(a, b, 1f))
}
@Test
fun positionMinus() {
- val a = PxPosition(3.px, 10.px)
- val b = PxPosition(5.px, 8.px)
- assertEquals(PxPosition(-2.px, 2.px), a - b)
- assertEquals(PxPosition(2.px, -2.px), b - a)
+ val a = PxPosition(3f, 10f)
+ val b = PxPosition(5f, 8f)
+ assertEquals(PxPosition(-2f, 2f), a - b)
+ assertEquals(PxPosition(2f, -2f), b - a)
}
@Test
fun positionPlus() {
- val a = PxPosition(3.px, 10.px)
- val b = PxPosition(5.px, 8.px)
- assertEquals(PxPosition(8.px, 18.px), a + b)
- assertEquals(PxPosition(8.px, 18.px), b + a)
+ val a = PxPosition(3f, 10f)
+ val b = PxPosition(5f, 8f)
+ assertEquals(PxPosition(8f, 18f), a + b)
+ assertEquals(PxPosition(8f, 18f), b + a)
}
@Test
fun pxPositionMinusIntPxPosition() {
- val a = PxPosition(3.px, 10.px)
+ val a = PxPosition(3f, 10f)
val b = IntPxPosition(5.ipx, 8.ipx)
- assertEquals(PxPosition(-2.px, 2.px), a - b)
+ assertEquals(PxPosition(-2f, 2f), a - b)
}
@Test
fun pxPositionPlusIntPxPosition() {
- val a = PxPosition(3.px, 10.px)
+ val a = PxPosition(3f, 10f)
val b = IntPxPosition(5.ipx, 8.ipx)
- assertEquals(PxPosition(8.px, 18.px), a + b)
+ assertEquals(PxPosition(8f, 18f), a + b)
}
@Test
diff --git a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/VelocityTest.kt b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/VelocityTest.kt
index b4a3c9d..1775a0c 100644
--- a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/VelocityTest.kt
+++ b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/VelocityTest.kt
@@ -24,30 +24,30 @@
@RunWith(JUnit4::class)
class VelocityTest {
- private val velocity1 = Velocity(pixelsPerSecond = PxPosition(3.px, -7.px))
- private val velocity2 = Velocity(pixelsPerSecond = PxPosition(5.px, 13.px))
+ private val velocity1 = Velocity(pixelsPerSecond = PxPosition(3f, -7f))
+ private val velocity2 = Velocity(pixelsPerSecond = PxPosition(5f, 13f))
@Test
fun operatorUnaryMinus() {
Truth.assertThat(-velocity1)
- .isEqualTo(Velocity(pixelsPerSecond = PxPosition(-3.px, 7.px)))
+ .isEqualTo(Velocity(pixelsPerSecond = PxPosition(-3f, 7f)))
Truth.assertThat(-velocity2)
- .isEqualTo(Velocity(pixelsPerSecond = PxPosition(-5.px, (-13).px)))
+ .isEqualTo(Velocity(pixelsPerSecond = PxPosition(-5f, -13f)))
}
@Test
fun operatorPlus() {
Truth.assertThat(velocity2 + velocity1)
- .isEqualTo(Velocity(pixelsPerSecond = PxPosition(8.px, 6.px)))
+ .isEqualTo(Velocity(pixelsPerSecond = PxPosition(8f, 6f)))
Truth.assertThat(velocity1 + velocity2)
- .isEqualTo(Velocity(pixelsPerSecond = PxPosition(8.px, 6.px)))
+ .isEqualTo(Velocity(pixelsPerSecond = PxPosition(8f, 6f)))
}
@Test
fun operatorMinus() {
Truth.assertThat(velocity1 - velocity2)
- .isEqualTo(Velocity(pixelsPerSecond = PxPosition(-2.px, (-20).px)))
+ .isEqualTo(Velocity(pixelsPerSecond = PxPosition(-2f, -20f)))
Truth.assertThat(velocity2 - velocity1)
- .isEqualTo(Velocity(pixelsPerSecond = PxPosition(2.px, 20.px)))
+ .isEqualTo(Velocity(pixelsPerSecond = PxPosition(2f, 20f)))
}
}
\ No newline at end of file