@@ -725,6 +725,95 @@ Item {
725725 tryCompare(mockModel, "count", before - 1)
726726 }
727727
728+ function expansionLogic_data() {
729+ return [{
730+ tag: "Snap Decision without secondary icon and no button-tint",
731+ n: nlist[3],
732+ summaryVisible: true,
733+ bodyVisible: true,
734+ iconVisible: true,
735+ centeredIconVisible: false,
736+ shaped: true,
737+ secondaryIconVisible: false,
738+ buttonRowVisible: true,
739+ buttonTinted: false,
740+ hasSound: true,
741+ valueVisible: false,
742+ valueLabelVisible: false,
743+ valueTinted: false
744+ },
745+ {
746+ tag: "2-over-1 Snap Decision with button-tint",
747+ n: nlist[8],
748+ summaryVisible: true,
749+ bodyVisible: true,
750+ iconVisible: false,
751+ centeredIconVisible: false,
752+ shaped: false,
753+ secondaryIconVisible: false,
754+ buttonRowVisible: false,
755+ buttonTinted: true,
756+ hasSound: false,
757+ valueVisible: false,
758+ valueLabelVisible: false,
759+ valueTinted: false
760+ },
761+ {
762+ tag: "Snap Decision without secondary icon and no button-tint",
763+ n: nlist[3],
764+ summaryVisible: true,
765+ bodyVisible: true,
766+ iconVisible: true,
767+ centeredIconVisible: false,
768+ shaped: true,
769+ secondaryIconVisible: false,
770+ buttonRowVisible: true,
771+ buttonTinted: false,
772+ hasSound: true,
773+ valueVisible: false,
774+ valueLabelVisible: false,
775+ valueTinted: false
776+ }
777+ ]
778+ }
779+
780+ function test_expansionLogic() {
781+ var data = expansionLogic_data();
782+
783+ // fill the model
784+ data.forEach(function(notification) {
785+ mockModel.append(notification.n);
786+ notification.n.completed.connect(mockModel.onCompleted)
787+ })
788+
789+ // make sure the view is properly updated before going on
790+ notifications.forceLayout();
791+ waitForRendering(notifications);
792+
793+ // first one should be expanded by default
794+ var notification1 = findChild(notifications, "notification1") // 0 is placeholder...
795+ verify(!!notification1, "notification wasn't found");
796+ waitForRendering(notification1);
797+ verify(notification1.expanded);
798+
799+ // click the 2nd one, verify it's now expanded
800+ var notification2 = findChild(notifications, "notification2") // 0 is placeholder...
801+ verify(!!notification2, "notification wasn't found");
802+ waitForRendering(notification2);
803+ mouseClick(notification2);
804+ verify(notification2.expanded);
805+ verify(!notification1.expanded);
806+
807+ // now close the 2nd one, verify 1st is again expanded, 2nd is gone
808+ var dragStart = notification2.width * 0.25;
809+ var dragEnd = notification2.width;
810+ var dragY = notification2.height / 2;
811+ touchFlick(notification2, dragStart, dragY, dragEnd, dragY);
812+ waitForRendering(notifications);
813+ tryCompareFunction(function() { return notification1.expanded; }, true);
814+ tryCompareFunction(function() { return notification2.expanded; }, undefined);
815+ }
816+
728817 function cleanupTestCase() {
729818 notifications.hasMouse = false;
730819 }