Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Add test for attribute table sorting
- Loading branch information
Showing
with
32 additions
and
0 deletions.
-
+32
−0
tests/src/gui/testqgsdualview.cpp
|
@@ -50,6 +50,8 @@ class TestQgsDualView : public QObject |
|
|
|
|
|
void testSelectAll(); |
|
|
|
|
|
void testSort(); |
|
|
|
|
|
void testAttributeFormSharedValueScanning(); |
|
|
|
|
|
private: |
|
@@ -141,6 +143,36 @@ void TestQgsDualView::testSelectAll() |
|
|
QVERIFY( mPointsLayer->selectedFeatureCount() == 1 ); |
|
|
} |
|
|
|
|
|
void TestQgsDualView::testSort() |
|
|
{ |
|
|
mDualView->setSortExpression( "Class" ); |
|
|
|
|
|
QStringList classes; |
|
|
classes << "B52" |
|
|
<< "B52" |
|
|
<< "B52" |
|
|
<< "B52" |
|
|
<< "Biplane" |
|
|
<< "Biplane" |
|
|
<< "Biplane" |
|
|
<< "Biplane" |
|
|
<< "Biplane" |
|
|
<< "Jet" |
|
|
<< "Jet" |
|
|
<< "Jet" |
|
|
<< "Jet" |
|
|
<< "Jet" |
|
|
<< "Jet" |
|
|
<< "Jet" |
|
|
<< "Jet"; |
|
|
|
|
|
for ( int i = 0; i < classes.length(); ++i ) |
|
|
{ |
|
|
QModelIndex index = mDualView->tableView()->model()->index( i, 0 ); |
|
|
QCOMPARE( mDualView->tableView()->model()->data( index ).toString(), classes.at( i ) ); |
|
|
} |
|
|
} |
|
|
|
|
|
void TestQgsDualView::testAttributeFormSharedValueScanning() |
|
|
{ |
|
|
// test QgsAttributeForm::scanForEqualAttributes |
|
|