Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilder.kt +4 −2 Original line number Diff line number Diff line Loading @@ -51,9 +51,11 @@ class NodeSpecBuilder( // If this notif begins a new section, first add the section's header view if (section != currentSection) { if (section.headerController != currentSection?.headerController) { section.headerController?.let { headerController -> root.children.add(NodeSpecImpl(root, headerController)) } } prevSections.add(currentSection) currentSection = section } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilderTest.kt +32 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ class NodeSpecBuilderTest : SysuiTestCase() { private val section1 = buildSection(1, section1Bucket, headerController1) private val section1NoHeader = buildSection(1, section1Bucket, null) private val section2 = buildSection(2, section2Bucket, headerController2) private val section3 = buildSection(3, section2Bucket, headerController2) private val fakeViewBarn = FakeViewBarn() Loading @@ -74,6 +75,37 @@ class NodeSpecBuilderTest : SysuiTestCase() { specBuilder = NodeSpecBuilder(viewBarn) } @Test fun testMultipleSectionsWithSameController() { checkOutput( listOf( notif(0, section0), notif(1, section2), notif(2, section3) ), tree( node(headerController0), notifNode(0), node(headerController2), notifNode(1), notifNode(2) ) ) } @Test(expected = RuntimeException::class) fun testMultipleSectionsWithSameControllerNonConsecutive() { checkOutput( listOf( notif(0, section0), notif(1, section1), notif(2, section3), notif(3, section1) ), tree() ) } @Test fun testSimpleMapping() { checkOutput( Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilder.kt +4 −2 Original line number Diff line number Diff line Loading @@ -51,9 +51,11 @@ class NodeSpecBuilder( // If this notif begins a new section, first add the section's header view if (section != currentSection) { if (section.headerController != currentSection?.headerController) { section.headerController?.let { headerController -> root.children.add(NodeSpecImpl(root, headerController)) } } prevSections.add(currentSection) currentSection = section } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilderTest.kt +32 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ class NodeSpecBuilderTest : SysuiTestCase() { private val section1 = buildSection(1, section1Bucket, headerController1) private val section1NoHeader = buildSection(1, section1Bucket, null) private val section2 = buildSection(2, section2Bucket, headerController2) private val section3 = buildSection(3, section2Bucket, headerController2) private val fakeViewBarn = FakeViewBarn() Loading @@ -74,6 +75,37 @@ class NodeSpecBuilderTest : SysuiTestCase() { specBuilder = NodeSpecBuilder(viewBarn) } @Test fun testMultipleSectionsWithSameController() { checkOutput( listOf( notif(0, section0), notif(1, section2), notif(2, section3) ), tree( node(headerController0), notifNode(0), node(headerController2), notifNode(1), notifNode(2) ) ) } @Test(expected = RuntimeException::class) fun testMultipleSectionsWithSameControllerNonConsecutive() { checkOutput( listOf( notif(0, section0), notif(1, section1), notif(2, section3), notif(3, section1) ), tree() ) } @Test fun testSimpleMapping() { checkOutput( Loading