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

Commit 98c1eaba authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz
Browse files

[ExpandableNotificationRow] Add missing expanded unit tests

This CL adds missing isExpanded unit tests, which only covers the current isExpanded implementation.

Bug: 346976443
Test: ExpandableNotificationRowTest
Flag: TEST_ONLY
Change-Id: Ib8e4fd1e8e71eecea99f7d0329ee1028c97013ca
parent eb1bd418
Loading
Loading
Loading
Loading
+67 −0
Original line number Diff line number Diff line
@@ -792,6 +792,73 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
        assertThat(row.isExpanded()).isTrue();
    }

    @Test
    public void isExpanded_onKeyguard_allowOnKeyguardExpanded() throws Exception {
        // GIVEN
        final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
        row.setOnKeyguard(true);
        row.setUserExpanded(true);

        // THEN
        assertThat(row.isExpanded(/*allowOnKeyguard =*/ true)).isTrue();
    }
    @Test
    public void isExpanded_onKeyguard_notAllowOnKeyguardNotExpanded() throws Exception {
        // GIVEN
        final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
        row.setOnKeyguard(true);
        row.setUserExpanded(true);

        // THEN
        assertThat(row.isExpanded(/*allowOnKeyguard =*/ false)).isFalse();
    }

    @Test
    public void isExpanded_systemExpanded_expanded() throws Exception {
        // GIVEN
        final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
        row.setOnKeyguard(false);
        row.setSystemExpanded(true);

        // THEN
        assertThat(row.isExpanded()).isTrue();
    }

    @Test
    public void isExpanded_systemChildExpanded_expanded() throws Exception {
        // GIVEN
        final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
        row.setOnKeyguard(false);
        row.setSystemChildExpanded(true);

        // THEN
        assertThat(row.isExpanded()).isTrue();
    }

    @Test
    public void isExpanded_userExpanded_expanded() throws Exception {
        // GIVEN
        final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
        row.setOnKeyguard(false);
        row.setSystemExpanded(true);
        row.setUserExpanded(true);

        // THEN
        assertThat(row.isExpanded()).isTrue();
    }

    @Test
    public void isExpanded_userExpandedFalse_notExpanded() throws Exception {
        // GIVEN
        final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
        row.setOnKeyguard(false);
        row.setSystemExpanded(true);
        row.setUserExpanded(false);

        // THEN
        assertThat(row.isExpanded()).isFalse();
    }

    @Test
    public void onDisappearAnimationFinished_shouldSetFalse_headsUpAnimatingAway()
            throws Exception {