on xenial help sign in
Use binding for filter popover contentWidth (LP: #1595116)

Approved by: Albert Astals Cid

commit4dc626d2a56905320df87ddcbe9ec167429fef83 authorAndrea Cimitan <andrea.cimitan@gmail.com> dateWed 3 Aug 2016, 15:51 (10 years ago) parentc698d8008e74c7
2 files changed+14−2
qml/Dash/GenericScopeView.qml+1−1 tests/qmltests/Dash/tst_DashContent.qml+13−1
qml/Dash/GenericScopeView.qml+1−1
@@ -662,7 +662,7 @@ FocusScope {
662662 }
663663 onShowFiltersPopup: { // item
664664 extraPanel.visible = false;
665− scopeView.filtersPopover = PopupUtils.open(Qt.resolvedUrl("FiltersPopover.qml"), item, { "contentWidth": scopeView.width - units.gu(2) } );
665+ scopeView.filtersPopover = PopupUtils.open(Qt.resolvedUrl("FiltersPopover.qml"), item, { "contentWidth": Qt.binding(function() { return scopeView.width - units.gu(2); } ) } );
666666 scopeView.filtersPopover.Component.onDestruction.connect(function () {
667667 categoryView.pageHeader.closePopup(false, true);
668668 categoryView.pageHeader.unfocus(true); // remove the focus from the search field
tests/qmltests/Dash/tst_DashContent.qml+13−1
@@ -524,7 +524,6 @@ Item {
524524 var peExtraPanel = findChild(dashContentList.currentItem, "peExtraPanel");
525525 var headerContainer = findChild(pageHeader, "headerContainer");
526526
527− // test that closing the filters popover without a search unfocuses and removes the navigation
528527 mouseClick(searchButton);
529528 tryCompare(peExtraPanel, "visible", true);
530529
@@ -536,6 +535,19 @@ Item {
536535 filtersPopover = findChild(shell, "filtersPopover")
537536 verify(filtersPopover);
538537
538+ // test that popover resizes
539+ var shellWidth = shell.width;
540+ var popoverWidth = filtersPopover.contentWidth;
541+
542+ shell.width = shellWidth + units.gu(60);
543+ waitForRendering(shell);
544+
545+ tryCompare(filtersPopover, "contentWidth", popoverWidth + units.gu(60));
546+
547+ shell.width = shellWidth;
548+ waitForRendering(shell);
549+
550+ // test that closing the filters popover without a search unfocuses and removes the navigation
539551 mouseClick(shell, shell.width - 1, shell.height - 1);
540552
541553 tryCompare(pageHeader.extraPanel, "visible", false);