summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2010-02-01 06:02:59 (GMT)
committerRohan McGovern <rohan.mcgovern@nokia.com>2010-02-01 06:02:59 (GMT)
commitdc1cab966938edc5463f26189607ece134549a22 (patch)
treeecaab6c64758f41fa9cb5b376b395831a77e6c83 /tests
parent4915439de467d1119a46af66ea08dbe161d2f336 (diff)
parentbde40a9fa852107c237ac408f93a33b5955b9290 (diff)
downloadQt-dc1cab966938edc5463f26189607ece134549a22.zip
Qt-dc1cab966938edc5463f26189607ece134549a22.tar.gz
Qt-dc1cab966938edc5463f26189607ece134549a22.tar.bz2
Merge commit 'oslo1/master' into oslo1-master
Conflicts: doc/src/getting-started/installation.qdoc src/gui/dialogs/qfiledialog_win.cpp tools/assistant/tools/assistant/centralwidget.cpp tools/assistant/tools/assistant/helpviewer.cpp
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/respfile/source1.cpp2
-rw-r--r--tests/auto/modeltest/dynamictreemodel.cpp3
-rw-r--r--tests/auto/modeltest/tst_modeltest.cpp30
-rw-r--r--tests/auto/networkdata/README1
-rw-r--r--tests/auto/qbrush/tst_qbrush.cpp9
-rw-r--r--tests/auto/qcombobox/tst_qcombobox.cpp30
-rw-r--r--tests/auto/qdir/tst_qdir.cpp7
-rw-r--r--tests/auto/qdiriterator/foo/bar/readme.txt0
-rw-r--r--tests/auto/qdiriterator/recursiveDirs/dir1/aPage.html8
-rw-r--r--tests/auto/qdiriterator/recursiveDirs/dir1/textFileB.txt1
-rw-r--r--tests/auto/qdiriterator/recursiveDirs/textFileA.txt1
-rw-r--r--tests/auto/qdiriterator/tst_qdiriterator.cpp129
-rw-r--r--tests/auto/qfileinfo/tst_qfileinfo.cpp15
-rw-r--r--tests/auto/qgl/tst_qgl.cpp41
-rw-r--r--tests/auto/qgraphicsitem/nestedClipping_reference.pngbin638 -> 0 bytes
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp27
-rw-r--r--tests/auto/qhttp/tst_qhttp.cpp30
-rw-r--r--tests/auto/qintvalidator/tst_qintvalidator.cpp26
-rw-r--r--tests/auto/qkeysequence/tst_qkeysequence.cpp13
-rw-r--r--tests/auto/qmetaobject/tst_qmetaobject.cpp4
-rw-r--r--tests/auto/qobject/moc_oldnormalizeobject.cpp113
-rw-r--r--tests/auto/qobject/oldnormalizeobject.h69
-rw-r--r--tests/auto/qobject/tst_qobject.cpp172
-rw-r--r--tests/auto/qobject/tst_qobject.pro22
-rw-r--r--tests/auto/qtoolbar/tst_qtoolbar.cpp31
-rw-r--r--tests/auto/selftests/expected_benchlibcallgrind.txt2
-rw-r--r--tests/auto/selftests/tst_selftests.cpp13
-rwxr-xr-xtests/auto/selftests/xunit/tst_xunitbin11624 -> 0 bytes
-rw-r--r--tests/auto/uiloader/baseline/css_buttons_background.ui39
-rw-r--r--tests/auto/uiloader/baseline/css_qtbug6855.ui57
-rw-r--r--tests/benchmarks/qmetaobject/main.cpp105
-rw-r--r--tests/benchmarks/qstringlist/main.cpp67
-rw-r--r--tests/benchmarks/qstringlist/qstringlist.pro2
-rw-r--r--tests/benchmarks/qvector/outofline.cpp40
34 files changed, 989 insertions, 120 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/good/respfile/source1.cpp b/tests/auto/linguist/lupdate/testdata/good/respfile/source1.cpp
index 3327d1e..33642c4 100644
--- a/tests/auto/linguist/lupdate/testdata/good/respfile/source1.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/respfile/source1.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/tests/auto/modeltest/dynamictreemodel.cpp b/tests/auto/modeltest/dynamictreemodel.cpp
index 24d3ab3..b572eb1 100644
--- a/tests/auto/modeltest/dynamictreemodel.cpp
+++ b/tests/auto/modeltest/dynamictreemodel.cpp
@@ -160,10 +160,11 @@ QVariant DynamicTreeModel::data(const QModelIndex &index, int role) const
void DynamicTreeModel::clear()
{
+ beginResetModel();
m_items.clear();
m_childItems.clear();
nextId = 1;
- reset();
+ endResetModel();
}
diff --git a/tests/auto/modeltest/tst_modeltest.cpp b/tests/auto/modeltest/tst_modeltest.cpp
index 95326d4..da5cd6a 100644
--- a/tests/auto/modeltest/tst_modeltest.cpp
+++ b/tests/auto/modeltest/tst_modeltest.cpp
@@ -67,6 +67,7 @@ private slots:
void standardItemModel();
void testInsertThroughProxy();
void moveSourceItems();
+ void testResetThroughProxy();
};
@@ -225,8 +226,9 @@ public slots:
void storePersistent()
{
- m_persistentSourceIndexes.clear();
- m_persistentProxyIndexes.clear();
+ foreach(const QModelIndex &idx, m_persistentProxyIndexes)
+ Q_ASSERT(idx.isValid()); // This is called from layoutAboutToBeChanged. Persistent indexes should be valid
+
Q_ASSERT(m_proxy->persistent().isEmpty());
storePersistent(QModelIndex());
Q_ASSERT(!m_proxy->persistent().isEmpty());
@@ -243,6 +245,8 @@ public slots:
QModelIndex updatedSource = m_persistentSourceIndexes.at(row);
QCOMPARE(m_proxy->mapToSource(updatedProxy), updatedSource);
}
+ m_persistentSourceIndexes.clear();
+ m_persistentProxyIndexes.clear();
}
private:
@@ -278,6 +282,28 @@ void tst_ModelTest::moveSourceItems()
moveCommand->doCommand();
}
+void tst_ModelTest::testResetThroughProxy()
+{
+ DynamicTreeModel *model = new DynamicTreeModel(this);
+
+ ModelInsertCommand *insertCommand = new ModelInsertCommand(model, this);
+ insertCommand->setStartRow(0);
+ insertCommand->setEndRow(2);
+ insertCommand->doCommand();
+
+ QPersistentModelIndex persistent = model->index(0, 0);
+
+ AccessibleProxyModel *proxy = new AccessibleProxyModel(this);
+ proxy->setSourceModel(model);
+
+ ObservingObject observer(proxy);
+ observer.storePersistent();
+
+ ModelResetCommand *resetCommand = new ModelResetCommand(model, this);
+ resetCommand->setNumCols(0);
+ resetCommand->doCommand();
+}
+
QTEST_MAIN(tst_ModelTest)
#include "tst_modeltest.moc"
diff --git a/tests/auto/networkdata/README b/tests/auto/networkdata/README
deleted file mode 100644
index e8748cc..0000000
--- a/tests/auto/networkdata/README
+++ /dev/null
@@ -1 +0,0 @@
-This directory contains network test data
diff --git a/tests/auto/qbrush/tst_qbrush.cpp b/tests/auto/qbrush/tst_qbrush.cpp
index bc2bc60..628e859 100644
--- a/tests/auto/qbrush/tst_qbrush.cpp
+++ b/tests/auto/qbrush/tst_qbrush.cpp
@@ -108,6 +108,15 @@ void tst_QBrush::operator_eq_eq_data()
<< false;
QTest::newRow("rad vs con") << QBrush(QRadialGradient(0, 0, 0, 0, 0)) << QBrush(QConicalGradient(0, 0, 0)) << false;
+
+ QBrush b1(lg);
+ QBrush b2(lg);
+ b1.setTransform(QTransform().scale(2, 2));
+ QTest::newRow("lg with transform vs same lg") << b1 << b2 << false;
+
+ b2.setTransform(QTransform().scale(2, 2));
+ QTest::newRow("lg w/transform vs same lg w/same transform") << b1 << b2 << true;
+
}
void tst_QBrush::operator_eq_eq()
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp
index fbaa824..1fcea9e 100644
--- a/tests/auto/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/qcombobox/tst_qcombobox.cpp
@@ -156,6 +156,7 @@ private slots:
void resetModel();
void keyBoardNavigationWithMouse();
void task_QTBUG_1071_changingFocusEmitsActivated();
+ void maxVisibleItems();
protected slots:
void onEditTextChanged( const QString &newString );
@@ -2529,5 +2530,34 @@ void tst_QComboBox::task_QTBUG_1071_changingFocusEmitsActivated()
QTRY_COMPARE(spy.count(), 1);
}
+void tst_QComboBox::maxVisibleItems()
+{
+ QComboBox comboBox;
+ QCOMPARE(comboBox.maxVisibleItems(), 10); //default value.
+
+ QStringList content;
+ for(int i = 1; i < 50; i++)
+ content += QString::number(i);
+
+ comboBox.addItems(content);
+ comboBox.show();
+ comboBox.resize(200, comboBox.height());
+ QTRY_VERIFY(comboBox.isVisible());
+
+ comboBox.setMaxVisibleItems(5);
+ QCOMPARE(comboBox.maxVisibleItems(), 5);
+
+ comboBox.showPopup();
+ QTRY_VERIFY(comboBox.view());
+ QTRY_VERIFY(comboBox.view()->isVisible());
+
+ QAbstractItemView *v = comboBox.view();
+ int itemHeight = v->visualRect(v->model()->index(0,0)).height();
+ if (v->style()->styleHint(QStyle::SH_ComboBox_Popup))
+ QCOMPARE(v->viewport()->height(), itemHeight * comboBox.maxVisibleItems());
+ // QCombobox without a popup does not work, see QTBUG-760
+}
+
+
QTEST_MAIN(tst_QComboBox)
#include "tst_qcombobox.moc"
diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp
index c7f9b6b..1d909c9 100644
--- a/tests/auto/qdir/tst_qdir.cpp
+++ b/tests/auto/qdir/tst_qdir.cpp
@@ -982,6 +982,13 @@ tst_QDir::cleanPath_data()
QTest::newRow("data7") << ".//file1.txt" << "file1.txt";
QTest::newRow("data8") << "/foo/bar/..//file1.txt" << "/foo/file1.txt";
QTest::newRow("data9") << "//" << "/";
+#if !defined(Q_OS_WINCE)
+#if defined Q_OS_WIN
+ QTest::newRow("data10") << "c:\\" << "c:/";
+#else
+ QTest::newRow("data10") << "/:/" << "/:";
+#endif
+#endif
}
diff --git a/tests/auto/qdiriterator/foo/bar/readme.txt b/tests/auto/qdiriterator/foo/bar/readme.txt
deleted file mode 100644
index e69de29..0000000
--- a/tests/auto/qdiriterator/foo/bar/readme.txt
+++ /dev/null
diff --git a/tests/auto/qdiriterator/recursiveDirs/dir1/aPage.html b/tests/auto/qdiriterator/recursiveDirs/dir1/aPage.html
deleted file mode 100644
index 51a2261..0000000
--- a/tests/auto/qdiriterator/recursiveDirs/dir1/aPage.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml/">
- <head>
- <title>A title</title>
- </head>
- <body>
- <p>Some text</p>
- </body>
-</html>
diff --git a/tests/auto/qdiriterator/recursiveDirs/dir1/textFileB.txt b/tests/auto/qdiriterator/recursiveDirs/dir1/textFileB.txt
deleted file mode 100644
index 5b1dd02..0000000
--- a/tests/auto/qdiriterator/recursiveDirs/dir1/textFileB.txt
+++ /dev/null
@@ -1 +0,0 @@
-Some Text
diff --git a/tests/auto/qdiriterator/recursiveDirs/textFileA.txt b/tests/auto/qdiriterator/recursiveDirs/textFileA.txt
deleted file mode 100644
index 5b1dd02..0000000
--- a/tests/auto/qdiriterator/recursiveDirs/textFileA.txt
+++ /dev/null
@@ -1 +0,0 @@
-Some Text
diff --git a/tests/auto/qdiriterator/tst_qdiriterator.cpp b/tests/auto/qdiriterator/tst_qdiriterator.cpp
index 6cdd1f7..f6fce32 100644
--- a/tests/auto/qdiriterator/tst_qdiriterator.cpp
+++ b/tests/auto/qdiriterator/tst_qdiriterator.cpp
@@ -71,6 +71,39 @@ public:
tst_QDirIterator();
virtual ~tst_QDirIterator();
+private: // convenience functions
+ QStringList createdDirectories;
+ QStringList createdFiles;
+
+ QDir currentDir;
+ bool createDirectory(const QString &dirName)
+ {
+ if (currentDir.mkdir(dirName)) {
+ createdDirectories.prepend(dirName);
+ return true;
+ }
+ return false;
+ }
+
+ bool createFile(const QString &fileName)
+ {
+ QFile file(fileName);
+ if (file.open(QIODevice::WriteOnly)) {
+ createdFiles << fileName;
+ return true;
+ }
+ return false;
+ }
+
+ bool createLink(const QString &destination, const QString &linkName)
+ {
+ if (QFile::link(destination, linkName)) {
+ createdFiles << linkName;
+ return true;
+ }
+ return false;
+ }
+
private slots:
void iterateRelativeDirectory_data();
void iterateRelativeDirectory();
@@ -96,41 +129,47 @@ tst_QDirIterator::tst_QDirIterator()
QFile::remove("entrylist/directory/entrylist3.lnk");
QFile::remove("entrylist/directory/entrylist4.lnk");
+ createDirectory("entrylist");
+ createDirectory("entrylist/directory");
+ createFile("entrylist/file");
+ createFile("entrylist/writable");
+ createFile("entrylist/directory/dummy");
+
+ createDirectory("recursiveDirs");
+ createDirectory("recursiveDirs/dir1");
+ createFile("recursiveDirs/textFileA.txt");
+ createFile("recursiveDirs/dir1/aPage.html");
+ createFile("recursiveDirs/dir1/textFileB.txt");
+
+ createDirectory("foo");
+ createDirectory("foo/bar");
+ createFile("foo/bar/readme.txt");
+
#ifndef Q_NO_SYMLINKS
# if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
// ### Sadly, this is a platform difference right now.
- QFile::link("entrylist/file", "entrylist/linktofile.lnk");
+ createLink("entrylist/file", "entrylist/linktofile.lnk");
# ifndef Q_NO_SYMLINKS_TO_DIRS
- QFile::link("entrylist/directory", "entrylist/linktodirectory.lnk");
+ createLink("entrylist/directory", "entrylist/linktodirectory.lnk");
# endif
- QFile::link("entrylist/nothing", "entrylist/brokenlink.lnk");
+ createLink("entrylist/nothing", "entrylist/brokenlink.lnk");
# else
- QFile::link("file", "entrylist/linktofile.lnk");
+ createLink("file", "entrylist/linktofile.lnk");
# ifndef Q_NO_SYMLINKS_TO_DIRS
- QFile::link("directory", "entrylist/linktodirectory.lnk");
+ createLink("directory", "entrylist/linktodirectory.lnk");
# endif
- QFile::link("nothing", "entrylist/brokenlink.lnk");
+ createLink("nothing", "entrylist/brokenlink.lnk");
# endif
#endif
- QFile("entrylist/writable").open(QIODevice::ReadWrite);
}
tst_QDirIterator::~tst_QDirIterator()
{
- QFile::remove("entrylist/directory");
- QFile::remove("entrylist/linktofile.lnk");
- QFile::remove("entrylist/linktodirectory.lnk");
- QFile::remove("entrylist/brokenlink.lnk");
- QFile::remove("entrylist/brokenlink");
- QFile::remove("entrylist/writable");
- QFile::remove("entrylist/entrylist1.lnk");
- QFile::remove("entrylist/entrylist2.lnk");
- QFile::remove("entrylist/entrylist3.lnk");
- QFile::remove("entrylist/entrylist4.lnk");
- QFile::remove("entrylist/directory/entrylist1.lnk");
- QFile::remove("entrylist/directory/entrylist2.lnk");
- QFile::remove("entrylist/directory/entrylist3.lnk");
- QFile::remove("entrylist/directory/entrylist4.lnk");
+ Q_FOREACH(QString fileName, createdFiles)
+ QFile::remove(fileName);
+
+ Q_FOREACH(QString dirName, createdDirectories)
+ currentDir.rmdir(dirName);
}
void tst_QDirIterator::iterateRelativeDirectory_data()
@@ -298,23 +337,23 @@ void tst_QDirIterator::stopLinkLoop()
{
#ifdef Q_OS_WIN
// ### Sadly, this is a platform difference right now.
- QFile::link(QDir::currentPath() + QLatin1String("/entrylist"), "entrylist/entrylist1.lnk");
- QFile::link("entrylist/.", "entrylist/entrylist2.lnk");
- QFile::link("entrylist/../entrylist/.", "entrylist/entrylist3.lnk");
- QFile::link("entrylist/..", "entrylist/entrylist4.lnk");
- QFile::link(QDir::currentPath() + QLatin1String("/entrylist"), "entrylist/directory/entrylist1.lnk");
- QFile::link("entrylist/.", "entrylist/directory/entrylist2.lnk");
- QFile::link("entrylist/../directory/.", "entrylist/directory/entrylist3.lnk");
- QFile::link("entrylist/..", "entrylist/directory/entrylist4.lnk");
+ createLink(QDir::currentPath() + QLatin1String("/entrylist"), "entrylist/entrylist1.lnk");
+ createLink("entrylist/.", "entrylist/entrylist2.lnk");
+ createLink("entrylist/../entrylist/.", "entrylist/entrylist3.lnk");
+ createLink("entrylist/..", "entrylist/entrylist4.lnk");
+ createLink(QDir::currentPath() + QLatin1String("/entrylist"), "entrylist/directory/entrylist1.lnk");
+ createLink("entrylist/.", "entrylist/directory/entrylist2.lnk");
+ createLink("entrylist/../directory/.", "entrylist/directory/entrylist3.lnk");
+ createLink("entrylist/..", "entrylist/directory/entrylist4.lnk");
#else
- QFile::link(QDir::currentPath() + QLatin1String("/entrylist"), "entrylist/entrylist1.lnk");
- QFile::link(".", "entrylist/entrylist2.lnk");
- QFile::link("../entrylist/.", "entrylist/entrylist3.lnk");
- QFile::link("..", "entrylist/entrylist4.lnk");
- QFile::link(QDir::currentPath() + QLatin1String("/entrylist"), "entrylist/directory/entrylist1.lnk");
- QFile::link(".", "entrylist/directory/entrylist2.lnk");
- QFile::link("../directory/.", "entrylist/directory/entrylist3.lnk");
- QFile::link("..", "entrylist/directory/entrylist4.lnk");
+ createLink(QDir::currentPath() + QLatin1String("/entrylist"), "entrylist/entrylist1.lnk");
+ createLink(".", "entrylist/entrylist2.lnk");
+ createLink("../entrylist/.", "entrylist/entrylist3.lnk");
+ createLink("..", "entrylist/entrylist4.lnk");
+ createLink(QDir::currentPath() + QLatin1String("/entrylist"), "entrylist/directory/entrylist1.lnk");
+ createLink(".", "entrylist/directory/entrylist2.lnk");
+ createLink("../directory/.", "entrylist/directory/entrylist3.lnk");
+ createLink("..", "entrylist/directory/entrylist4.lnk");
#endif
QDirIterator it(QLatin1String("entrylist"), QDirIterator::Subdirectories | QDirIterator::FollowSymlinks);
@@ -325,22 +364,6 @@ void tst_QDirIterator::stopLinkLoop()
QVERIFY(max);
// The goal of this test is only to ensure that the test above don't malfunction
-
-#ifdef Q_OS_WIN
- // ### Sadly, this is a platform difference right now.
- QFile::link(QDir::currentPath() + QLatin1String("/entrylist"), "entrylist/entrylist1.lnk");
- QFile::link("../../entrylist/.", "entrylist/entrylist2.lnk");
- QFile::link("entrylist/..", "entrylist/entrylist3.lnk");
-#else
- QFile::remove("entrylist/entrylist1.lnk");
- QFile::remove("entrylist/entrylist2.lnk");
- QFile::remove("entrylist/entrylist3.lnk");
- QFile::remove("entrylist/entrylist4.lnk");
- QFile::remove("entrylist/directory/entrylist1.lnk");
- QFile::remove("entrylist/directory/entrylist2.lnk");
- QFile::remove("entrylist/directory/entrylist3.lnk");
- QFile::remove("entrylist/directory/entrylist4.lnk");
-#endif
}
class EngineWithNoIterator : public QFSFileEngine
diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp
index fdc629a..42e7250 100644
--- a/tests/auto/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp
@@ -828,6 +828,17 @@ void tst_QFileInfo::compare_data()
QTest::addColumn<QString>("file2");
QTest::addColumn<bool>("same");
+#if defined(Q_OS_MAC)
+ // Since 10.6 we use realpath() in qfsfileengine, and it properly handles
+ // file system case sensitivity. However here in the autotest we don't
+ // check if the file system is case sensitive, so to make it pass in the
+ // default OS X installation we assume we are running on a case insensitive
+ // file system if on 10.6 and on a case sensitive file system if on 10.5
+ bool caseSensitiveOnMac = true;
+ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6)
+ caseSensitiveOnMac = false;
+#endif
+
QTest::newRow("data0")
<< QString::fromLatin1(SRCDIR "tst_qfileinfo.cpp")
<< QString::fromLatin1(SRCDIR "tst_qfileinfo.cpp")
@@ -845,6 +856,8 @@ void tst_QFileInfo::compare_data()
<< QString::fromLatin1(SRCDIR "tst_qfileinfo.cpp")
#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
<< true;
+#elif defined(Q_OS_MAC)
+ << !caseSensitiveOnMac;
#else
<< false;
#endif
@@ -856,7 +869,7 @@ void tst_QFileInfo::compare()
QFETCH(QString, file2);
QFETCH(bool, same);
QFileInfo fi1(file1), fi2(file2);
- QCOMPARE(same, fi1 == fi2);
+ QCOMPARE(fi1 == fi2, same);
}
void tst_QFileInfo::consistent_data()
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp
index cf4616e..d0d69ae 100644
--- a/tests/auto/qgl/tst_qgl.cpp
+++ b/tests/auto/qgl/tst_qgl.cpp
@@ -425,6 +425,26 @@ void tst_QGL::getSetCheck()
obj1.setPlane(TEST_INT_MAX);
QCOMPARE(TEST_INT_MAX, obj1.plane());
+ // int QGLFormat::major/minorVersion()
+ // void QGLFormat::setVersion(int, int)
+ QCOMPARE(obj1.majorVersion(), 1);
+ QCOMPARE(obj1.minorVersion(), 0);
+ obj1.setVersion(3, 2);
+ QCOMPARE(obj1.majorVersion(), 3);
+ QCOMPARE(obj1.minorVersion(), 2);
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setVersion: Cannot set zero or negative version number 0.1");
+ obj1.setVersion(0, 1);
+ QCOMPARE(obj1.majorVersion(), 3);
+ QCOMPARE(obj1.minorVersion(), 2);
+ QTest::ignoreMessage(QtWarningMsg, "QGLFormat::setVersion: Cannot set zero or negative version number 3.-1");
+ obj1.setVersion(3, -1);
+ QCOMPARE(obj1.majorVersion(), 3);
+ QCOMPARE(obj1.minorVersion(), 2);
+ obj1.setVersion(TEST_INT_MAX, TEST_INT_MAX - 1);
+ QCOMPARE(obj1.majorVersion(), TEST_INT_MAX);
+ QCOMPARE(obj1.minorVersion(), TEST_INT_MAX - 1);
+
+
// operator== and operator!= for QGLFormat
QGLFormat format1;
QGLFormat format2;
@@ -508,6 +528,27 @@ void tst_QGL::getSetCheck()
QVERIFY(format1 == format2);
QVERIFY(!(format1 != format2));
+ format1.setVersion(3, 2);
+ QVERIFY(!(format1 == format2));
+ QVERIFY(format1 != format2);
+ format2.setVersion(3, 2);
+ QVERIFY(format1 == format2);
+ QVERIFY(!(format1 != format2));
+
+ format1.setProfile(QGLFormat::CoreProfile);
+ QVERIFY(!(format1 == format2));
+ QVERIFY(format1 != format2);
+ format2.setProfile(QGLFormat::CoreProfile);
+ QVERIFY(format1 == format2);
+ QVERIFY(!(format1 != format2));
+
+ format1.setOption(QGL::NoDeprecatedFunctions);
+ QVERIFY(!(format1 == format2));
+ QVERIFY(format1 != format2);
+ format2.setOption(QGL::NoDeprecatedFunctions);
+ QVERIFY(format1 == format2);
+ QVERIFY(!(format1 != format2));
+
// Copy constructor and assignment for QGLFormat.
QGLFormat format3(format1);
QGLFormat format4;
diff --git a/tests/auto/qgraphicsitem/nestedClipping_reference.png b/tests/auto/qgraphicsitem/nestedClipping_reference.png
deleted file mode 100644
index 3bd4fe7..0000000
--- a/tests/auto/qgraphicsitem/nestedClipping_reference.png
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index 909ea54..ac68224 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -163,6 +163,7 @@ private slots:
void addChildInpolishEvent();
void polishEvent();
void polishEvent2();
+ void autoFillBackground();
// Task fixes
void task236127_bspTreeIndexFails();
@@ -2856,6 +2857,32 @@ void tst_QGraphicsWidget::polishEvent2()
QVERIFY(widget->events.contains(QEvent::Polish));
}
+void tst_QGraphicsWidget::autoFillBackground()
+{
+ QGraphicsWidget *widget = new QGraphicsWidget;
+ QCOMPARE(widget->autoFillBackground(), false);
+ widget->setAutoFillBackground(true);
+ QCOMPARE(widget->autoFillBackground(), true);
+
+ const QColor color(Qt::red);
+ const QRect rect(0, 0, 1, 1);
+
+ QGraphicsScene scene;
+ scene.addItem(widget);
+ widget->setGeometry(rect);
+
+ QPalette palette = widget->palette();
+ palette.setColor(QPalette::Window, color);
+ widget->setPalette(palette);
+
+ QImage image(rect.size(), QImage::Format_RGB32);
+ QPainter painter;
+ painter.begin(&image);
+ scene.render(&painter, rect, rect);
+ painter.end();
+ QCOMPARE(image.pixel(0, 0), color.rgb());
+}
+
void tst_QGraphicsWidget::QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems()
{
QGraphicsScene scene;
diff --git a/tests/auto/qhttp/tst_qhttp.cpp b/tests/auto/qhttp/tst_qhttp.cpp
index 59bfb15..320225d 100644
--- a/tests/auto/qhttp/tst_qhttp.cpp
+++ b/tests/auto/qhttp/tst_qhttp.cpp
@@ -114,9 +114,6 @@ private slots:
void abortInReadyRead();
void abortInResponseHeaderReceived();
void nestedEventLoop();
-
-
- // manual tests
void connectionClose();
protected slots:
@@ -175,6 +172,23 @@ private:
bool proxyAuthCalled;
};
+class ClosingServer: public QTcpServer
+{
+ Q_OBJECT
+public:
+ ClosingServer()
+ {
+ connect(this, SIGNAL(newConnection()), SLOT(handleConnection()));
+ listen();
+ }
+
+public slots:
+ void handleConnection()
+ {
+ delete nextPendingConnection();
+ }
+};
+
//#define DUMP_SIGNALS
const int bytesTotal_init = -10;
@@ -1491,20 +1505,14 @@ void tst_QHttp::abortInResponseHeaderReceived()
void tst_QHttp::connectionClose()
{
- // This test tries to connect to a client's server, so it is disabled.
- // Every now and then, someone please run it to make sure it's not broken.
- // Note: the servers might change too...
- //
// This was added in response to bug 176822
-#ifndef Q_OS_SYMBIAN
- QSKIP("This test is manual - read comments in the source code", SkipAll);
-#endif
QFETCH_GLOBAL(bool, setProxy);
if (setProxy)
return;
QHttp http;
- http.setHost("www.fon.com", QHttp::ConnectionModeHttps);
+ ClosingServer server;
+ http.setHost("localhost", QHttp::ConnectionModeHttps, server.serverPort());
http.get("/login/gateway/processLogin");
// another possibility:
diff --git a/tests/auto/qintvalidator/tst_qintvalidator.cpp b/tests/auto/qintvalidator/tst_qintvalidator.cpp
index 72e7f7a..46ad0dd 100644
--- a/tests/auto/qintvalidator/tst_qintvalidator.cpp
+++ b/tests/auto/qintvalidator/tst_qintvalidator.cpp
@@ -50,6 +50,7 @@ private slots:
void validate_data();
void validate();
void validateArabic();
+ void validateFrench();
};
Q_DECLARE_METATYPE(QValidator::State);
@@ -182,6 +183,30 @@ void tst_QIntValidator::validateArabic()
}
+
+void tst_QIntValidator::validateFrench()
+{
+ QIntValidator validator(-2000, 2000, 0);
+ validator.setLocale(QLocale::French);
+ int i;
+
+ QString s = QLatin1String("1 ");
+ QCOMPARE(validator.validate(s, i), QValidator::Acceptable);
+ validator.fixup(s);
+ QCOMPARE(s, s);
+
+ s = QLatin1String("1 000");
+ QCOMPARE(validator.validate(s, i), QValidator::Acceptable);
+ validator.fixup(s);
+ QCOMPARE(s, s);
+
+
+ s = QLatin1String("1 0 00");
+ QCOMPARE(validator.validate(s, i), QValidator::Intermediate);
+ validator.fixup(s);
+ QCOMPARE(s, validator.locale().toString(1000));
+}
+
void tst_QIntValidator::validate()
{
QFETCH(int, minimum);
@@ -190,6 +215,7 @@ void tst_QIntValidator::validate()
QFETCH(QValidator::State, state);
QIntValidator iv(minimum, maximum, 0);
+ iv.setLocale(QLocale::C);
int dummy;
QCOMPARE((int)iv.validate(value, dummy), (int)state);
}
diff --git a/tests/auto/qkeysequence/tst_qkeysequence.cpp b/tests/auto/qkeysequence/tst_qkeysequence.cpp
index 3e3f202..b1ef223 100644
--- a/tests/auto/qkeysequence/tst_qkeysequence.cpp
+++ b/tests/auto/qkeysequence/tst_qkeysequence.cpp
@@ -119,6 +119,7 @@ private slots:
void symetricConstructors_data();
void symetricConstructors();
void checkMultipleNames();
+ void checkMultipleCodes();
void mnemonic_data();
void mnemonic();
void toString_data();
@@ -265,6 +266,18 @@ void tst_QKeySequence::checkMultipleNames()
QVERIFY( oldK == newK );
}
+//TODO: could test third constructor, or test fromString on all constructor-data
+void tst_QKeySequence::checkMultipleCodes()
+{
+ QKeySequence seq1("Alt+d, l");
+ QKeySequence seq2 = QKeySequence::fromString("Alt+d, l");
+ QVERIFY( seq1 == seq2 );
+
+ QKeySequence seq3("Alt+d,l");
+ QKeySequence seq4 = QKeySequence::fromString("Alt+d,l");
+ QVERIFY( seq3 == seq4 );
+}
+
/*
* We must ensure that the keyBindings data is allways sorted
* so that we can safely perform binary searches.
diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp
index 286e793..15b6204 100644
--- a/tests/auto/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp
@@ -664,7 +664,7 @@ void tst_QMetaObject::normalizedSignature_data()
QTest::newRow("const rettype") << "const QString *foo()" << "const QString*foo()";
QTest::newRow("const ref") << "const QString &foo()" << "const QString&foo()";
QTest::newRow("reference") << "QString &foo()" << "QString&foo()";
- QTest::newRow("const2") << "void foo(QString const *)" << "void foo(const QString*)";
+ QTest::newRow("const1") << "void foo(QString const *)" << "void foo(const QString*)";
QTest::newRow("const2") << "void foo(QString * const)" << "void foo(QString*const)";
QTest::newRow("const3") << "void foo(QString const &)" << "void foo(QString)";
QTest::newRow("const4") << "void foo(const int)" << "void foo(int)";
@@ -672,7 +672,7 @@ void tst_QMetaObject::normalizedSignature_data()
<< "void foo(int,int,int,int)";
QTest::newRow("const6") << "void foo(QList<const int>)" << "void foo(QList<const int>)";
QTest::newRow("const7") << "void foo(QList<const int*>)" << "void foo(QList<const int*>)";
- QTest::newRow("const7") << "void foo(QList<int const*>)" << "void foo(QList<const int*>)";
+ QTest::newRow("const8") << "void foo(QList<int const*>)" << "void foo(QList<const int*>)";
}
void tst_QMetaObject::normalizedSignature()
diff --git a/tests/auto/qobject/moc_oldnormalizeobject.cpp b/tests/auto/qobject/moc_oldnormalizeobject.cpp
new file mode 100644
index 0000000..bde9c39
--- /dev/null
+++ b/tests/auto/qobject/moc_oldnormalizeobject.cpp
@@ -0,0 +1,113 @@
+/****************************************************************************
+** Meta object code from reading C++ file 'oldnormalizeobject.h'
+**
+** Created: Wed Nov 18 11:43:05 2009
+** by: The Qt Meta Object Compiler version 62 (Qt 4.6.0)
+**
+*****************************************************************************/
+
+// Yhis file was generated from moc version 4.6 to test binary compatibility
+// It should *not* be generated by the current moc
+
+#include "oldnormalizeobject.h"
+
+QT_BEGIN_MOC_NAMESPACE
+static const uint qt_meta_data_OldNormalizeObject[] = {
+
+ // content:
+ 4, // revision
+ 0, // classname
+ 0, 0, // classinfo
+ 6, 14, // methods
+ 0, 0, // properties
+ 0, 0, // enums/sets
+ 0, 0, // constructors
+ 0, // flags
+ 3, // signalCount
+
+ // signals: signature, parameters, type, tag, flags
+ 24, 20, 19, 19, 0x05,
+ 57, 20, 19, 19, 0x05,
+ 100, 20, 19, 19, 0x05,
+
+ // slots: signature, parameters, type, tag, flags
+ 149, 20, 19, 19, 0x0a,
+ 180, 20, 19, 19, 0x0a,
+ 221, 20, 19, 19, 0x0a,
+
+ 0 // eod
+};
+
+static const char qt_meta_stringdata_OldNormalizeObject[] = {
+ "OldNormalizeObject\0\0ref\0"
+ "typeRefSignal(Template<Class&>&)\0"
+ "constTypeRefSignal(Template<const Class&>)\0"
+ "typeConstRefSignal(Template<const Class&>const&)\0"
+ "typeRefSlot(Template<Class&>&)\0"
+ "constTypeRefSlot(Template<const Class&>)\0"
+ "typeConstRefSlot(Template<const Class&>const&)\0"
+};
+
+const QMetaObject OldNormalizeObject::staticMetaObject = {
+ { &QObject::staticMetaObject, qt_meta_stringdata_OldNormalizeObject,
+ qt_meta_data_OldNormalizeObject, 0 }
+};
+
+#ifdef Q_NO_DATA_RELOCATION
+const QMetaObject &OldNormalizeObject::getStaticMetaObject() { return staticMetaObject; }
+#endif //Q_NO_DATA_RELOCATION
+
+const QMetaObject *OldNormalizeObject::metaObject() const
+{
+ return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
+}
+
+void *OldNormalizeObject::qt_metacast(const char *_clname)
+{
+ if (!_clname) return 0;
+ if (!strcmp(_clname, qt_meta_stringdata_OldNormalizeObject))
+ return static_cast<void*>(const_cast< OldNormalizeObject*>(this));
+ return QObject::qt_metacast(_clname);
+}
+
+int OldNormalizeObject::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+ _id = QObject::qt_metacall(_c, _id, _a);
+ if (_id < 0)
+ return _id;
+ if (_c == QMetaObject::InvokeMetaMethod) {
+ switch (_id) {
+ case 0: typeRefSignal((*reinterpret_cast< Template<Class&>(*)>(_a[1]))); break;
+ case 1: constTypeRefSignal((*reinterpret_cast< const Template<const Class&>(*)>(_a[1]))); break;
+ case 2: typeConstRefSignal((*reinterpret_cast< Template<const Class&>const(*)>(_a[1]))); break;
+ case 3: typeRefSlot((*reinterpret_cast< Template<Class&>(*)>(_a[1]))); break;
+ case 4: constTypeRefSlot((*reinterpret_cast< const Template<const Class&>(*)>(_a[1]))); break;
+ case 5: typeConstRefSlot((*reinterpret_cast< Template<const Class&>const(*)>(_a[1]))); break;
+ default: ;
+ }
+ _id -= 6;
+ }
+ return _id;
+}
+
+// SIGNAL 0
+void OldNormalizeObject::typeRefSignal(Template<Class&> & _t1)
+{
+ void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
+ QMetaObject::activate(this, &staticMetaObject, 0, _a);
+}
+
+// SIGNAL 1
+void OldNormalizeObject::constTypeRefSignal(const Template<const Class&> & _t1)
+{
+ void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
+ QMetaObject::activate(this, &staticMetaObject, 1, _a);
+}
+
+// SIGNAL 2
+void OldNormalizeObject::typeConstRefSignal(Template<Class const&> const & _t1)
+{
+ void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
+ QMetaObject::activate(this, &staticMetaObject, 2, _a);
+}
+QT_END_MOC_NAMESPACE
diff --git a/tests/auto/qobject/oldnormalizeobject.h b/tests/auto/qobject/oldnormalizeobject.h
new file mode 100644
index 0000000..3adf04d
--- /dev/null
+++ b/tests/auto/qobject/oldnormalizeobject.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtTest module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef OLDNORMALIZEOBJECT_H
+#define OLDNORMALIZEOBJECT_H
+
+#include <QObject>
+
+struct Struct;
+class Class;
+template <typename T> class Template;
+
+// An object with old moc output that incorrectly normalizes 'T<C> const &' in the function
+// signatures
+class OldNormalizeObject : public QObject
+{
+ /* tmake ignore Q_OBJECT */
+ Q_OBJECT
+
+signals:
+ void typeRefSignal(Template<Class &> &ref);
+ void constTypeRefSignal(const Template<const Class &> &ref);
+ void typeConstRefSignal(Template<Class const &> const &ref);
+
+public slots:
+ void typeRefSlot(Template<Class &> &) {}
+ void constTypeRefSlot(const Template<const Class &> &) {}
+ void typeConstRefSlot(Template<Class const &> const &) {}
+};
+
+#endif // OLDNORMALIZEOBJECT_H
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index 4fa6aaa..3896d70 100644
--- a/tests/auto/qobject/tst_qobject.cpp
+++ b/tests/auto/qobject/tst_qobject.cpp
@@ -2024,6 +2024,7 @@ enum Enum { };
struct Struct { };
class Class { };
+template <typename T> class Template { };
class NormalizeObject : public QObject
{
@@ -2061,6 +2062,12 @@ signals:
void unsignedshortSignal(unsigned short);
void unsignedcharSignal(unsigned char);
+ void typeRefSignal(Template<Class &> &ref);
+ void constTypeRefSignal(const Template<Class const &> &ref);
+ void typeConstRefSignal(Template<Class const &> const &ref);
+
+ void typePointerConstRefSignal(Class * const &);
+
public slots:
void uintPointerSlot(uint *) { }
void ulongPointerSlot(ulong *) { }
@@ -2092,8 +2099,15 @@ public slots:
void unsignedshortSlot(unsigned short) {};
void unsignedcharSlot(unsigned char) {};
+ void typeRefSlot(Template<Class &> &) {}
+ void constTypeRefSlot(const Template<const Class &> &) {}
+ void typeConstRefSlot(Template<Class const &> const &) {}
+
+ void typePointerConstRefSlot(Class * const &) {}
};
+#include "oldnormalizeobject.h"
+
void tst_QObject::normalize()
{
NormalizeObject object;
@@ -2333,7 +2347,165 @@ void tst_QObject::normalize()
SIGNAL(unsignedcharSignal(unsigned char)),
SLOT(unsignedcharSlot(unsigned char))));
+ // connect when original template signature and mixed usage of 'T<C const &> const &',
+ // 'const T<const C &> &', and 'T<const C &>'
+
+ QVERIFY(object.connect(&object,
+ SIGNAL(typeRefSignal(Template<Class &> &)),
+ SLOT(typeRefSlot(Template<Class &> &))));
+
+ QVERIFY(object.connect(&object,
+ SIGNAL(constTypeRefSignal(const Template<const Class &> &)),
+ SLOT(constTypeRefSlot(const Template<const Class &> &))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(constTypeRefSignal(const Template<const Class &> &)),
+ SLOT(constTypeRefSlot(const Template<Class const &> &))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(constTypeRefSignal(const Template<const Class &> &)),
+ SLOT(constTypeRefSlot(Template<Class const &> const &))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(constTypeRefSignal(Template<const Class &> const &)),
+ SLOT(constTypeRefSlot(Template<Class const &> const &))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(constTypeRefSignal(Template<Class const &> const &)),
+ SLOT(constTypeRefSlot(Template<Class const &> const &))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(constTypeRefSignal(const Template<const Class &> &)),
+ SLOT(typeConstRefSlot(const Template<const Class &> &))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(constTypeRefSignal(const Template<const Class &> &)),
+ SLOT(typeConstRefSlot(const Template<Class const &> &))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(constTypeRefSignal(const Template<const Class &> &)),
+ SLOT(typeConstRefSlot(Template<Class const &> const &))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(constTypeRefSignal(Template<const Class &> const &)),
+ SLOT(typeConstRefSlot(Template<Class const &> const &))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(constTypeRefSignal(Template<Class const &> const &)),
+ SLOT(typeConstRefSlot(Template<Class const &> const &))));
+
+ QVERIFY(object.connect(&object,
+ SIGNAL(typeConstRefSignal(const Template<const Class &> &)),
+ SLOT(constTypeRefSlot(const Template<const Class &> &))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(typeConstRefSignal(const Template<const Class &> &)),
+ SLOT(constTypeRefSlot(const Template<Class const &> &))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(typeConstRefSignal(const Template<const Class &> &)),
+ SLOT(constTypeRefSlot(Template<Class const &> const &))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(typeConstRefSignal(Template<const Class &> const &)),
+ SLOT(constTypeRefSlot(Template<Class const &> const &))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(typeConstRefSignal(Template<Class const &> const &)),
+ SLOT(constTypeRefSlot(Template<Class const &> const &))));
+
+ QVERIFY(object.connect(&object,
+ SIGNAL(typeConstRefSignal(const Template<const Class &> &)),
+ SLOT(typeConstRefSlot(const Template<const Class &> &))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(typeConstRefSignal(const Template<const Class &> &)),
+ SLOT(typeConstRefSlot(const Template<Class const &> &))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(typeConstRefSignal(const Template<const Class &> &)),
+ SLOT(typeConstRefSlot(Template<Class const &> const &))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(typeConstRefSignal(Template<const Class &> const &)),
+ SLOT(typeConstRefSlot(Template<Class const &> const &))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(typeConstRefSignal(Template<Class const &> const &)),
+ SLOT(typeConstRefSlot(Template<Class const &> const &))));
+
+ // same test again, this time with an object compiled with old moc output... we know that
+ // it is not possible to connect everything, whic is the purpose for this test
+ OldNormalizeObject oldobject;
+
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(constTypeRefSignal(const Template<const Class &> &)),
+ SLOT(constTypeRefSlot(const Template<const Class &> &))));
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(constTypeRefSignal(const Template<const Class &> &)),
+ SLOT(constTypeRefSlot(const Template<Class const &> &))));
+ // this fails in older versions, but passes now due to proper normalizing
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(constTypeRefSignal(const Template<const Class &> &)),
+ SLOT(constTypeRefSlot(Template<Class const &> const &))));
+ // this fails in older versions, but passes now due to proper normalizing
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(constTypeRefSignal(Template<const Class &> const &)),
+ SLOT(constTypeRefSlot(Template<Class const &> const &))));
+ // this fails in older versions, but passes now due to proper normalizing
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(constTypeRefSignal(Template<Class const &> const &)),
+ SLOT(constTypeRefSlot(Template<Class const &> const &))));
+
+ // these fail in older Qt versions, but pass now due to proper normalizing
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(constTypeRefSignal(const Template<const Class &> &)),
+ SLOT(typeConstRefSlot(const Template<const Class &> &))));
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(constTypeRefSignal(const Template<const Class &> &)),
+ SLOT(typeConstRefSlot(const Template<Class const &> &))));
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(constTypeRefSignal(const Template<const Class &> &)),
+ SLOT(typeConstRefSlot(Template<Class const &> const &))));
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(constTypeRefSignal(Template<const Class &> const &)),
+ SLOT(typeConstRefSlot(Template<Class const &> const &))));
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(constTypeRefSignal(Template<Class const &> const &)),
+ SLOT(typeConstRefSlot(Template<Class const &> const &))));
+
+ // these also fail in older Qt versions, but pass now due to proper normalizing
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(typeConstRefSignal(const Template<const Class &> &)),
+ SLOT(constTypeRefSlot(const Template<const Class &> &))));
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(typeConstRefSignal(const Template<const Class &> &)),
+ SLOT(constTypeRefSlot(const Template<Class const &> &))));
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(typeConstRefSignal(const Template<const Class &> &)),
+ SLOT(constTypeRefSlot(Template<Class const &> const &))));
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(typeConstRefSignal(Template<const Class &> const &)),
+ SLOT(constTypeRefSlot(Template<Class const &> const &))));
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(typeConstRefSignal(Template<Class const &> const &)),
+ SLOT(constTypeRefSlot(Template<Class const &> const &))));
+
+ // this fails in older versions, but passes now due to proper normalizing
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(typeConstRefSignal(const Template<const Class &> &)),
+ SLOT(typeConstRefSlot(const Template<const Class &> &))));
+ // this fails in older versions, but passes now due to proper normalizing
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(typeConstRefSignal(const Template<const Class &> &)),
+ SLOT(typeConstRefSlot(const Template<Class const &> &))));
+ // this fails in older versions, but passes now due to proper normalizing
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(typeConstRefSignal(const Template<const Class &> &)),
+ SLOT(typeConstRefSlot(Template<Class const &> const &))));
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(typeConstRefSignal(Template<const Class &> const &)),
+ SLOT(typeConstRefSlot(Template<Class const &> const &))));
+ QVERIFY(oldobject.connect(&oldobject,
+ SIGNAL(typeConstRefSignal(Template<Class const &> const &)),
+ SLOT(typeConstRefSlot(Template<Class const &> const &))));
+
+ QVERIFY(object.connect(&object,
+ SIGNAL(typePointerConstRefSignal(Class*const&)),
+ SLOT(typePointerConstRefSlot(Class*const&))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(typePointerConstRefSignal(Class*const&)),
+ SLOT(typePointerConstRefSlot(Class*))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(typePointerConstRefSignal(Class*)),
+ SLOT(typePointerConstRefSlot(Class*const&))));
+ QVERIFY(object.connect(&object,
+ SIGNAL(typePointerConstRefSignal(Class*)),
+ SLOT(typePointerConstRefSlot(Class*))));
}
class SiblingDeleter : public QObject
diff --git a/tests/auto/qobject/tst_qobject.pro b/tests/auto/qobject/tst_qobject.pro
index 003ee98..0200f3e 100644
--- a/tests/auto/qobject/tst_qobject.pro
+++ b/tests/auto/qobject/tst_qobject.pro
@@ -1,16 +1,20 @@
load(qttest_p4)
-SOURCES += tst_qobject.cpp
+SOURCES += tst_qobject.cpp
-QT = core network gui
-contains(QT_CONFIG, qt3support):DEFINES+=QT_HAS_QT3SUPPORT
+# this is here for a reason, moc_oldnormalizedobject.cpp is not auto-generated, it was generated by
+# moc from Qt 4.6, and should *not* be generated by the current moc
+SOURCES += moc_oldnormalizeobject.cpp
-wince*: {
- addFiles.sources = signalbug.exe
- addFiles.path = .
- DEPLOYMENT += addFiles
+QT = core \
+ network \
+ gui
+contains(QT_CONFIG, qt3support):DEFINES += QT_HAS_QT3SUPPORT
+wince*: {
+ addFiles.sources = signalbug.exe
+ addFiles.path = .
+ DEPLOYMENT += addFiles
}
-
-symbian: {
+symbian: {
addFiles.sources = signalbug.exe
addFiles.path = \sys\bin
DEPLOYMENT += addFiles
diff --git a/tests/auto/qtoolbar/tst_qtoolbar.cpp b/tests/auto/qtoolbar/tst_qtoolbar.cpp
index e00597d..07e81c1 100644
--- a/tests/auto/qtoolbar/tst_qtoolbar.cpp
+++ b/tests/auto/qtoolbar/tst_qtoolbar.cpp
@@ -102,6 +102,7 @@ private slots:
void orientationChanged();
void iconSizeChanged();
void toolButtonStyleChanged();
+ void visibilityChanged();
void actionOwnership();
void widgetAction();
void accel();
@@ -998,6 +999,36 @@ void tst_QToolBar::iconSizeChanged()
void tst_QToolBar::toolButtonStyleChanged()
{ DEPENDS_ON("toolButtonStyle()"); }
+void tst_QToolBar::visibilityChanged()
+{
+ QMainWindow mw;
+ QToolBar tb;
+ QSignalSpy spy(&tb, SIGNAL(visibilityChanged(bool)));
+
+ mw.addToolBar(&tb);
+ mw.show();
+
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.at(0).at(0).toBool(), true);
+ spy.clear();
+
+ tb.hide();
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.at(0).at(0).toBool(), false);
+ spy.clear();
+
+ tb.hide();
+ QCOMPARE(spy.count(), 0);
+
+ tb.show();
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.at(0).at(0).toBool(), true);
+ spy.clear();
+
+ tb.show();
+ QCOMPARE(spy.count(), 0);
+}
+
void tst_QToolBar::actionOwnership()
{
{
diff --git a/tests/auto/selftests/expected_benchlibcallgrind.txt b/tests/auto/selftests/expected_benchlibcallgrind.txt
index caf2424..f172711 100644
--- a/tests/auto/selftests/expected_benchlibcallgrind.txt
+++ b/tests/auto/selftests/expected_benchlibcallgrind.txt
@@ -2,7 +2,7 @@
Config: Using QTest library 4.5.0, Qt 4.5.0
PASS : tst_BenchlibCallgrind::initTestCase()
RESULT : tst_BenchlibCallgrind::twoHundredMillionInstructions():
- 200,000,000 instr. loads per iteration (total: 200000000, iterations: 1)
+ 200,000,000 instruction reads per iteration (total: 200000000, iterations: 1)
PASS : tst_BenchlibCallgrind::twoHundredMillionInstructions()
PASS : tst_BenchlibCallgrind::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp
index 89ece0f..6608439 100644
--- a/tests/auto/selftests/tst_selftests.cpp
+++ b/tests/auto/selftests/tst_selftests.cpp
@@ -97,7 +97,7 @@ inline bool qCompare
if (r1.unit == "msec") {
variance = 0.1;
}
- else if (r1.unit == "instr. loads") {
+ else if (r1.unit == "instruction reads") {
variance = 0.001;
}
else if (r1.unit == "ticks") {
@@ -434,7 +434,7 @@ BenchmarkResult BenchmarkResult::parse(QString const& line, QString* error)
/* This code avoids using a QRegExp because QRegExp might be broken. */
- /* Sample format: 4,000 msec per iteration (total: 4000, iterations: 1) */
+ /* Sample format: 4,000 msec per iteration (total: 4,000, iterations: 1) */
QString sFirstNumber;
while (!remaining.isEmpty() && !remaining.at(0).isSpace()) {
@@ -468,7 +468,7 @@ BenchmarkResult BenchmarkResult::parse(QString const& line, QString* error)
remaining = remaining.mid(sizeof(periterbit)-1);
- /* Remaining: 4000, iterations: 1) */
+ /* Remaining: 4,000, iterations: 1) */
static const char itersbit[] = ", iterations: ";
QString sTotal;
while (!remaining.startsWith(itersbit) && !remaining.isEmpty()) {
@@ -482,9 +482,12 @@ BenchmarkResult BenchmarkResult::parse(QString const& line, QString* error)
remaining = remaining.mid(sizeof(itersbit)-1);
- qint64 total = sTotal.toLongLong(&ok);
+ /* 4,000 -> 4000 */
+ sTotal.remove(',');
+
+ double total = sTotal.toDouble(&ok);
if (!ok) {
- if (error) *error = sTotal + " (total) is not a valid integer";
+ if (error) *error = sTotal + " (total) is not a valid number";
return out;
}
diff --git a/tests/auto/selftests/xunit/tst_xunit b/tests/auto/selftests/xunit/tst_xunit
deleted file mode 100755
index 31d03a8..0000000
--- a/tests/auto/selftests/xunit/tst_xunit
+++ /dev/null
Binary files differ
diff --git a/tests/auto/uiloader/baseline/css_buttons_background.ui b/tests/auto/uiloader/baseline/css_buttons_background.ui
index f1fa0bc..3d80aeb 100644
--- a/tests/auto/uiloader/baseline/css_buttons_background.ui
+++ b/tests/auto/uiloader/baseline/css_buttons_background.ui
@@ -89,6 +89,19 @@ color: yellow;
</property>
</widget>
</item>
+ <item row="5" column="0">
+ <widget class="QPushButton" name="pushButton_4">
+ <property name="text">
+ <string>Checked</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
@@ -149,6 +162,19 @@ color: yellow;
</property>
</widget>
</item>
+ <item row="5" column="0">
+ <widget class="QPushButton" name="pushButton_5">
+ <property name="text">
+ <string>Checked</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
@@ -209,6 +235,19 @@ color: yellow;
</property>
</widget>
</item>
+ <item row="5" column="0">
+ <widget class="QPushButton" name="pushButton_6">
+ <property name="text">
+ <string>Checked</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
diff --git a/tests/auto/uiloader/baseline/css_qtbug6855.ui b/tests/auto/uiloader/baseline/css_qtbug6855.ui
new file mode 100644
index 0000000..0727f6b
--- /dev/null
+++ b/tests/auto/uiloader/baseline/css_qtbug6855.ui
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>212</width>
+ <height>108</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">QPushButton { padding: 20px; }</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QPushButton" name="pushButton">
+ <property name="text">
+ <string>Text not cropped</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>258</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="0">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>218</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tests/benchmarks/qmetaobject/main.cpp b/tests/benchmarks/qmetaobject/main.cpp
index c375a16..eef6020 100644
--- a/tests/benchmarks/qmetaobject/main.cpp
+++ b/tests/benchmarks/qmetaobject/main.cpp
@@ -42,6 +42,84 @@
#include <QtGui>
#include <qtest.h>
+class LotsOfSignals : public QObject
+{
+ Q_OBJECT
+public:
+ LotsOfSignals() {}
+
+signals:
+ void extraSignal1();
+ void extraSignal2();
+ void extraSignal3();
+ void extraSignal4();
+ void extraSignal5();
+ void extraSignal6();
+ void extraSignal7();
+ void extraSignal8();
+ void extraSignal9();
+ void extraSignal10();
+ void extraSignal12();
+ void extraSignal13();
+ void extraSignal14();
+ void extraSignal15();
+ void extraSignal16();
+ void extraSignal17();
+ void extraSignal18();
+ void extraSignal19();
+ void extraSignal20();
+ void extraSignal21();
+ void extraSignal22();
+ void extraSignal23();
+ void extraSignal24();
+ void extraSignal25();
+ void extraSignal26();
+ void extraSignal27();
+ void extraSignal28();
+ void extraSignal29();
+ void extraSignal30();
+ void extraSignal31();
+ void extraSignal32();
+ void extraSignal33();
+ void extraSignal34();
+ void extraSignal35();
+ void extraSignal36();
+ void extraSignal37();
+ void extraSignal38();
+ void extraSignal39();
+ void extraSignal40();
+ void extraSignal41();
+ void extraSignal42();
+ void extraSignal43();
+ void extraSignal44();
+ void extraSignal45();
+ void extraSignal46();
+ void extraSignal47();
+ void extraSignal48();
+ void extraSignal49();
+ void extraSignal50();
+ void extraSignal51();
+ void extraSignal52();
+ void extraSignal53();
+ void extraSignal54();
+ void extraSignal55();
+ void extraSignal56();
+ void extraSignal57();
+ void extraSignal58();
+ void extraSignal59();
+ void extraSignal60();
+ void extraSignal61();
+ void extraSignal62();
+ void extraSignal63();
+ void extraSignal64();
+ void extraSignal65();
+ void extraSignal66();
+ void extraSignal67();
+ void extraSignal68();
+ void extraSignal69();
+ void extraSignal70();
+};
+
class tst_qmetaobject: public QObject
{
Q_OBJECT
@@ -57,6 +135,9 @@ private slots:
void indexOfSignal();
void indexOfSlot_data();
void indexOfSlot();
+
+ void unconnected_data();
+ void unconnected();
};
void tst_qmetaobject::initTestCase()
@@ -154,6 +235,30 @@ void tst_qmetaobject::indexOfSlot()
}
}
+void tst_qmetaobject::unconnected_data()
+{
+ QTest::addColumn<int>("signal_index");
+ QTest::newRow("signal--9") << 9;
+ QTest::newRow("signal--32") << 32;
+ QTest::newRow("signal--33") << 33;
+ QTest::newRow("signal--64") << 64;
+ QTest::newRow("signal--65") << 65;
+ QTest::newRow("signal--70") << 70;
+}
+
+void tst_qmetaobject::unconnected()
+{
+ LotsOfSignals *obj = new LotsOfSignals;
+ QFETCH(int, signal_index);
+ QVERIFY(obj->metaObject()->methodCount() == 73);
+ void *v;
+ QBENCHMARK {
+ //+1 because QObject has one slot
+ QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, signal_index+1, &v);
+ }
+ delete obj;
+}
+
QTEST_MAIN(tst_qmetaobject)
#include "main.moc"
diff --git a/tests/benchmarks/qstringlist/main.cpp b/tests/benchmarks/qstringlist/main.cpp
index 3fac598..1717b88 100644
--- a/tests/benchmarks/qstringlist/main.cpp
+++ b/tests/benchmarks/qstringlist/main.cpp
@@ -54,17 +54,21 @@ private slots:
void join() const;
void join_data() const;
- void split() const;
+ void split_qlist_qbytearray() const;
+ void split_qlist_qbytearray_data() const { return split_data(); }
+
void split_data() const;
+ void split_qlist_qstring() const;
+ void split_qlist_qstring_data() const { return split_data(); }
- void split_std() const;
- void split_std_data() const { return split_data(); }
+ void split_stdvector_stdstring() const;
+ void split_stdvector_stdstring_data() const { return split_data(); }
- void split_stdw() const;
- void split_stdw_data() const { return split_data(); }
+ void split_stdvector_stdwstring() const;
+ void split_stdvector_stdwstring_data() const { return split_data(); }
- void split_ba() const;
- void split_ba_data() const { return split_data(); }
+ void split_stdlist_stdstring() const;
+ void split_stdlist_stdstring_data() const { return split_data(); }
private:
static QStringList populateList(const int count, const QString &unit);
@@ -125,27 +129,39 @@ void tst_QStringList::join_data() const
<< QString();
}
-void tst_QStringList::split() const
+void tst_QStringList::split_data() const
+{
+ QTest::addColumn<QString>("input");
+ QString unit = QLatin1String("unit") + QString(100, QLatin1Char('s'));
+ //QTest::newRow("") << populateString(10, unit);
+ QTest::newRow("") << populateString(100, unit);
+ //QTest::newRow("") << populateString(100, unit);
+ //QTest::newRow("") << populateString(1000, unit);
+ //QTest::newRow("") << populateString(10000, unit);
+}
+
+void tst_QStringList::split_qlist_qbytearray() const
{
QFETCH(QString, input);
- const QChar splitChar = ':';
+ const char splitChar = ':';
+ QByteArray ba = input.toLatin1();
QBENCHMARK {
- input.split(splitChar);
+ ba.split(splitChar);
}
}
-void tst_QStringList::split_data() const
+void tst_QStringList::split_qlist_qstring() const
{
- QTest::addColumn<QString>("input");
- QString unit = QLatin1String("unit");
- QTest::newRow("") << populateString(10, unit);
- QTest::newRow("") << populateString(100, unit);
- QTest::newRow("") << populateString(1000, unit);
- QTest::newRow("") << populateString(10000, unit);
+ QFETCH(QString, input);
+ const QChar splitChar = ':';
+
+ QBENCHMARK {
+ input.split(splitChar);
+ }
}
-void tst_QStringList::split_std() const
+void tst_QStringList::split_stdvector_stdstring() const
{
QFETCH(QString, input);
const char split_char = ':';
@@ -161,7 +177,7 @@ void tst_QStringList::split_std() const
}
}
-void tst_QStringList::split_stdw() const
+void tst_QStringList::split_stdvector_stdwstring() const
{
QFETCH(QString, input);
const wchar_t split_char = ':';
@@ -177,14 +193,19 @@ void tst_QStringList::split_stdw() const
}
}
-void tst_QStringList::split_ba() const
+void tst_QStringList::split_stdlist_stdstring() const
{
QFETCH(QString, input);
- const char splitChar = ':';
- QByteArray ba = input.toLatin1();
+ const char split_char = ':';
+ std::string stdinput = input.toStdString();
QBENCHMARK {
- ba.split(splitChar);
+ std::istringstream split(stdinput);
+ std::list<std::string> token;
+ for (std::string each;
+ std::getline(split, each, split_char);
+ token.push_back(each))
+ ;
}
}
diff --git a/tests/benchmarks/qstringlist/qstringlist.pro b/tests/benchmarks/qstringlist/qstringlist.pro
index 11cceb0..5c64b34 100644
--- a/tests/benchmarks/qstringlist/qstringlist.pro
+++ b/tests/benchmarks/qstringlist/qstringlist.pro
@@ -1,5 +1,7 @@
load(qttest_p4)
TARGET = tst_qstringlist
+CONFIG -= debug
+CONFIG += release
QT -= gui
SOURCES += main.cpp
diff --git a/tests/benchmarks/qvector/outofline.cpp b/tests/benchmarks/qvector/outofline.cpp
index d1d72b0..e8d036e 100644
--- a/tests/benchmarks/qvector/outofline.cpp
+++ b/tests/benchmarks/qvector/outofline.cpp
@@ -1,3 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtTest module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
#include <QVector>
#include <vector>