|
21 | 21 |
|
22 | 22 | #include <models/disassemblymodel.h>
|
23 | 23 | #include <models/eventmodel.h>
|
| 24 | +#include <models/eventmodelproxy.h> |
24 | 25 | #include <models/sourcecodemodel.h>
|
25 | 26 |
|
26 | 27 | namespace {
|
@@ -672,6 +673,38 @@ private slots:
|
672 | 673 | QCOMPARE(model.rowCount(favoritesIndex), 0);
|
673 | 674 | }
|
674 | 675 |
|
| 676 | + void testEventModelProxy() |
| 677 | + { |
| 678 | + const auto events = createEventModelTestData(); |
| 679 | + EventModel model; |
| 680 | + QAbstractItemModelTester tester(&model); |
| 681 | + model.setData(events); |
| 682 | + |
| 683 | + EventModelProxy proxy; |
| 684 | + proxy.setSourceModel(&model); |
| 685 | + |
| 686 | + const auto favoritesIndex = model.index(3, 0); |
| 687 | + const auto processesIndex = model.index(1, 0); |
| 688 | + |
| 689 | + QCOMPARE(model.rowCount(), 4); |
| 690 | + QCOMPARE(proxy.rowCount(), 2); |
| 691 | + |
| 692 | + proxy.setFilterRegularExpression(QStringLiteral("this does not match")); |
| 693 | + QCOMPARE(proxy.rowCount(), 0); |
| 694 | + proxy.setFilterRegularExpression(QString()); |
| 695 | + QCOMPARE(proxy.rowCount(), 2); |
| 696 | + |
| 697 | + // add the first data trace to favourites |
| 698 | + // adding the whole process doesn't work currently |
| 699 | + auto firstProcess = model.index(0, 0, processesIndex); |
| 700 | + model.addToFavorites(model.index(0, 0, firstProcess)); |
| 701 | + |
| 702 | + QCOMPARE(proxy.rowCount(), 3); |
| 703 | + |
| 704 | + model.removeFromFavorites(model.index(0, 0, favoritesIndex)); |
| 705 | + QCOMPARE(proxy.rowCount(), 2); |
| 706 | + } |
| 707 | + |
675 | 708 | void testPrettySymbol_data()
|
676 | 709 | {
|
677 | 710 | QTest::addColumn<QString>("prettySymbol");
|
|
0 commit comments