@@ -701,7 +701,26 @@ private slots:
701
701
702
702
QCOMPARE (proxy.rowCount (), 3 );
703
703
704
+ {
705
+ // verify that favorites remain at the top
706
+ QCOMPARE (proxy.sortOrder (), Qt::AscendingOrder);
707
+ QCOMPARE (proxy.sortColumn (), 0 );
708
+
709
+ // favorites on top
710
+ QVERIFY (proxy.index (0 , 0 , proxy.index (0 , 0 )).data (EventModel::IsFavoriteRole).toBool ());
711
+ // followed by CPUs
712
+ QCOMPARE (proxy.index (0 , 0 , proxy.index (1 , 0 )).data (EventModel::CpuIdRole).value <quint32>(), 1 );
713
+
714
+ proxy.sort (0 , Qt::DescendingOrder);
715
+
716
+ // favorites are still on top
717
+ QVERIFY (proxy.index (0 , 0 , proxy.index (0 , 0 )).data (EventModel::IsFavoriteRole).toBool ());
718
+ // followed by processes
719
+ QCOMPARE (proxy.index (0 , 0 , proxy.index (1 , 0 )).data (EventModel::ProcessIdRole).value <quint32>(), 5678 );
720
+ }
721
+
704
722
model.removeFromFavorites (model.index (0 , 0 , favoritesIndex));
723
+
705
724
QCOMPARE (proxy.rowCount (), 2 );
706
725
}
707
726
@@ -952,9 +971,9 @@ private slots:
952
971
{
953
972
Data::EventResults events;
954
973
events.cpus .resize (3 );
955
- events.cpus [0 ].cpuId = 0 ;
956
- events.cpus [1 ].cpuId = 1 ; // empty
957
- events.cpus [2 ].cpuId = 2 ;
974
+ events.cpus [0 ].cpuId = 1 ;
975
+ events.cpus [1 ].cpuId = 2 ; // empty
976
+ events.cpus [2 ].cpuId = 3 ;
958
977
959
978
const quint64 endTime = 1000 ;
960
979
const quint64 deltaTime = 10 ;
@@ -997,13 +1016,13 @@ private slots:
997
1016
event.time = time;
998
1017
++costSummary.sampleCount ;
999
1018
costSummary.totalPeriod += event.cost ;
1000
- events.cpus [cpuId].events << event;
1019
+ events.cpus [cpuId - 1 ].events << event;
1001
1020
return event;
1002
1021
};
1003
1022
for (quint64 time = 0 ; time < endTime; time += deltaTime) {
1004
- thread1.events << generateEvent (time, 0 );
1023
+ thread1.events << generateEvent (time, 1 );
1005
1024
if (thread2.time .contains (time)) {
1006
- thread2.events << generateEvent (time, 2 );
1025
+ thread2.events << generateEvent (time, 3 );
1007
1026
}
1008
1027
}
1009
1028
events.totalCosts = {costSummary};
0 commit comments