on xenial help sign in
better/more robust testing
3577812Albert Astals
tests/qmltests/Dash/tst_GenericScopeView.qml+13−6
@@ -94,6 +94,16 @@ Item {
94 return findChild(genericScopeView, category);
94 return findChild(genericScopeView, category);
95 }
95 }
96
96
97+ function scrollToEnd()
98+ {
99+ var categoryListView = findChild(genericScopeView, "categoryListView");
100+ while (!categoryListView.atYEnd) {
101+ mouseFlick(genericScopeView, genericScopeView.width/2, genericScopeView.height,
102+ genericScopeView.width/2, genericScopeView.y)
103+ tryCompare(categoryListView, "moving", false);
104+ }
105+ }
106+
97 function test_isActive() {
107 function test_isActive() {
98 tryCompare(genericScopeView.scope, "isActive", false)
108 tryCompare(genericScopeView.scope, "isActive", false)
99 genericScopeView.isCurrent = true
109 genericScopeView.isCurrent = true
@@ -420,7 +430,7 @@ Item {
420 tryCompare(category0, "height", category0.item.expandedHeight + seeAll0.height);
430 tryCompare(category0, "height", category0.item.expandedHeight + seeAll0.height);
421 tryCompare(genericScopeView.categoryView, "contentY", units.gu(13.5));
431 tryCompare(genericScopeView.categoryView, "contentY", units.gu(13.5));
422
432
423− scrollToCategory("dashCategory1");
433+ scrollToEnd();
424
434
425 tryCompareFunction(function() { return findChild(genericScopeView, "dashCategory1") !== null; }, true);
435 tryCompareFunction(function() { return findChild(genericScopeView, "dashCategory1") !== null; }, true);
426 var category1 = findChild(genericScopeView, "dashCategory1")
436 var category1 = findChild(genericScopeView, "dashCategory1")
@@ -462,7 +472,7 @@ Item {
462 verify(category0.expanded);
472 verify(category0.expanded);
463 tryCompare(category0, "height", category0.item.expandedHeight + seeAll0.height);
473 tryCompare(category0, "height", category0.item.expandedHeight + seeAll0.height);
464
474
465− scrollToCategory("dashCategory1");
475+ scrollToEnd();
466
476
467 var category1 = findChild(genericScopeView, "dashCategory1")
477 var category1 = findChild(genericScopeView, "dashCategory1")
468 var seeAll1 = findChild(category1, "seeAll")
478 var seeAll1 = findChild(category1, "seeAll")
@@ -473,10 +483,7 @@ Item {
473 verify(!category0.expanded);
483 verify(!category0.expanded);
474 verify(category1.expanded);
484 verify(category1.expanded);
475 tryCompare(category1, "height", category1.item.expandedHeight + seeAll1.height);
485 tryCompare(category1, "height", category1.item.expandedHeight + seeAll1.height);
476− tryCompareFunction(function() {
486+ tryCompare(category1, "y", units.gu(5));
477− return category0.height + genericScopeView.categoryView.pageHeader.height + category1.y
478− == genericScopeView.categoryView.contentY;}
479− , true);
480 }
487 }
481 }
488 }
482 }
489 }