1 package com.android.launcher3
2 
3 import android.content.Context
4 import androidx.test.core.app.ApplicationProvider.getApplicationContext
5 import androidx.test.ext.junit.runners.AndroidJUnit4
6 import androidx.test.filters.SmallTest
7 import com.android.launcher3.Utilities.*
8 import com.android.launcher3.util.ActivityContextWrapper
9 import com.google.common.truth.Truth.assertThat
10 import org.junit.Before
11 import org.junit.Test
12 import org.junit.runner.RunWith
13 
14 @SmallTest
15 @RunWith(AndroidJUnit4::class)
16 class DeleteDropTargetTest {
17 
18     private var mContext: Context = ActivityContextWrapper(getApplicationContext())
19 
20     // Use a non-abstract class implementation
21     private var buttonDropTarget: DeleteDropTarget = DeleteDropTarget(mContext)
22 
23     @Before
setupnull24     fun setup() {
25         enableRunningInTestHarnessForTests()
26     }
27 
28     @Test
isTextClippedVerticallyTestnull29     fun isTextClippedVerticallyTest() {
30         buttonDropTarget.updateText("My Test")
31         buttonDropTarget.setPadding(0, 0, 0, 0)
32         buttonDropTarget.setTextMultiLine(false)
33 
34         // No space for text
35         assertThat(buttonDropTarget.isTextClippedVertically(1)).isTrue()
36 
37         // A lot of space for text so the text should not be clipped
38         assertThat(buttonDropTarget.isTextClippedVertically(1000)).isFalse()
39     }
40 }
41