Files
lawnchair/tests/multivalentTests/src/com/android/launcher3/DeleteDropTargetTest.kt
Uwais Ashraf 784b4f28b0 Fix some compile errors occurring as a result of robo enablement
Fix: 297950111
Test: :NexusLauncher.Robo:testGoogleWithQuickstepDebugUnitTest
Test: atest NexusLauncherRoboTests
Flag: NA
Change-Id: Ic9b09fff630d274558d09b7031d12ec28f10fbc7
2024-05-21 18:56:52 +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(1)).isTrue()
// A lot of space for text so the text should not be clipped
assertThat(buttonDropTarget.isTextClippedVertically(1000)).isFalse()
}
}