Files
Lawnchair/tests/src/com/android/launcher3/DeleteDropTargetTest.kt
T
Andrew Cole f9b87e3907 Updating isTextClippedVerticallyTest
Updating the isTextClippedVertically test to accomodate a different aspect ratio for raven devices

Bug: 279464742
Test: isTextClippedVerticallyTest
Change-Id: I4a4b740513914f1e76db18a00b65e4f881535d4a
2023-05-12 16:55:41 +00:00

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(30)).isTrue()
// A lot of space for text so the text should not be clipped
assertThat(buttonDropTarget.isTextClippedVertically(100)).isFalse()
}
}