mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 07:46:01 +00:00
fix(input): keep reported insets unless they crowd out the pad
This commit is contained in:
1 parent
968828afbd
commit
885c4f0a44
2 files changed
+12
-5
No files matched your search
@@ -284,10 +284,11 @@ class KitLayoutTest {
|
||||
|
||||
@Test fun insetsThatLeaveLessRoomShrinkTheKitInsteadOfOverlappingIt() {
|
||||
for (kit in PadKit.entries) for ((w, h, safe) in listOf(Triple(1600, 900, Rect(0, 60, 0, 0)), Triple(1600, 900, Rect(0, 730, 0, 0)),
|
||||
Triple(1600, 900, Rect(0, 200, 0, 0)), Triple(1600, 900, Rect(0, 200, 0, 150)),
|
||||
Triple(1920, 1080, Rect(80, 120, 80, 90)), Triple(2400, 1080, Rect(120, 30, 60, 40)))) {
|
||||
val elements = KitLayout.elements(context, kit, w, h, safe)
|
||||
assertEquals("$kit $w x $h $safe", emptyList<Pair<String, String>>(), overlapping(elements, w, h))
|
||||
if (safe.top <= h / 6) for (e in elements) {
|
||||
if (safe.top + safe.bottom <= h * .4f) for (e in elements) {
|
||||
val (x, y, ew, eh) = px(e, w, h).toList()
|
||||
assertTrue("$kit $safe ${e.id}", x >= safe.left - .5f && y >= safe.top - .5f && x + ew <= w - safe.right + .5f && y + eh <= h - safe.bottom + .5f)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user