@@ -1,5 +1,5 @@
11/*
2− * Copyright 2013 Canonical Ltd.
2+ * Copyright 2013, 2014 Canonical Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -400,7 +400,10 @@ Item {
400400 mockScope.setName("Mock Scope");
401401 mockScope.categories.setCount(2);
402402 mockScope.categories.resultModel(0).setResultCount(50);
403+ mockScope.categories.resultModel(1).setResultCount(15);
404+ mockScope.categories.setLayout(0, "grid");
403405 mockScope.categories.setLayout(1, "grid");
406+ mockScope.categories.setHeaderLink(0, "");
404407 mockScope.categories.setHeaderLink(1, "");
405408 genericScopeView.scope = mockScope;
406409 waitForRendering(genericScopeView.categoryView);
@@ -419,6 +422,7 @@ Item {
419422
420423 scrollToCategory("dashCategory1");
421424
425+ tryCompareFunction(function() { return findChild(genericScopeView, "dashCategory1") !== null; }, true);
422426 var category1 = findChild(genericScopeView, "dashCategory1")
423427 var seeAll1 = findChild(category1, "seeAll")
424428 verify(category1.expandable);
@@ -433,6 +437,47 @@ Item {
433437 == genericScopeView.categoryView.contentHeight;}
434438 , true);
435439 }
440+
441+ function test_seeAllTwoCategoriesScenario2() {
442+ mockScope.setId("mockScope");
443+ mockScope.setName("Mock Scope");
444+ mockScope.categories.setCount(2);
445+ mockScope.categories.resultModel(0).setResultCount(15);
446+ mockScope.categories.resultModel(1).setResultCount(50);
447+ mockScope.categories.setLayout(0, "grid");
448+ mockScope.categories.setLayout(1, "grid");
449+ mockScope.categories.setHeaderLink(0, "");
450+ mockScope.categories.setHeaderLink(1, "");
451+ genericScopeView.scope = mockScope;
452+ waitForRendering(genericScopeView.categoryView);
453+
454+ var category0 = findChild(genericScopeView, "dashCategory0")
455+ var seeAll0 = findChild(category0, "seeAll")
456+
457+ waitForRendering(seeAll0);
458+ verify(category0.expandable);
459+ verify(!category0.expanded);
460+
461+ mouseClick(seeAll0, seeAll0.width / 2, seeAll0.height / 2);
462+ verify(category0.expanded);
463+ tryCompare(category0, "height", category0.item.expandedHeight + seeAll0.height);
464+
465+ scrollToCategory("dashCategory1");
466+
467+ var category1 = findChild(genericScopeView, "dashCategory1")
468+ var seeAll1 = findChild(category1, "seeAll")
469+ verify(category1.expandable);
470+ verify(!category1.expanded);
471+
472+ mouseClick(seeAll1, seeAll1.width / 2, seeAll1.height / 2);
473+ verify(!category0.expanded);
474+ verify(category1.expanded);
475+ tryCompare(category1, "height", category1.item.expandedHeight + seeAll1.height);
476+ tryCompareFunction(function() {
477+ return category0.height + genericScopeView.categoryView.pageHeader.height + category1.y
478+ == genericScopeView.categoryView.contentY;}
479+ , true);
480+ }
436481 }
437482 }
438483}