@@ -611,7 +611,26 @@ private slots:
611
611
model.addToFavorites (model.index (0 , 0 , processesIndex));
612
612
QCOMPARE (proxy.rowCount (), 3 );
613
613
614
+ {
615
+ // verify that favorites remain at the top
616
+ QCOMPARE (proxy.sortOrder (), Qt::AscendingOrder);
617
+ QCOMPARE (proxy.sortColumn (), 0 );
618
+
619
+ // favorites on top
620
+ QVERIFY (proxy.index (0 , 0 , proxy.index (0 , 0 )).data (EventModel::IsFavoriteRole).toBool ());
621
+ // followed by CPUs
622
+ QCOMPARE (proxy.index (0 , 0 , proxy.index (1 , 0 )).data (EventModel::CpuIdRole).value <quint32>(), 1 );
623
+
624
+ proxy.sort (0 , Qt::DescendingOrder);
625
+
626
+ // favorites are still on top
627
+ QVERIFY (proxy.index (0 , 0 , proxy.index (0 , 0 )).data (EventModel::IsFavoriteRole).toBool ());
628
+ // followed by processes
629
+ QCOMPARE (proxy.index (0 , 0 , proxy.index (1 , 0 )).data (EventModel::ProcessIdRole).value <quint32>(), 5678 );
630
+ }
631
+
614
632
model.removeFromFavorites (model.index (0 , 0 , favoritesIndex));
633
+
615
634
QCOMPARE (proxy.rowCount (), 2 );
616
635
}
617
636
@@ -862,9 +881,9 @@ private slots:
862
881
{
863
882
Data::EventResults events;
864
883
events.cpus .resize (3 );
865
- events.cpus [0 ].cpuId = 0 ;
866
- events.cpus [1 ].cpuId = 1 ; // empty
867
- events.cpus [2 ].cpuId = 2 ;
884
+ events.cpus [0 ].cpuId = 1 ;
885
+ events.cpus [1 ].cpuId = 2 ; // empty
886
+ events.cpus [2 ].cpuId = 3 ;
868
887
869
888
const quint64 endTime = 1000 ;
870
889
const quint64 deltaTime = 10 ;
@@ -907,13 +926,13 @@ private slots:
907
926
event.time = time;
908
927
++costSummary.sampleCount ;
909
928
costSummary.totalPeriod += event.cost ;
910
- events.cpus [cpuId].events << event;
929
+ events.cpus [cpuId - 1 ].events << event;
911
930
return event;
912
931
};
913
932
for (quint64 time = 0 ; time < endTime; time += deltaTime) {
914
- thread1.events << generateEvent (time, 0 );
933
+ thread1.events << generateEvent (time, 1 );
915
934
if (thread2.time .contains (time)) {
916
- thread2.events << generateEvent (time, 2 );
935
+ thread2.events << generateEvent (time, 3 );
917
936
}
918
937
}
919
938
events.totalCosts = {costSummary};
0 commit comments