summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-02-23 04:07:06 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-02-23 04:07:06 (GMT)
commit2e417e2a3963151a2b3a3033e6f5bb0e106d8db4 (patch)
treea32fd9333f2408ac024c3d11fb16ce0a60d05508 /tests
parent39d728dd76efa10ca297b76ed08a5cd1c0235b3f (diff)
parent895b9bedc3746723f6c77754df3c428dbc0661d3 (diff)
downloadQt-2e417e2a3963151a2b3a3033e6f5bb0e106d8db4.zip
Qt-2e417e2a3963151a2b3a3033e6f5bb0e106d8db4.tar.gz
Qt-2e417e2a3963151a2b3a3033e6f5bb0e106d8db4.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2: QSortFilterProxyModel: Sorting occured unnecessarily when the dynamicSortFilter is turned off Fix test with gcc 4.0 where QT_USE_FAST_CONCATENATION cannot be enabled. Fix build with wingw Imporve win64 support for mingw Compile Fix a memory hole in QGraphicsItemPrivate. Fix assert in fontengine when using rotated/scaled QStaticText Compilation fix for Symbian Compilation fix for AIX Fix build on Mac OS X Fix compilation Fix compilation on Windows Copy useBackendOptimization setting when QStaticText is detached Compilation on symbian Enable QT_USE_FAST_CONCATENATION by default for compiling Qt Compile with QT_USE_FAST_OPERATOR_PLUS QStringBuilder: Do not resize if not required. QStringBuilder: reduce the size of the generated code
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp38
-rw-r--r--tests/auto/qstatictext/qstatictext.pro2
-rw-r--r--tests/auto/qstringbuilder1/stringbuilder.cpp14
3 files changed, 46 insertions, 8 deletions
diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index 5b2b0cf..56eaf25 100644
--- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -137,6 +137,7 @@ private slots:
void task255652_removeRowsRecursive();
void taskQTBUG_6205_doubleProxySelectionSetSourceModel();
void taskQTBUG_7537_appearsAndSort();
+ void taskQTBUG_7716_unnecessaryDynamicSorting();
protected:
void buildHierarchy(const QStringList &data, QAbstractItemModel *model);
@@ -918,15 +919,16 @@ void tst_QSortFilterProxyModel::removeRows()
QStandardItemModel model;
QSortFilterProxyModel proxy;
proxy.setSourceModel(&model);
- if (sortOrder != -1)
- proxy.sort(0, static_cast<Qt::SortOrder>(sortOrder));
- if (!filter.isEmpty())
- proxy.setFilterRegExp(QRegExp(filter));
// prepare model
foreach (QString s, initial)
model.appendRow(new QStandardItem(s));
+ if (sortOrder != -1)
+ proxy.sort(0, static_cast<Qt::SortOrder>(sortOrder));
+ if (!filter.isEmpty())
+ proxy.setFilterRegExp(QRegExp(filter));
+
// remove the rows
QCOMPARE(proxy.removeRows(position, count, QModelIndex()), success);
QCOMPARE(model.rowCount(QModelIndex()), expectedSource.count());
@@ -2419,6 +2421,7 @@ void tst_QSortFilterProxyModel::sortColumnTracking2()
{
QStandardItemModel model;
QSortFilterProxyModel proxyModel;
+ proxyModel.setDynamicSortFilter(true);
proxyModel.setSourceModel(&model);
proxyModel.sort(0);
@@ -2921,5 +2924,32 @@ void tst_QSortFilterProxyModel::taskQTBUG_7537_appearsAndSort()
QCOMPARE(spyChanged2.count(), 1);
}
+void tst_QSortFilterProxyModel::taskQTBUG_7716_unnecessaryDynamicSorting()
+{
+ QStringListModel model;
+ const QStringList initial = QString("bravo charlie delta echo").split(" ");
+ model.setStringList(initial);
+ QSortFilterProxyModel proxy;
+ proxy.setDynamicSortFilter(false);
+ proxy.setSourceModel(&model);
+ proxy.sort(Qt::AscendingOrder);
+
+ //append two rows
+ int maxrows = proxy.rowCount(QModelIndex());
+ model.insertRows(maxrows, 2);
+ model.setData(model.index(maxrows, 0), QString("alpha"));
+ model.setData(model.index(maxrows + 1, 0), QString("fondue"));
+
+ //append new items to the initial string list and compare with model
+ QStringList expected = initial;
+ expected << QString("alpha") << QString("fondue");
+
+ //if bug 7716 is present, new rows were prepended, when they should have been appended
+ for (int row = 0; row < proxy.rowCount(QModelIndex()); ++row) {
+ QModelIndex index = proxy.index(row, 0, QModelIndex());
+ QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), expected.at(row));
+ }
+}
+
QTEST_MAIN(tst_QSortFilterProxyModel)
#include "tst_qsortfilterproxymodel.moc"
diff --git a/tests/auto/qstatictext/qstatictext.pro b/tests/auto/qstatictext/qstatictext.pro
index a759a90..0f1ca68 100644
--- a/tests/auto/qstatictext/qstatictext.pro
+++ b/tests/auto/qstatictext/qstatictext.pro
@@ -1,4 +1,4 @@
load(qttest_p4)
-QT = core gui opengl
+QT = core gui
SOURCES += tst_qstatictext.cpp
diff --git a/tests/auto/qstringbuilder1/stringbuilder.cpp b/tests/auto/qstringbuilder1/stringbuilder.cpp
index 8e95818..e9ae7a6 100644
--- a/tests/auto/qstringbuilder1/stringbuilder.cpp
+++ b/tests/auto/qstringbuilder1/stringbuilder.cpp
@@ -44,6 +44,14 @@
// "some literal", but replacing all vocals by their umlauted UTF-8 string :)
#define UTF8_LITERAL "s\xc3\xb6m\xc3\xab l\xc3\xaft\xc3\xabr\xc3\xa4l"
+
+//fix for gcc4.0: if the operator+ does not exist without QT_USE_FAST_OPERATOR_PLUS
+#ifndef QT_USE_FAST_CONCATENATION
+#define Q %
+#else
+#define Q P
+#endif
+
void runScenario()
{
// set codec for C strings to 0, enforcing Latin1
@@ -59,13 +67,13 @@ void runScenario()
QString r;
QByteArray ba(LITERAL);
- r = l1literal P l1literal;
+ r = l1literal Q l1literal;
QCOMPARE(r, r2);
r = string P string;
QCOMPARE(r, r2);
- r = stringref P stringref;
+ r = stringref Q stringref;
QCOMPARE(r, QString(stringref.toString() + stringref.toString()));
- r = string P l1literal;
+ r = string Q l1literal;
QCOMPARE(r, r2);
r = string P l1string;
QCOMPARE(r, r2);