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

Commit d8ac0c18 authored by lyn's avatar lyn
Browse files

Cluster bundle tests together

Make test naming consistent

Bug: 389839319
Test: this
Flag: TEST_ONLY
Change-Id: I28d60e296966768e51475cdbe2572deb3dcf551d
parent aacd8b5d
Loading
Loading
Loading
Loading
+81 −82
Original line number Diff line number Diff line
@@ -298,88 +298,6 @@ public class ShadeListBuilderTest extends SysuiTestCase {
        );
    }


    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    public void testBundleSingleNotif() {
        mListBuilder.setBundler(TestBundler.INSTANCE);

        // GIVEN single notif that will be bundled
        addNotif(0, PACKAGE_1, BUNDLE_1);
        dispatchBuild();

        // VERIFY single notif shows in bundle
        verifyBuiltList(
                bundle(
                        BUNDLE_1,
                        notif(0)
                )
        );
    }

    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    public void testBundle_combineTwoNotifs_intoOneGroup() {
        mListBuilder.setBundler(TestBundler.INSTANCE);

        // GIVEN single notif that will be bundled
        addGroupChild(0, PACKAGE_1, GROUP_1, BUNDLE_1);
        dispatchBuild();

        // VERIFY single notif shows in bundle
        verifyBuiltList(
                bundle(
                        BUNDLE_1,
                        notif(0) // Child is promoted out of group inside bundle
                )
        );

        // Add summary and child in same group
        addGroupSummary(1, PACKAGE_1, GROUP_1, BUNDLE_1);
        addGroupChild(2, PACKAGE_1, GROUP_1, BUNDLE_1);
        dispatchBuild();

        // Verify new additions are grouped inside bundle
        verifyBuiltList(
                bundle(
                        BUNDLE_1,
                        group(
                            summary(1),
                            child(0),
                            child(2)
                        )
                )
        );
    }

    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    public void testBundleGroupChildrenAreSorted() {
        mListBuilder.setBundler(TestBundler.INSTANCE);

        // GIVEN a simple pipeline
        // WHEN we add two groups
        addGroupChild(0, PACKAGE_1, GROUP_1, BUNDLE_1).setRank(3);
        addGroupChild(1, PACKAGE_1, GROUP_1, BUNDLE_1).setRank(2);
        addGroupChild(2, PACKAGE_1, GROUP_1, BUNDLE_1).setRank(1);
        addGroupSummary(3, PACKAGE_1, GROUP_1, BUNDLE_1);

        dispatchBuild();

        // THEN bundle group children are sorted by rank
        verifyBuiltList(
                bundle(
                        BUNDLE_1,
                        group(
                                summary(3),
                                child(2),
                                child(1),
                                child(0)
                        )
                )
        );
    }

    @Test
    public void testDuplicateGroupSummariesAreDiscarded() {
        // GIVEN a simple pipeline
@@ -996,6 +914,87 @@ public class ShadeListBuilderTest extends SysuiTestCase {
        assertEquals(1, notif(0).entry.getSectionIndex());
    }

    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    public void testBundle_singleNotif() {
        mListBuilder.setBundler(TestBundler.INSTANCE);

        // GIVEN single notif that will be bundled
        addNotif(0, PACKAGE_1, BUNDLE_1);
        dispatchBuild();

        // VERIFY single notif shows in bundle
        verifyBuiltList(
                bundle(
                        BUNDLE_1,
                        notif(0)
                )
        );
    }

    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    public void testBundle_combineTwoNotifs_intoOneGroup() {
        mListBuilder.setBundler(TestBundler.INSTANCE);

        // GIVEN single notif that will be bundled
        addGroupChild(0, PACKAGE_1, GROUP_1, BUNDLE_1);
        dispatchBuild();

        // VERIFY single notif shows in bundle
        verifyBuiltList(
                bundle(
                        BUNDLE_1,
                        notif(0) // Child is promoted out of group inside bundle
                )
        );

        // Add summary and child in same group
        addGroupSummary(1, PACKAGE_1, GROUP_1, BUNDLE_1);
        addGroupChild(2, PACKAGE_1, GROUP_1, BUNDLE_1);
        dispatchBuild();

        // Verify new additions are grouped inside bundle
        verifyBuiltList(
                bundle(
                        BUNDLE_1,
                        group(
                                summary(1),
                                child(0),
                                child(2)
                        )
                )
        );
    }

    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    public void testBundle_groupChildrenAreSorted() {
        mListBuilder.setBundler(TestBundler.INSTANCE);

        // GIVEN a simple pipeline
        // WHEN we add two groups
        addGroupChild(0, PACKAGE_1, GROUP_1, BUNDLE_1).setRank(3);
        addGroupChild(1, PACKAGE_1, GROUP_1, BUNDLE_1).setRank(2);
        addGroupChild(2, PACKAGE_1, GROUP_1, BUNDLE_1).setRank(1);
        addGroupSummary(3, PACKAGE_1, GROUP_1, BUNDLE_1);

        dispatchBuild();

        // THEN bundle group children are sorted by rank
        verifyBuiltList(
                bundle(
                        BUNDLE_1,
                        group(
                                summary(3),
                                child(2),
                                child(1),
                                child(0)
                        )
                )
        );
    }

    @Test
    public void testBundle_childrenAssignedSection() {
        mListBuilder.setBundler(TestBundler.INSTANCE);