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