Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd152d93 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Fix TopLineView NPR in NotificationContentViewTest

Test: NotificationContentViewTest
Flag: android.app.notifications_redesign_templates
Bug: 396421144
Change-Id: Ic7729388bcaeeed772a9a344ee5e25867df40caf
parent 387b32ce
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.service.notification.StatusBarNotification
import android.testing.TestableLooper
import android.testing.ViewUtils
import android.view.NotificationHeaderView
import android.view.NotificationTopLineView
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
@@ -270,7 +271,7 @@ class NotificationContentViewTest : SysuiTestCase() {
        val icon =
            FeedbackIcon(
                R.drawable.ic_feedback_alerted,
                R.string.notification_feedback_indicator_alerted
                R.string.notification_feedback_indicator_alerted,
            )
        view.setFeedbackIcon(icon)

@@ -291,10 +292,7 @@ class NotificationContentViewTest : SysuiTestCase() {
        val mockHeadsUpEB = mock<NotificationExpandButton>()
        val mockHeadsUp = createMockNotificationHeaderView(contractedHeight, mockHeadsUpEB)

        val view =
            createContentView(
                isSystemExpanded = false,
            )
        val view = createContentView(isSystemExpanded = false)

        // Update all 3 child forms
        view.apply {
@@ -319,12 +317,14 @@ class NotificationContentViewTest : SysuiTestCase() {

    private fun createMockNotificationHeaderView(
        height: Int,
        mockExpandedEB: NotificationExpandButton
        mockExpandedEB: NotificationExpandButton,
    ) =
        spy(NotificationHeaderView(mContext, /* attrs= */ null).apply { minimumHeight = height })
            .apply {
                whenever(this.animate()).thenReturn(mock())
                whenever(this.findViewById<View>(R.id.expand_button)).thenReturn(mockExpandedEB)
                whenever(this.findViewById<View>(R.id.notification_top_line))
                    .thenReturn(mock<NotificationTopLineView>())
            }

    @Test
@@ -344,7 +344,7 @@ class NotificationContentViewTest : SysuiTestCase() {
                isSystemExpanded = false,
                contractedView = mockContracted,
                expandedView = mockExpanded,
                headsUpView = mockHeadsUp
                headsUpView = mockHeadsUp,
            )

        view.setRemoteInputVisible(true)
@@ -373,7 +373,7 @@ class NotificationContentViewTest : SysuiTestCase() {
                isSystemExpanded = false,
                contractedView = mockContracted,
                expandedView = mockExpanded,
                headsUpView = mockHeadsUp
                headsUpView = mockHeadsUp,
            )

        view.setRemoteInputVisible(false)
@@ -635,7 +635,7 @@ class NotificationContentViewTest : SysuiTestCase() {
        contractedView: View = createViewWithHeight(contractedHeight),
        expandedView: View = createViewWithHeight(expandedHeight),
        headsUpView: View = createViewWithHeight(contractedHeight),
        row: ExpandableNotificationRow = this.row
        row: ExpandableNotificationRow = this.row,
    ): NotificationContentView {
        val height = if (isSystemExpanded) expandedHeight else contractedHeight
        doReturn(height).whenever(row).intrinsicHeight
@@ -647,7 +647,7 @@ class NotificationContentViewTest : SysuiTestCase() {
                setHeights(
                    /* smallHeight= */ contractedHeight,
                    /* headsUpMaxHeight= */ contractedHeight,
                    /* maxHeight= */ expandedHeight
                    /* maxHeight= */ expandedHeight,
                )
                contractedChild = contractedView
                expandedChild = expandedView