Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/SingleLineViewInflaterTest.kt→packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/SingleLineViewInflaterTest.kt +20 −25 Original line number Diff line number Diff line Loading @@ -38,14 +38,14 @@ import com.android.systemui.statusbar.notification.row.ui.viewmodel.Conversation import com.android.systemui.statusbar.notification.row.ui.viewmodel.FacePile import com.android.systemui.statusbar.notification.row.ui.viewmodel.SingleIcon import com.android.systemui.statusbar.notification.row.ui.viewmodel.SingleLineViewModel import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import kotlin.test.assertEquals import kotlin.test.assertIs import kotlin.test.assertIsNot import kotlin.test.assertNull import kotlin.test.assertTrue import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) Loading Loading @@ -118,7 +118,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { assertEquals(LAST_MESSAGE, singleLineViewModel.contentText) assertNull( singleLineViewModel.conversationData?.conversationSenderName, "Sender name should be null for one-on-one conversation" "Sender name should be null for one-on-one conversation", ) assertTrue { singleLineViewModel.conversationData Loading @@ -144,7 +144,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { assertEquals(LAST_MESSAGE, singleLineViewModel.contentText) assertNull( singleLineViewModel.conversationData, "conversationData should be null for legacy messaging conversation" "conversationData should be null for legacy messaging conversation", ) } Loading @@ -165,7 +165,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { assertEquals(LAST_MESSAGE, singleLineViewModel.contentText) assertNull( singleLineViewModel.conversationData, "conversationData should be null for legacy messaging conversation" "conversationData should be null for legacy messaging conversation", ) } Loading @@ -189,7 +189,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { assertEquals(LAST_MESSAGE, singleLineViewModel.contentText) assertNull( singleLineViewModel.conversationData?.conversationSenderName, "Sender name should be null for one-on-one conversation" "Sender name should be null for one-on-one conversation", ) assertTrue { singleLineViewModel.conversationData Loading Loading @@ -219,9 +219,9 @@ class SingleLineViewInflaterTest : SysuiTestCase() { assertEquals( context.resources.getString( com.android.internal.R.string.conversation_single_line_name_display, LAST_SENDER_NAME LAST_SENDER_NAME, ), singleLineViewModel.conversationData?.conversationSenderName singleLineViewModel.conversationData?.conversationSenderName, ) assertTrue { singleLineViewModel.conversationData Loading Loading @@ -249,9 +249,9 @@ class SingleLineViewInflaterTest : SysuiTestCase() { assertEquals( context.resources.getString( com.android.internal.R.string.conversation_single_line_name_display, LAST_SENDER_NAME LAST_SENDER_NAME, ), singleLineViewModel.conversationData?.conversationSenderName singleLineViewModel.conversationData?.conversationSenderName, ) val backgroundColor = Loading @@ -261,11 +261,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { singleLineViewModel.conversationData ?.avatar ?.equalsTo( FacePile( firstSenderIconDrawable, lastSenderIconDrawable, backgroundColor, ) FacePile(firstSenderIconDrawable, lastSenderIconDrawable, backgroundColor) ) == true } } Loading @@ -289,7 +285,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { assertEquals(LAST_MESSAGE, singleLineViewModel.contentText) assertNull( singleLineViewModel.conversationData?.conversationSenderName, "Sender name should be null for one-on-one conversation" "Sender name should be null for one-on-one conversation", ) assertTrue { singleLineViewModel.conversationData Loading Loading @@ -389,12 +385,12 @@ class SingleLineViewInflaterTest : SysuiTestCase() { if (expectMessagingStyle) { assertIs<Notification.MessagingStyle>( builder.style, "Notification style should be MessagingStyle" "Notification style should be MessagingStyle", ) } else { assertIsNot<Notification.MessagingStyle>( builder.style, message = "Notification style should not be MessagingStyle" message = "Notification style should not be MessagingStyle", ) } Loading @@ -408,7 +404,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { builder, context, false, "summary" "summary", ) } Loading @@ -424,7 +420,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { Bitmap.createBitmap( largeIconDimension.toInt(), largeIconDimension.toInt(), Bitmap.Config.ARGB_8888 Bitmap.Config.ARGB_8888, ) val c = Canvas(b) val paint = Paint() Loading @@ -432,7 +428,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { largeIconDimension / 2, largeIconDimension / 2, largeIconDimension.coerceAtMost(largeIconDimension) / 2, paint paint, ) d.setBounds(0, 0, largeIconDimension.toInt(), largeIconDimension.toInt()) paint.setXfermode(PorterDuffXfermode(PorterDuff.Mode.SRC_IN)) Loading Loading @@ -480,8 +476,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { } res } else false } ?: kotlin.run { false } } ?: kotlin.run { false } private fun Bitmap.toPixels() = IntArray(width * height).apply { getPixels(this, 0, width, 0, 0, width, height) } Loading Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/SingleLineViewInflaterTest.kt→packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/SingleLineViewInflaterTest.kt +20 −25 Original line number Diff line number Diff line Loading @@ -38,14 +38,14 @@ import com.android.systemui.statusbar.notification.row.ui.viewmodel.Conversation import com.android.systemui.statusbar.notification.row.ui.viewmodel.FacePile import com.android.systemui.statusbar.notification.row.ui.viewmodel.SingleIcon import com.android.systemui.statusbar.notification.row.ui.viewmodel.SingleLineViewModel import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import kotlin.test.assertEquals import kotlin.test.assertIs import kotlin.test.assertIsNot import kotlin.test.assertNull import kotlin.test.assertTrue import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) Loading Loading @@ -118,7 +118,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { assertEquals(LAST_MESSAGE, singleLineViewModel.contentText) assertNull( singleLineViewModel.conversationData?.conversationSenderName, "Sender name should be null for one-on-one conversation" "Sender name should be null for one-on-one conversation", ) assertTrue { singleLineViewModel.conversationData Loading @@ -144,7 +144,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { assertEquals(LAST_MESSAGE, singleLineViewModel.contentText) assertNull( singleLineViewModel.conversationData, "conversationData should be null for legacy messaging conversation" "conversationData should be null for legacy messaging conversation", ) } Loading @@ -165,7 +165,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { assertEquals(LAST_MESSAGE, singleLineViewModel.contentText) assertNull( singleLineViewModel.conversationData, "conversationData should be null for legacy messaging conversation" "conversationData should be null for legacy messaging conversation", ) } Loading @@ -189,7 +189,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { assertEquals(LAST_MESSAGE, singleLineViewModel.contentText) assertNull( singleLineViewModel.conversationData?.conversationSenderName, "Sender name should be null for one-on-one conversation" "Sender name should be null for one-on-one conversation", ) assertTrue { singleLineViewModel.conversationData Loading Loading @@ -219,9 +219,9 @@ class SingleLineViewInflaterTest : SysuiTestCase() { assertEquals( context.resources.getString( com.android.internal.R.string.conversation_single_line_name_display, LAST_SENDER_NAME LAST_SENDER_NAME, ), singleLineViewModel.conversationData?.conversationSenderName singleLineViewModel.conversationData?.conversationSenderName, ) assertTrue { singleLineViewModel.conversationData Loading Loading @@ -249,9 +249,9 @@ class SingleLineViewInflaterTest : SysuiTestCase() { assertEquals( context.resources.getString( com.android.internal.R.string.conversation_single_line_name_display, LAST_SENDER_NAME LAST_SENDER_NAME, ), singleLineViewModel.conversationData?.conversationSenderName singleLineViewModel.conversationData?.conversationSenderName, ) val backgroundColor = Loading @@ -261,11 +261,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { singleLineViewModel.conversationData ?.avatar ?.equalsTo( FacePile( firstSenderIconDrawable, lastSenderIconDrawable, backgroundColor, ) FacePile(firstSenderIconDrawable, lastSenderIconDrawable, backgroundColor) ) == true } } Loading @@ -289,7 +285,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { assertEquals(LAST_MESSAGE, singleLineViewModel.contentText) assertNull( singleLineViewModel.conversationData?.conversationSenderName, "Sender name should be null for one-on-one conversation" "Sender name should be null for one-on-one conversation", ) assertTrue { singleLineViewModel.conversationData Loading Loading @@ -389,12 +385,12 @@ class SingleLineViewInflaterTest : SysuiTestCase() { if (expectMessagingStyle) { assertIs<Notification.MessagingStyle>( builder.style, "Notification style should be MessagingStyle" "Notification style should be MessagingStyle", ) } else { assertIsNot<Notification.MessagingStyle>( builder.style, message = "Notification style should not be MessagingStyle" message = "Notification style should not be MessagingStyle", ) } Loading @@ -408,7 +404,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { builder, context, false, "summary" "summary", ) } Loading @@ -424,7 +420,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { Bitmap.createBitmap( largeIconDimension.toInt(), largeIconDimension.toInt(), Bitmap.Config.ARGB_8888 Bitmap.Config.ARGB_8888, ) val c = Canvas(b) val paint = Paint() Loading @@ -432,7 +428,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { largeIconDimension / 2, largeIconDimension / 2, largeIconDimension.coerceAtMost(largeIconDimension) / 2, paint paint, ) d.setBounds(0, 0, largeIconDimension.toInt(), largeIconDimension.toInt()) paint.setXfermode(PorterDuffXfermode(PorterDuff.Mode.SRC_IN)) Loading Loading @@ -480,8 +476,7 @@ class SingleLineViewInflaterTest : SysuiTestCase() { } res } else false } ?: kotlin.run { false } } ?: kotlin.run { false } private fun Bitmap.toPixels() = IntArray(width * height).apply { getPixels(this, 0, width, 0, 0, width, height) } Loading