From e053d267f0cde9b259434e47975b8de697486c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cie=C5=9Blak?= Date: Thu, 11 Jan 2024 12:48:32 +0100 Subject: [PATCH] fix(StatusQ): FastExpressionSorter's test fixed for mac Threshold for acceptable accesses has been increased but also additional check regarding roles has been introduced to ensure expected behavior. Closes: #13181 --- .../TestModels/tst_FastExpressionSorter.qml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/ui/StatusQ/tests/TestCore/TestModels/tst_FastExpressionSorter.qml b/ui/StatusQ/tests/TestCore/TestModels/tst_FastExpressionSorter.qml index 3472ddac6f..f3a64e9fb8 100644 --- a/ui/StatusQ/tests/TestCore/TestModels/tst_FastExpressionSorter.qml +++ b/ui/StatusQ/tests/TestCore/TestModels/tst_FastExpressionSorter.qml @@ -34,10 +34,14 @@ Item { id: observerProxy property int accessCounter: 0 + readonly property var accessedRoles: new Set() sourceModel: listModel - onDataAccessed: accessCounter++ + onDataAccessed: { + accessCounter++ + accessedRoles.add(role) + } } readonly property SortFilterProxyModel model: SortFilterProxyModel { @@ -74,7 +78,8 @@ Item { compare(count, 7) verify(obj.observer.accessCounter - < count * Math.ceil(Math.log2(count)) * 2) + < count * Math.ceil(Math.log2(count)) * 3) + compare(obj.observer.accessedRoles.size, 1) compare(obj.model.get(0).a, 1) compare(obj.model.get(1).a, 2) @@ -90,7 +95,8 @@ Item { obj.d = 0 verify(obj.observer.accessCounter - < count * Math.ceil(Math.log2(count)) * 2) + < count * Math.ceil(Math.log2(count)) * 3) + compare(obj.observer.accessedRoles.size, 1) compare(obj.model.get(0).a, 7) compare(obj.model.get(1).a, 6) @@ -106,11 +112,15 @@ Item { compare(obj.model.get(1).a, 2) compare(obj.model.get(6).a, 7) + obj.observer.accessedRoles.clear() + obj.observer.accessCounter = 0 obj.sorterEnabled = true const count = obj.model.count + verify(obj.observer.accessCounter - < count * Math.ceil(Math.log2(count)) * 2) + < count * Math.ceil(Math.log2(count)) * 3) + compare(obj.observer.accessedRoles.size, 1) compare(obj.model.get(0).a, 7) compare(obj.model.get(1).a, 6)