mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Test was failing because on some devices a height of 30 is not enough for the text to be clipped Bug: 306179709 Test: DeleteDropTargetTest Flag: NONE Change-Id: Ie6e37ec9b2ccc83097ed74e70e6e5048bc6199a6
41 lines
1.2 KiB
Kotlin
41 lines
1.2 KiB
Kotlin
package com.android.launcher3
|
|
|
|
import android.content.Context
|
|
import androidx.test.core.app.ApplicationProvider.getApplicationContext
|
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
|
import androidx.test.filters.SmallTest
|
|
import com.android.launcher3.Utilities.*
|
|
import com.android.launcher3.util.ActivityContextWrapper
|
|
import com.google.common.truth.Truth.assertThat
|
|
import org.junit.Before
|
|
import org.junit.Test
|
|
import org.junit.runner.RunWith
|
|
|
|
@SmallTest
|
|
@RunWith(AndroidJUnit4::class)
|
|
class DeleteDropTargetTest {
|
|
|
|
private var mContext: Context = ActivityContextWrapper(getApplicationContext())
|
|
|
|
// Use a non-abstract class implementation
|
|
private var buttonDropTarget: DeleteDropTarget = DeleteDropTarget(mContext)
|
|
|
|
@Before
|
|
fun setup() {
|
|
enableRunningInTestHarnessForTests()
|
|
}
|
|
|
|
@Test
|
|
fun isTextClippedVerticallyTest() {
|
|
buttonDropTarget.updateText("My Test")
|
|
buttonDropTarget.setPadding(0, 0, 0, 0)
|
|
buttonDropTarget.setTextMultiLine(false)
|
|
|
|
// No space for text
|
|
assertThat(buttonDropTarget.isTextClippedVertically(1)).isTrue()
|
|
|
|
// A lot of space for text so the text should not be clipped
|
|
assertThat(buttonDropTarget.isTextClippedVertically(1000)).isFalse()
|
|
}
|
|
}
|