summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/arthur/lance/widgets.h7
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/respfile/lupdatecmd2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/respfile/project.ts.result17
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/respfile/source1.cpp49
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/respfile/source2.cpp49
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/respfile/sources.lst2
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/respfile/tsfiles.lst1
-rw-r--r--tests/auto/networkdata/README1
-rw-r--r--tests/auto/qdom/tst_qdom.cpp6
-rw-r--r--tests/auto/qeasingcurve/tst_qeasingcurve.cpp139
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp27
-rw-r--r--tests/auto/qsharedpointer/externaltests.cpp10
-rw-r--r--tests/auto/qtabbar/tst_qtabbar.cpp3
-rw-r--r--tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp2
-rw-r--r--tests/auto/selftests/expected_cmptest.txt2
-rw-r--r--tests/auto/selftests/expected_crashes_3.txt2
-rw-r--r--tests/auto/selftests/expected_longstring.txt2
-rw-r--r--tests/auto/selftests/expected_maxwarnings.txt2
-rw-r--r--tests/auto/selftests/expected_skip.txt2
-rw-r--r--tests/auto/symbols/tst_symbols.cpp1
-rw-r--r--tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp2
-rw-r--r--tests/benchmarks/qvector/main.cpp426
-rw-r--r--tests/benchmarks/qvector/outofline.cpp41
-rw-r--r--tests/benchmarks/qvector/qrawvector.h742
-rw-r--r--tests/benchmarks/qvector/qvector.pro6
25 files changed, 1452 insertions, 91 deletions
diff --git a/tests/arthur/lance/widgets.h b/tests/arthur/lance/widgets.h
index 88e0726..f7d3268 100644
--- a/tests/arthur/lance/widgets.h
+++ b/tests/arthur/lance/widgets.h
@@ -236,7 +236,12 @@ public:
}
if (m_render_view.isNull()) {
- m_render_view = T::window()->windowSurface()->grabWidget(this);
+
+ if (T::window()->windowSurface())
+ m_render_view = T::window()->windowSurface()->grabWidget(this);
+ else
+ m_render_view = QPixmap::grabWidget(this);
+
m_render_view.save("renderView.png");
}
}
diff --git a/tests/auto/linguist/lupdate/testdata/good/respfile/lupdatecmd b/tests/auto/linguist/lupdate/testdata/good/respfile/lupdatecmd
new file mode 100644
index 0000000..6f198ab
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/respfile/lupdatecmd
@@ -0,0 +1,2 @@
+# Add the command that lupdate should run here. If it can't find anything it will default to
+lupdate -silent @sources.lst -ts @tsfiles.lst
diff --git a/tests/auto/linguist/lupdate/testdata/good/respfile/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/respfile/project.ts.result
new file mode 100644
index 0000000..3a864a2
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/respfile/project.ts.result
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0">
+<context>
+ <name>Dialog2</name>
+ <message>
+ <location filename="source1.cpp" line="47"/>
+ <source>func1</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="source2.cpp" line="47"/>
+ <source>func2</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lupdate/testdata/good/respfile/source1.cpp b/tests/auto/linguist/lupdate/testdata/good/respfile/source1.cpp
new file mode 100644
index 0000000..3327d1e
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/respfile/source1.cpp
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** 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 test suite 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$
+**
+****************************************************************************/
+
+// IMPORTANT!!!! If you want to add testdata to this file,
+// always add it to the end in order to not change the linenumbers of translations!!!
+
+void Dialog2::func3()
+{
+ tr("func1");
+}
+
diff --git a/tests/auto/linguist/lupdate/testdata/good/respfile/source2.cpp b/tests/auto/linguist/lupdate/testdata/good/respfile/source2.cpp
new file mode 100644
index 0000000..f284a61
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/respfile/source2.cpp
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** 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 test suite 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$
+**
+****************************************************************************/
+
+// IMPORTANT!!!! If you want to add testdata to this file,
+// always add it to the end in order to not change the linenumbers of translations!!!
+
+void Dialog2::func3()
+{
+ tr("func2");
+}
+
diff --git a/tests/auto/linguist/lupdate/testdata/good/respfile/sources.lst b/tests/auto/linguist/lupdate/testdata/good/respfile/sources.lst
new file mode 100644
index 0000000..430937e
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/respfile/sources.lst
@@ -0,0 +1,2 @@
+source1.cpp
+source2.cpp
diff --git a/tests/auto/linguist/lupdate/testdata/good/respfile/tsfiles.lst b/tests/auto/linguist/lupdate/testdata/good/respfile/tsfiles.lst
new file mode 100644
index 0000000..f3eb71f
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/respfile/tsfiles.lst
@@ -0,0 +1 @@
+project.ts
diff --git a/tests/auto/networkdata/README b/tests/auto/networkdata/README
new file mode 100644
index 0000000..e8748cc
--- /dev/null
+++ b/tests/auto/networkdata/README
@@ -0,0 +1 @@
+This directory contains network test data
diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp
index d1b2ea5..76903e5 100644
--- a/tests/auto/qdom/tst_qdom.cpp
+++ b/tests/auto/qdom/tst_qdom.cpp
@@ -476,10 +476,6 @@ void tst_QDom::save()
void tst_QDom::initTestCase()
{
-#ifdef Q_CC_MINGW
- QSKIP("Our current test machine, arsia, is too slow for this auto test.", SkipAll);
-#endif
-
QFile file(SRCDIR "testdata/excludedCodecs.txt");
QVERIFY(file.open(QIODevice::ReadOnly|QIODevice::Text));
@@ -1676,7 +1672,7 @@ void tst_QDom::appendDocumentNode() const
doc.appendChild(elem);
- Q_ASSERT(!xml.isNull());
+ QVERIFY(!xml.isNull());
const QString expected(QLatin1String("<document>\n<test_elem name=\"value\"/>\n</document>\n"));
elem.appendChild(xml);
diff --git a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp
index 0122d43..12ddff1 100644
--- a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp
+++ b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp
@@ -193,186 +193,208 @@ void tst_QEasingCurve::valueForProgress_data()
// integer values and avoid fp inaccuracies
QTest::newRow("Linear") << int(QEasingCurve::Linear)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.1 << 0.2 << 0.3 << 0.4 << 0.5 << 0.6 << 0.7 << 0.8 << 0.9 << 1);
+ << (RealList() << 0.0000 << 0.1000 << 0.2000 << 0.3000 << 0.4000 << 0.5000 << 0.6000 << 0.7000 << 0.8000 << 0.9000 << 1.0000);
QTest::newRow("InQuad") << int(QEasingCurve::InQuad)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.01 << 0.04 << 0.09 << 0.16 << 0.25 << 0.36 << 0.49 << 0.64 << 0.81 << 1);
+ << (RealList() << 0.0000 << 0.0100 << 0.0400 << 0.0900 << 0.1600 << 0.2500 << 0.3600 << 0.4900 << 0.6400 << 0.8100 << 1.0000);
QTest::newRow("OutQuad") << int(QEasingCurve::OutQuad)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.19 << 0.36 << 0.51 << 0.64 << 0.75 << 0.84 << 0.91 << 0.96 << 0.99 << 1);
+ << (RealList() << 0.0000 << 0.1900 << 0.3600 << 0.5100 << 0.6400 << 0.7500 << 0.8400 << 0.9100 << 0.9600 << 0.9900 << 1.0000);
QTest::newRow("InOutQuad") << int(QEasingCurve::InOutQuad)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.02 << 0.08 << 0.18 << 0.32 << 0.5 << 0.68 << 0.82 << 0.92 << 0.98 << 1);
+ << (RealList() << 0.0000 << 0.0200 << 0.0800 << 0.1800 << 0.3200 << 0.5000 << 0.6800 << 0.8200 << 0.9200 << 0.9800 << 1.0000);
QTest::newRow("OutInQuad") << int(QEasingCurve::OutInQuad)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.18 << 0.32 << 0.42 << 0.48 << 0.5 << 0.52 << 0.58 << 0.68 << 0.82 << 1);
+ << (RealList() << 0.0000 << 0.1800 << 0.3200 << 0.4200 << 0.4800 << 0.5000 << 0.5200 << 0.5800 << 0.6800 << 0.8200 << 1.0000);
QTest::newRow("InCubic") << int(QEasingCurve::InCubic)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.001 << 0.008 << 0.027 << 0.064 << 0.125 << 0.216 << 0.343 << 0.512 << 0.729 << 1);
+ << (RealList() << 0.0000 << 0.0010 << 0.0080 << 0.0270 << 0.0640 << 0.1250 << 0.2160 << 0.3430 << 0.5120 << 0.7290 << 1.0000);
QTest::newRow("OutCubic") << int(QEasingCurve::OutCubic)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.271 << 0.488 << 0.657 << 0.784 << 0.875 << 0.936 << 0.973 << 0.992 << 0.999 << 1);
+ << (RealList() << 0.0000 << 0.2710 << 0.4880 << 0.6570 << 0.7840 << 0.8750 << 0.9360 << 0.9730 << 0.9920 << 0.9990 << 1.0000);
QTest::newRow("InOutCubic") << int(QEasingCurve::InOutCubic)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.004 << 0.032 << 0.108 << 0.256 << 0.5 << 0.744 << 0.892 << 0.968 << 0.996 << 1);
+ << (RealList() << 0.0000 << 0.0040 << 0.0320 << 0.1080 << 0.2560 << 0.5000 << 0.7440 << 0.8920 << 0.9680 << 0.9960 << 1.0000);
QTest::newRow("OutInCubic") << int(QEasingCurve::OutInCubic)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.244 << 0.392 << 0.468 << 0.496 << 0.5 << 0.504 << 0.532 << 0.608 << 0.756 << 1);
+ << (RealList() << 0.0000 << 0.2440 << 0.3920 << 0.4680 << 0.4960 << 0.5000 << 0.5040 << 0.5320 << 0.6080 << 0.7560 << 1.0000);
QTest::newRow("InQuart") << int(QEasingCurve::InQuart)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.0001 << 0.0016 << 0.0081 << 0.0256 << 0.0625 << 0.1296 << 0.2401 << 0.4096 << 0.6561 << 1);
+ << (RealList() << 0.0000 << 0.0001 << 0.0016 << 0.0081 << 0.0256 << 0.0625 << 0.1296 << 0.2401 << 0.4096 << 0.6561 << 1.0000);
QTest::newRow("OutQuart") << int(QEasingCurve::OutQuart)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.3439 << 0.5904 << 0.7599 << 0.8704 << 0.9375 << 0.9744 << 0.9919 << 0.9984 << 0.9999 << 1);
+ << (RealList() << 0.0000 << 0.3439 << 0.5904 << 0.7599 << 0.8704 << 0.9375 << 0.9744 << 0.9919 << 0.9984 << 0.9999 << 1.0000);
QTest::newRow("InOutQuart") << int(QEasingCurve::InOutQuart)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.0008 << 0.0128 << 0.0648 << 0.2048 << 0.5 << 0.7952 << 0.9352 << 0.9872 << 0.9992 << 1);
+ << (RealList() << 0.0000 << 0.0008 << 0.0128 << 0.0648 << 0.2048 << 0.5000 << 0.7952 << 0.9352 << 0.9872 << 0.9992 << 1.0000);
QTest::newRow("OutInQuart") << int(QEasingCurve::OutInQuart)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.2952 << 0.4352 << 0.4872 << 0.4992 << 0.5 << 0.5008 << 0.5128 << 0.5648 << 0.7048 << 1);
+ << (RealList() << 0.0000 << 0.2952 << 0.4352 << 0.4872 << 0.4992 << 0.5000 << 0.5008 << 0.5128 << 0.5648 << 0.7048 << 1.0000);
QTest::newRow("InQuint") << int(QEasingCurve::InQuint)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 1e-05 << 0.00032 << 0.00243 << 0.01024 << 0.03125 << 0.07776 << 0.1681 << 0.3277 << 0.5905 << 1);
+ << (RealList() << 0.0000 << 0.0000 << 0.0003 << 0.0024 << 0.0102 << 0.0313 << 0.0778 << 0.1681 << 0.3277 << 0.5905 << 1.0000);
QTest::newRow("OutQuint") << int(QEasingCurve::OutQuint)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.4095 << 0.6723 << 0.8319 << 0.9222 << 0.9688 << 0.9898 << 0.9976 << 0.9997 << 1 << 1);
+ << (RealList() << 0.0000 << 0.4095 << 0.6723 << 0.8319 << 0.9222 << 0.9688 << 0.9898 << 0.9976 << 0.9997 << 1.0000 << 1.0000);
QTest::newRow("InOutQuint") << int(QEasingCurve::InOutQuint)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.00016 << 0.00512 << 0.03888 << 0.1638 << 0.5 << 0.8362 << 0.9611 << 0.9949 << 0.9998 << 1);
+ << (RealList() << 0.0000 << 0.0002 << 0.0051 << 0.0389 << 0.1638 << 0.5000 << 0.8362 << 0.9611 << 0.9949 << 0.9998 << 1.0000);
QTest::newRow("OutInQuint") << int(QEasingCurve::OutInQuint)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.3362 << 0.4611 << 0.4949 << 0.4998 << 0.5 << 0.5002 << 0.5051 << 0.5389 << 0.6638 << 1);
+ << (RealList() << 0.0000 << 0.3362 << 0.4611 << 0.4949 << 0.4998 << 0.5000 << 0.5002 << 0.5051 << 0.5389 << 0.6638 << 1.0000);
QTest::newRow("InSine") << int(QEasingCurve::InSine)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.01231 << 0.04894 << 0.109 << 0.191 << 0.2929 << 0.4122 << 0.546 << 0.691 << 0.8436 << 1);
+ << (RealList() << 0.0000 << 0.0123 << 0.0489 << 0.1090 << 0.1910 << 0.2929 << 0.4122 << 0.5460 << 0.6910 << 0.8436 << 1.0000);
QTest::newRow("OutSine") << int(QEasingCurve::OutSine)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.1564 << 0.309 << 0.454 << 0.5878 << 0.7071 << 0.809 << 0.891 << 0.9511 << 0.9877 << 1);
+ << (RealList() << 0.0000 << 0.1564 << 0.3090 << 0.4540 << 0.5878 << 0.7071 << 0.8090 << 0.8910 << 0.9511 << 0.9877 << 1.0000);
QTest::newRow("InOutSine") << int(QEasingCurve::InOutSine)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.02447 << 0.09549 << 0.2061 << 0.3455 << 0.5 << 0.6545 << 0.7939 << 0.9045 << 0.9755 << 1);
+ << (RealList() << 0.0000 << 0.0245 << 0.0955 << 0.2061 << 0.3455 << 0.5000 << 0.6545 << 0.7939 << 0.9045 << 0.9755 << 1.0000);
QTest::newRow("OutInSine") << int(QEasingCurve::OutInSine)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.1545 << 0.2939 << 0.4045 << 0.4755 << 0.5 << 0.5245 << 0.5955 << 0.7061 << 0.8455 << 1);
+ << (RealList() << 0.0000 << 0.1545 << 0.2939 << 0.4045 << 0.4755 << 0.5000 << 0.5245 << 0.5955 << 0.7061 << 0.8455 << 1.0000);
QTest::newRow("InExpo") << int(QEasingCurve::InExpo)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.0009531 << 0.002906 << 0.006812 << 0.01462 << 0.03025 << 0.0615 << 0.124 << 0.249 << 0.499 << 1);
+ << (RealList() << 0.0000 << 0.0010 << 0.0029 << 0.0068 << 0.0146 << 0.0303 << 0.0615 << 0.1240 << 0.2490 << 0.4990 << 1.0000);
QTest::newRow("OutExpo") << int(QEasingCurve::OutExpo)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.5005 << 0.7507 << 0.8759 << 0.9384 << 0.9697 << 0.9854 << 0.9932 << 0.9971 << 0.999 << 1);
+ << (RealList() << 0.0000 << 0.5005 << 0.7507 << 0.8759 << 0.9384 << 0.9697 << 0.9854 << 0.9932 << 0.9971 << 0.9990 << 1.0000);
QTest::newRow("InOutExpo") << int(QEasingCurve::InOutExpo)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.001453 << 0.007312 << 0.03075 << 0.1245 << 0.5002 << 0.8754 << 0.9692 << 0.9927 << 0.9985 << 1);
+ << (RealList() << 0.0000 << 0.0015 << 0.0073 << 0.0308 << 0.1245 << 0.5003 << 0.8754 << 0.9692 << 0.9927 << 0.9985 << 1.0000);
QTest::newRow("OutInExpo") << int(QEasingCurve::OutInExpo)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.3754 << 0.4692 << 0.4927 << 0.4985 << 0.5 << 0.5015 << 0.5073 << 0.5308 << 0.6245 << 1);
+ << (RealList() << 0.0000 << 0.3754 << 0.4692 << 0.4927 << 0.4985 << 0.5000 << 0.5015 << 0.5073 << 0.5308 << 0.6245 << 1.0000);
QTest::newRow("InCirc") << int(QEasingCurve::InCirc)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.005013 << 0.0202 << 0.04606 << 0.08348 << 0.134 << 0.2 << 0.2859 << 0.4 << 0.5641 << 1);
+ << (RealList() << 0.0000 << 0.0050 << 0.0202 << 0.0461 << 0.0835 << 0.1340 << 0.2000 << 0.2859 << 0.4000 << 0.5641 << 1.0000);
QTest::newRow("OutCirc") << int(QEasingCurve::OutCirc)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.4359 << 0.6 << 0.7141 << 0.8 << 0.866 << 0.9165 << 0.9539 << 0.9798 << 0.995 << 1);
+ << (RealList() << 0.0000 << 0.4359 << 0.6000 << 0.7141 << 0.8000 << 0.8660 << 0.9165 << 0.9539 << 0.9798 << 0.9950 << 1.0000);
QTest::newRow("InOutCirc") << int(QEasingCurve::InOutCirc)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.0101 << 0.04174 << 0.1 << 0.2 << 0.5 << 0.8 << 0.9 << 0.9583 << 0.9899 << 1);
+ << (RealList() << 0.0000 << 0.0101 << 0.0417 << 0.1000 << 0.2000 << 0.5000 << 0.8000 << 0.9000 << 0.9583 << 0.9899 << 1.0000);
QTest::newRow("OutInCirc") << int(QEasingCurve::OutInCirc)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.3 << 0.4 << 0.4583 << 0.4899 << 0.5 << 0.5101 << 0.5417 << 0.6 << 0.7 << 1);
+ << (RealList() << 0.0000 << 0.3000 << 0.4000 << 0.4583 << 0.4899 << 0.5000 << 0.5101 << 0.5417 << 0.6000 << 0.7000 << 1.0000);
QTest::newRow("InElastic") << int(QEasingCurve::InElastic)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.001953 << -0.001953 << -0.003906 << 0.01562 << -0.01562 << -0.03125 << 0.125 << -0.125 << -0.25 << 1);
+ << (RealList() << 0.0000 << 0.0020 << -0.0020 << -0.0039 << 0.0156 << -0.0156 << -0.0313 << 0.1250 << -0.1250 << -0.2500 << 1.0000);
QTest::newRow("OutElastic") << int(QEasingCurve::OutElastic)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 1.25 << 1.125 << 0.875 << 1.031 << 1.016 << 0.9844 << 1.004 << 1.002 << 0.998 << 1);
+ << (RealList() << 0.0000 << 1.2500 << 1.1250 << 0.8750 << 1.0313 << 1.0156 << 0.9844 << 1.0039 << 1.0020 << 0.9980 << 1.0000);
QTest::newRow("InOutElastic") << int(QEasingCurve::InOutElastic)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << -0.0009766 << 0.007812 << -0.01563 << -0.0625 << 0.5 << 1.062 << 1.016 << 0.9922 << 1.001 << 1);
+ << (RealList() << 0.0000 << -0.0010 << 0.0078 << -0.0156 << -0.0625 << 0.5000 << 1.0625 << 1.0156 << 0.9922 << 1.0010 << 1.0000);
QTest::newRow("OutInElastic") << int(QEasingCurve::OutInElastic)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.375 << 0.5625 << 0.4922 << 0.498 << 0.5 << 0.4961 << 0.5078 << 0.5313 << 0.25 << 1);
+ << (RealList() << 0.0000 << 0.3750 << 0.5625 << 0.4922 << 0.4980 << 0.5000 << 0.4961 << 0.5078 << 0.5313 << 0.2500 << 1.0000);
QTest::newRow("InBack") << int(QEasingCurve::InBack)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << -0.01431 << -0.04645 << -0.0802 << -0.09935 << -0.0877 << -0.02903 << 0.09287 << 0.2942 << 0.5912 << 1);
+ << (RealList() << 0.0000 << -0.0143 << -0.0465 << -0.0802 << -0.0994 << -0.0877 << -0.0290 << 0.0929 << 0.2942 << 0.5912 << 1.0000);
QTest::newRow("OutBack") << int(QEasingCurve::OutBack)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.4088 << 0.7058 << 0.9071 << 1.029 << 1.088 << 1.099 << 1.08 << 1.046 << 1.014 << 1);
+ << (RealList() << 0.0000 << 0.4088 << 0.7058 << 0.9071 << 1.0290 << 1.0877 << 1.0994 << 1.0802 << 1.0465 << 1.0143 << 1.0000);
QTest::newRow("InOutBack") << int(QEasingCurve::InOutBack)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << -0.03752 << -0.09256 << -0.07883 << 0.08993 << 0.5 << 0.9101 << 1.079 << 1.093 << 1.038 << 1);
+ << (RealList() << 0.0000 << -0.0375 << -0.0926 << -0.0788 << 0.0899 << 0.5000 << 0.9101 << 1.0788 << 1.0926 << 1.0375 << 1.0000);
QTest::newRow("OutInBack") << int(QEasingCurve::OutInBack)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.3529 << 0.5145 << 0.5497 << 0.5232 << 0.5 << 0.4768 << 0.4503 << 0.4855 << 0.6471 << 1);
+ << (RealList() << 0.0000 << 0.3529 << 0.5145 << 0.5497 << 0.5232 << 0.5000 << 0.4768 << 0.4503 << 0.4855 << 0.6471 << 1.0000);
QTest::newRow("InBounce") << int(QEasingCurve::InBounce)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.01188 << 0.06 << 0.06937 << 0.2275 << 0.2344 << 0.09 << 0.3194 << 0.6975 << 0.9244 << 1);
+ << (RealList() << 0.0000 << 0.0119 << 0.0600 << 0.0694 << 0.2275 << 0.2344 << 0.0900 << 0.3194 << 0.6975 << 0.9244 << 1.0000);
QTest::newRow("OutBounce") << int(QEasingCurve::OutBounce)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.07563 << 0.3025 << 0.6806 << 0.91 << 0.7656 << 0.7725 << 0.9306 << 0.94 << 0.9881 << 1);
+ << (RealList() << 0.0000 << 0.0756 << 0.3025 << 0.6806 << 0.9100 << 0.7656 << 0.7725 << 0.9306 << 0.9400 << 0.9881 << 1.0000);
QTest::newRow("InOutBounce") << int(QEasingCurve::InOutBounce)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.03 << 0.1138 << 0.045 << 0.3488 << 0.5 << 0.6512 << 0.955 << 0.8862 << 0.97 << 1);
+ << (RealList() << 0.0000 << 0.0300 << 0.1138 << 0.0450 << 0.3488 << 0.5000 << 0.6512 << 0.9550 << 0.8863 << 0.9700 << 1.0000);
QTest::newRow("OutInBounce") << int(QEasingCurve::OutInBounce)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.1513 << 0.41 << 0.2725 << 0.44 << 0.5 << 0.56 << 0.7275 << 0.59 << 0.8488 << 1);
+ << (RealList() << 0.0000 << 0.1513 << 0.4100 << 0.2725 << 0.4400 << 0.5000 << 0.5600 << 0.7275 << 0.5900 << 0.8488 << 1.0000);
QTest::newRow("InCurve") << int(QEasingCurve::InCurve)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.02447 << 0.1059 << 0.2343 << 0.3727 << 0.5 << 0.6055 << 0.7 << 0.8 << 0.9 << 1);
+ << (RealList() << 0.0000 << 0.0245 << 0.1059 << 0.2343 << 0.3727 << 0.5000 << 0.6055 << 0.7000 << 0.8000 << 0.9000 << 1.0000);
QTest::newRow("OutCurve") << int(QEasingCurve::OutCurve)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.1 << 0.2 << 0.3 << 0.3945 << 0.5 << 0.6273 << 0.7657 << 0.8941 << 0.9755 << 1);
+ << (RealList() << 0.0000 << 0.1000 << 0.2000 << 0.3000 << 0.3945 << 0.5000 << 0.6273 << 0.7657 << 0.8941 << 0.9755 << 1.0000);
QTest::newRow("SineCurve") << int(QEasingCurve::SineCurve)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0 << 0.09549 << 0.3455 << 0.6545 << 0.9045 << 1 << 0.9045 << 0.6545 << 0.3455 << 0.09549 << 0);
+ << (RealList() << 0.0000 << 0.0955 << 0.3455 << 0.6545 << 0.9045 << 1.0000 << 0.9045 << 0.6545 << 0.3455 << 0.0955 << 0.0000);
QTest::newRow("CosineCurve") << int(QEasingCurve::CosineCurve)
<< (IntList() << 0 << 10 << 20 << 30 << 40 << 50 << 60 << 70 << 80 << 90 << 100)
- << (RealList() << 0.5 << 0.7939 << 0.9755 << 0.9755 << 0.7939 << 0.5 << 0.2061 << 0.02447 << 0.02447 << 0.2061 << 0.5);
+ << (RealList() << 0.5000 << 0.7939 << 0.9755 << 0.9755 << 0.7939 << 0.5000 << 0.2061 << 0.0245 << 0.0245 << 0.2061 << 0.5000);
}
+/*
+ "fixedpoint" number that is scaled up by 10000.
+ This is to work around two bugs (precision and rounding error) in QString::setNum().
+ It does not trim off trailing zeros. This is good, just to emphasize the precision.
+*/
+QString fixedToString(int value)
+{
+ QString str;
+ if (value < 0) {
+ str+= QLatin1Char('-');
+ value = -value;
+ }
+
+ QString digitArg(QLatin1String("%1."));
+ for (int i = 10000; i >= 1; i/=10) {
+ int digit = value/i;
+ value -= digit*i;
+ str.append(digitArg.arg(digit));
+ digitArg = QLatin1String("%1");
+ }
+ return str;
+}
void tst_QEasingCurve::valueForProgress()
{
@@ -390,7 +412,7 @@ void tst_QEasingCurve::valueForProgress()
for (int t = 0; t <= 100; t+= 10) {
qreal ease = curve.valueForProgress(t/qreal(100));
strInputs += QString::fromAscii(" << %1").arg(t);
- strOutputs += " << " + QString().setNum(ease, 'g', 4);
+ strOutputs += " << " + fixedToString(qRound(ease*10000));
}
QString str = QString::fromAscii(" QTest::newRow(\"%1\") << int(QEasingCurve::%2)\n"
" << (IntList() %3)\n"
@@ -409,26 +431,13 @@ void tst_QEasingCurve::valueForProgress()
QFETCH(RealList, expected);
QEasingCurve curve((QEasingCurve::Type)type);
+ // in theory the baseline should't have an error of more than 0.00005 due to how its rounded,
+ // but due to FP imprecision, we have to adjust the error a bit more.
+ const qreal errorBound = 0.00006;
for (int i = 0; i < at.count(); ++i) {
- qreal ease = curve.valueForProgress(at.at(i)/qreal(100));
- // converting ease to 4 precision qreal to match the generated samples
- qreal easeConv = qreal(QString().setNum(ease, 'g', 4).toDouble());
- qreal ex = expected.at(i);
-
- // the least significant digit it is still subject to rounding errors
- qreal error = easeConv - ex;
- qreal errorbound = 0.00001;
-#if defined( Q_OS_WINCE ) || defined( Q_OS_SYMBIAN )
- // exception values for WINCE(this test should be rewritten, as it only freezes the status quo of QEasingCurve
- // The failing (2) values are explicitly excepted here:
- // The source values for the comparison table should remain untruncated double and the
- // error bound checking function dynamic. Also the source values should come from a "trusted" source and not
- // from QEasingCurve itself.
- if ((type == int(QEasingCurve::InOutBounce) && (i == 8 || i == 6) ) || (type == int(QEasingCurve::OutExpo) && i == 2))
- errorbound = 0.0002;
-#endif
- // accept the potential rounding error in the least significant digit
- QVERIFY(error <= errorbound );
+ const qreal ex = expected.at(i);
+ const qreal error = qAbs(ex - curve.valueForProgress(at.at(i)/qreal(100)));
+ QVERIFY(error <= errorBound);
}
#endif
}
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 8bcd5e8..d6bf900 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -47,6 +47,7 @@
#include <qmatrix.h>
#include <qdesktopwidget.h>
#include <qpaintengine.h>
+#include <qtreewidget.h>
#include <qsplashscreen.h>
#include <private/qpixmapdata_p.h>
@@ -795,14 +796,32 @@ void tst_QPixmap::drawBitmap()
void tst_QPixmap::grabWidget()
{
QWidget widget;
- widget.setPalette(Qt::green);
- widget.resize(128, 128);
+ QImage image(128, 128, QImage::Format_ARGB32_Premultiplied);
+ for (int row = 0; row < image.height(); ++row) {
+ QRgb *line = reinterpret_cast<QRgb *>(image.scanLine(row));
+ for (int col = 0; col < image.width(); ++col)
+ line[col] = qRgb(rand() & 255, row, col);
+ }
- QPixmap expected(64, 64);
- expected.fill(Qt::green);
+ QPalette pal = widget.palette();
+ pal.setBrush(QPalette::Window, QBrush(image));
+ widget.setPalette(pal);
+ widget.resize(128, 128);
+ QPixmap expected = QPixmap::fromImage(QImage(image.scanLine(64) + 64 * 4, 64, 64, image.bytesPerLine(), image.format()));
QPixmap actual = QPixmap::grabWidget(&widget, QRect(64, 64, 64, 64));
QVERIFY(lenientCompare(actual, expected));
+
+ actual = QPixmap::grabWidget(&widget, 64, 64);
+ QVERIFY(lenientCompare(actual, expected));
+
+ // Make sure a widget that is not yet shown is grabbed correctly.
+ QTreeWidget widget2;
+ actual = QPixmap::grabWidget(&widget2);
+ widget2.show();
+ expected = QPixmap::grabWidget(&widget2);
+
+ QVERIFY(lenientCompare(actual, expected));
}
void tst_QPixmap::grabWindow()
diff --git a/tests/auto/qsharedpointer/externaltests.cpp b/tests/auto/qsharedpointer/externaltests.cpp
index eb2f27d..7eae3c1 100644
--- a/tests/auto/qsharedpointer/externaltests.cpp
+++ b/tests/auto/qsharedpointer/externaltests.cpp
@@ -671,14 +671,9 @@ namespace QTest {
make.setProcessChannelMode(channelMode);
-#if defined(Q_OS_WIN) && !defined(Q_CC_MINGW)
- make.start(QLatin1String("nmake.exe"), args);
- make.waitForStarted();
-#else
static const char makes[] =
-# ifdef Q_CC_MINGW
- "mingw32-make.exe\0"
-# endif
+ "nmake.exe\0" //for visual c++
+ "mingw32-make.exe\0" //for mingw
"gmake\0"
"make\0";
for (const char *p = makes; *p; p += strlen(p) + 1) {
@@ -686,7 +681,6 @@ namespace QTest {
if (make.waitForStarted())
break;
}
-#endif
if (make.state() != QProcess::Running) {
exitCode = 255;
diff --git a/tests/auto/qtabbar/tst_qtabbar.cpp b/tests/auto/qtabbar/tst_qtabbar.cpp
index d980efa..72f9dd3 100644
--- a/tests/auto/qtabbar/tst_qtabbar.cpp
+++ b/tests/auto/qtabbar/tst_qtabbar.cpp
@@ -273,6 +273,9 @@ void tst_QTabBar::setElideMode()
if (tabElideMode != -128)
tabBar.setElideMode(Qt::TextElideMode(tabElideMode));
QTEST(int(tabBar.elideMode()), "expectedMode");
+ // Make sure style sheet does not override user set mode
+ tabBar.setStyleSheet("QWidget { background-color: #ABA8A6;}");
+ QTEST(int(tabBar.elideMode()), "expectedMode");
}
void tst_QTabBar::setUsesScrollButtons_data()
diff --git a/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp b/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp
index e38a2bc..0e57306 100644
--- a/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp
+++ b/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp
@@ -580,7 +580,7 @@ void tst_QXmlSimpleReader::inputFromSocket()
QSKIP("Symbian: Skipped due to problems in Open C and QtNetwork", SkipAll);
#endif
-#if defined(Q_OS_WIN32) && (defined(Q_CC_INTEL) || defined(Q_CC_MINGW) || defined(Q_CC_MSVC_NET))
+#if defined(Q_OS_WIN32) && (defined(Q_CC_INTEL) || defined(Q_CC_MSVC_NET))
QSKIP("Regression caused by QHOstInfo change 294548, see task 202231.", SkipAll);
#endif
QTcpSocket sock;
diff --git a/tests/auto/selftests/expected_cmptest.txt b/tests/auto/selftests/expected_cmptest.txt
index 1b65adf..e9f94c9 100644
--- a/tests/auto/selftests/expected_cmptest.txt
+++ b/tests/auto/selftests/expected_cmptest.txt
@@ -1,5 +1,5 @@
********* Start testing of tst_Cmptest *********
-Config: Using QTest library 4.6.2, Qt 4.6.2
+Config: Using QTest library 4.7.0, Qt 4.7.0
PASS : tst_Cmptest::initTestCase()
PASS : tst_Cmptest::compare_boolfuncs()
PASS : tst_Cmptest::compare_pointerfuncs()
diff --git a/tests/auto/selftests/expected_crashes_3.txt b/tests/auto/selftests/expected_crashes_3.txt
index aabe83d..3aced25 100644
--- a/tests/auto/selftests/expected_crashes_3.txt
+++ b/tests/auto/selftests/expected_crashes_3.txt
@@ -1,5 +1,5 @@
********* Start testing of tst_Crashes *********
-Config: Using QTest library 4.6.2, Qt 4.6.2
+Config: Using QTest library 4.7.0, Qt 4.7.0
PASS : tst_Crashes::initTestCase()
QFATAL : tst_Crashes::crash() Received signal 11
FAIL! : tst_Crashes::crash() Received a fatal error.
diff --git a/tests/auto/selftests/expected_longstring.txt b/tests/auto/selftests/expected_longstring.txt
index 3fe237a..a6ad5d0 100644
--- a/tests/auto/selftests/expected_longstring.txt
+++ b/tests/auto/selftests/expected_longstring.txt
@@ -1,5 +1,5 @@
********* Start testing of tst_LongString *********
-Config: Using QTest library 4.6.2, Qt 4.6.2
+Config: Using QTest library 4.7.0, Qt 4.7.0
PASS : tst_LongString::initTestCase()
FAIL! : tst_LongString::failWithLongString() Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui.
diff --git a/tests/auto/selftests/expected_maxwarnings.txt b/tests/auto/selftests/expected_maxwarnings.txt
index 8bafeff..908bd5d 100644
--- a/tests/auto/selftests/expected_maxwarnings.txt
+++ b/tests/auto/selftests/expected_maxwarnings.txt
@@ -1,5 +1,5 @@
********* Start testing of MaxWarnings *********
-Config: Using QTest library 4.6.2, Qt 4.6.2
+Config: Using QTest library 4.7.0, Qt 4.7.0
PASS : MaxWarnings::initTestCase()
QWARN : MaxWarnings::warn() 0
QWARN : MaxWarnings::warn() 1
diff --git a/tests/auto/selftests/expected_skip.txt b/tests/auto/selftests/expected_skip.txt
index c4ef92d..4345a6c 100644
--- a/tests/auto/selftests/expected_skip.txt
+++ b/tests/auto/selftests/expected_skip.txt
@@ -1,5 +1,5 @@
********* Start testing of tst_Skip *********
-Config: Using QTest library 4.6.2, Qt 4.6.2
+Config: Using QTest library 4.7.0, Qt 4.7.0
PASS : tst_Skip::initTestCase()
SKIP : tst_Skip::test() skipping all
Loc: [/home/rmcgover/depot/qt-git/mainline/tests/auto/selftests/skip/tst_skip.cpp(68)]
diff --git a/tests/auto/symbols/tst_symbols.cpp b/tests/auto/symbols/tst_symbols.cpp
index e30481a..70abc43 100644
--- a/tests/auto/symbols/tst_symbols.cpp
+++ b/tests/auto/symbols/tst_symbols.cpp
@@ -100,7 +100,6 @@ void tst_Symbols::globalObjects()
#ifndef Q_OS_LINUX
QSKIP("Linux-specific test", SkipAll);
#endif
- QSKIP("Test disabled, we're not fixing these issues in this Qt version", SkipAll);
// these are regexps for global objects that are allowed in Qt
QStringList whitelist = QStringList()
diff --git a/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index faacec4..01285d1 100644
--- a/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the documentation of the Qt Toolkit.
+** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
diff --git a/tests/benchmarks/qvector/main.cpp b/tests/benchmarks/qvector/main.cpp
new file mode 100644
index 0000000..65e7609
--- /dev/null
+++ b/tests/benchmarks/qvector/main.cpp
@@ -0,0 +1,426 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite 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 <QDebug>
+#include <QtTest>
+
+#include "qrawvector.h"
+
+#include <vector>
+
+/*
+
+Code generated by g++ 4.3.3. The lines marked with '!' are the ones that get
+executed inside the loop. Using the external 's' causes some load making the
+loop resembling a 'simple inner loop' in 'real' applications.
+
+
+qvector_mutable_read_access:
+
+.L166:
+! movl -16(%ebp), %edx
+! movl (%edx), %eax
+! subl $1, %eax
+! je .L165
+ movl 4(%edx), %eax
+ movl %eax, 8(%esp)
+ movl 8(%edx), %eax
+ movl %esi, (%esp)
+ movl %eax, 4(%esp)
+ call _ZN4myns7QVectorIdE7reallocEii
+.L165:
+! movl -16(%ebp), %eax
+! fldl s
+! faddl 16(%eax,%ebx,8)
+! addl $1, %ebx
+! cmpl $10000, %ebx
+! fstpl s
+! jne .L166
+
+
+qvector_const_read_access:
+
+ movl -16(%ebp), %edx
+ xorl %eax, %eax
+.L183:
+! fldl s
+! faddl 16(%edx,%eax,8)
+! addl $1, %eax
+! cmpl $10000, %eax
+! fstpl s
+! jne .L183
+
+
+stdvector_const_read_access and stdvector_mutable_read_access and
+qrawvector_const_read_access and qrawvector_mutable_read_access:
+
+ xorl %eax, %eax
+.L64:
+! fldl s
+! faddl (%ebx,%eax,8)
+! addl $1, %eax
+! cmpl $10000, %eax
+! fstpl s
+! jne .L64
+
+
+
+Behaviour varies with small modifications, but total is more or
+less stable:
+
+qrawvector_mutable_read_access, using size() instead of N:
+
+.L145:
+! faddl (%edx,%eax,8)
+! addl $1, %eax
+! cmpl %ecx, %eax
+! fstl s
+! jne .L145
+! fstp %st(0)
+
+
+qrawvector_mutable_read_access, counting backward:
+
+.L145:
+! faddl (%edx,%eax,8)
+! subl $1, %eax
+! cmpl $-1, %eax
+! fstl s
+! jne .L145
+
+
+qrawvector_mutable_read_access, counting backward, using size():
+
+.L146:
+! faddl (%edx)
+! addl $1, %eax
+! subl $8, %edx
+! cmpl %ecx, %eax
+! fstl s
+! jne .L146
+
+
+
+*/
+
+
+/*
+
+////////////////////////////////////////////////////////////////////
+
+time ./tst_vector qvector_const_read_access
+real 0m12.912s
+user 0m12.401s
+sys 0m0.016s
+
+time ./tst_vector qvector_mutable_read_access
+real 0m38.566s
+user 0m36.754s
+sys 0m0.008s
+
+
+time ./tst_vector stdvector_mutable_read_access
+real 0m12.736s
+user 0m12.665s
+sys 0m0.004s
+
+
+////////////////////////////////////////////////////////////////////
+
+time ./tst_vector qvector_fill_and_return
+real 0m28.778s
+user 0m28.522s
+sys 0m0.012s
+
+time ./tst_vector stdvector_fill_and_return
+real 0m26.675s
+user 0m26.558s
+sys 0m0.012s
+
+time ./tst_vector qrawvector_fill_and_return
+real 0m23.370s
+user 0m23.269s
+sys 0m0.008s
+
+
+
+*/
+
+
+
+#define TEST_RETURN 1
+
+// For some reason, both 'plain' and '-callgrind' create strange results
+// (like varying instruction count for the same assembly code)
+// So replace it by a plain loop and measure wall clock time.
+//#undef QBENCHMARK
+//#define QBENCHMARK for (int j = 0; j != 10000; ++j)
+
+class tst_QVector: public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void calibration();
+
+ // Pure Qt solution
+ void qvector_separator() { qWarning() << "QVector results: "; }
+ void qvector_const_read_access();
+ void qvector_mutable_read_access();
+ #ifdef TEST_RETURN
+ void qvector_fill_and_return();
+ void qvector_fill_and_return2();
+ #endif
+
+ // Purre Standard solution
+ void stdvector() { qWarning() << "std::vector results: "; }
+ void stdvector_const_read_access();
+ void stdvector_mutable_read_access();
+ #ifdef TEST_RETURN
+ void stdvector_fill_and_return();
+ void stdvector_fill_and_return2();
+ #endif
+
+ // Build using std, pass as QVector
+ void mixedvector() { qWarning() << "mixed results: "; }
+ #ifdef TEST_RETURN
+ void mixedvector_fill_and_return();
+ void mixedvector_fill_and_return2();
+ #endif
+
+ // Alternative implementation
+ void qrawvector_separator() { qWarning() << "QRawVector results: "; }
+ void qrawvector_const_read_access();
+ void qrawvector_mutable_read_access();
+ #ifdef TEST_RETURN
+ void qrawvector_fill_and_return();
+ void qrawvector_fill_and_return2();
+ #endif
+};
+
+const int N = 1000000;
+extern double s;
+
+void tst_QVector::calibration()
+{
+ QVector<double> v(N);
+ for (int i = 0; i != N; ++i)
+ v[i] = i;
+ QBENCHMARK {
+ for (int i = 0; i != N; ++i)
+ s += i;
+ }
+}
+
+///////////////////// QVector /////////////////////
+
+void tst_QVector::qvector_const_read_access()
+{
+ QVector<double> v(N);
+ for (int i = 0; i != N; ++i)
+ v[i] = i;
+
+ const QVector<double> &vc = v;
+ QBENCHMARK {
+ for (int i = 0; i != N; ++i)
+ s += vc[i];
+ }
+}
+
+void tst_QVector::qvector_mutable_read_access()
+{
+ QVector<double> v(N);
+ for (int i = 0; i != N; ++i)
+ v[i] = i;
+
+ QBENCHMARK {
+ for (int i = 0; i != N; ++i)
+ s += v[i];
+ }
+}
+
+#ifdef TEST_RETURN
+extern QVector<double> qvector_fill_and_return_helper();
+extern QVector<double> qvector_fill_and_return_helper2();
+
+void tst_QVector::qvector_fill_and_return()
+{
+ QBENCHMARK {
+ QVector<double> v = qvector_fill_and_return_helper();
+ s += v[1];
+ }
+}
+
+void tst_QVector::qvector_fill_and_return2()
+{
+ QBENCHMARK {
+ QVector<double> v = qvector_fill_and_return_helper2();
+ s += v[1];
+ }
+}
+#endif
+
+
+///////////////////// QRawVector /////////////////////
+
+void tst_QVector::qrawvector_const_read_access()
+{
+ QRawVector<double> v(N);
+ for (int i = 0; i != N; ++i)
+ v[i] = i;
+
+ const QRawVector<double> &vc = v;
+ QBENCHMARK {
+ for (int i = vc.size(); --i >= 0;)
+ s += vc[i];
+ }
+}
+
+void tst_QVector::qrawvector_mutable_read_access()
+{
+ QRawVector<double> v(N);
+ for (int i = 0; i != N; ++i)
+ v[i] = i;
+
+ QBENCHMARK {
+ for (int i = 0; i != N; ++i)
+ s += v[i];
+ }
+}
+
+#ifdef TEST_RETURN
+extern QVector<double> qrawvector_fill_and_return_helper();
+extern QVector<double> qrawvector_fill_and_return_helper2();
+
+void tst_QVector::qrawvector_fill_and_return()
+{
+ QBENCHMARK {
+ QVector<double> v = qrawvector_fill_and_return_helper();
+ s += v[1];
+ }
+}
+
+void tst_QVector::qrawvector_fill_and_return2()
+{
+ QBENCHMARK {
+ QVector<double> v = qrawvector_fill_and_return_helper();
+ s += v[1];
+ }
+}
+#endif
+
+
+///////////////////// std::vector /////////////////////
+
+void tst_QVector::stdvector_const_read_access()
+{
+ std::vector<double> v(N);
+ for (int i = 0; i != N; ++i)
+ v[i] = i;
+
+ const std::vector<double> &vc = v;
+ QBENCHMARK {
+ for (int i = 0; i != N; ++i)
+ s += vc[i];
+ }
+}
+
+void tst_QVector::stdvector_mutable_read_access()
+{
+ std::vector<double> v(N);
+ for (int i = 0; i != N; ++i)
+ v[i] = i;
+
+ QBENCHMARK {
+ for (int i = 0; i != N; ++i)
+ s += v[i];
+ }
+}
+
+#ifdef TEST_RETURN
+extern std::vector<double> stdvector_fill_and_return_helper();
+extern std::vector<double> stdvector_fill_and_return_helper2();
+
+void tst_QVector::stdvector_fill_and_return()
+{
+ QBENCHMARK {
+ std::vector<double> v = stdvector_fill_and_return_helper();
+ s += v[1];
+ }
+}
+
+void tst_QVector::stdvector_fill_and_return2()
+{
+ QBENCHMARK {
+ std::vector<double> v = stdvector_fill_and_return_helper2();
+ s += v[1];
+ }
+}
+#endif
+
+///////////////////// mixed vector /////////////////////
+
+
+#ifdef TEST_RETURN
+extern QVector<double> mixedvector_fill_and_return_helper();
+extern QVector<double> mixedvector_fill_and_return_helper2();
+
+void tst_QVector::mixedvector_fill_and_return()
+{
+ QBENCHMARK {
+ std::vector<double> v = stdvector_fill_and_return_helper();
+ s += v[1];
+ }
+}
+
+void tst_QVector::mixedvector_fill_and_return2()
+{
+ QBENCHMARK {
+ std::vector<double> v = stdvector_fill_and_return_helper2();
+ s += v[1];
+ }
+}
+#endif
+
+QTEST_MAIN(tst_QVector)
+
+#include "main.moc"
diff --git a/tests/benchmarks/qvector/outofline.cpp b/tests/benchmarks/qvector/outofline.cpp
new file mode 100644
index 0000000..d1d72b0
--- /dev/null
+++ b/tests/benchmarks/qvector/outofline.cpp
@@ -0,0 +1,41 @@
+
+#include <QVector>
+#include <vector>
+#include "qrawvector.h"
+
+const int N = 1000000;
+double s = 0;
+
+QVector<double> qvector_fill_and_return_helper()
+{
+ QVector<double> v(N);
+ for (int i = 0; i != N; ++i)
+ v[i] = i;
+ return v;
+}
+
+QVector<double> qrawvector_fill_and_return_helper()
+{
+ QRawVector<double> v(N);
+ for (int i = 0; i != N; ++i)
+ v[i] = i;
+ return v.mutateToVector();
+}
+
+QVector<double> mixedvector_fill_and_return_helper()
+{
+ std::vector<double> v(N);
+ for (int i = 0; i != N; ++i)
+ v[i] = i;
+ return QVector<double>::fromStdVector(v);
+}
+
+
+std::vector<double> stdvector_fill_and_return_helper()
+{
+ std::vector<double> v(N);
+ for (int i = 0; i != N; ++i)
+ v[i] = i;
+ return v;
+}
+
diff --git a/tests/benchmarks/qvector/qrawvector.h b/tests/benchmarks/qvector/qrawvector.h
new file mode 100644
index 0000000..15421eb
--- /dev/null
+++ b/tests/benchmarks/qvector/qrawvector.h
@@ -0,0 +1,742 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtCore 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 QRAWVECTOR_H
+#define QRAWVECTOR_H
+
+#include <QtCore/qiterator.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qatomic.h>
+#include <QtCore/qalgorithms.h>
+#include <QtCore/qlist.h>
+
+#ifndef QT_NO_STL
+#include <iterator>
+#include <vector>
+#endif
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Core)
+
+
+
+template <typename T>
+class QRawVector
+{
+ struct Data : QVectorData { T array[1]; };
+
+ T *m_begin;
+ int m_size;
+ int m_alloc;
+
+public:
+ //static Data dummy;
+ //int headerOffset() { return (char*)&dummy.array - (char*)&dummy; }
+ inline int headerOffset() const {
+ // gcc complains about: return offsetof(Data, array); and also
+ // does not like '0' in the expression below.
+ return (char *)&(((Data *)(1))->array) - (char *)1;
+ }
+ inline Data *toBase(T *begin) const
+ { return (Data*)((char*)begin - headerOffset()); }
+ inline T *fromBase(void *d) const
+ { return (T*)((char*)d + headerOffset()); }
+ inline QRawVector()
+ { m_begin = fromBase(0); m_alloc = m_size = 0; realloc(m_size, m_alloc, true); }
+ explicit QRawVector(int size);
+ QRawVector(int size, const T &t);
+ inline QRawVector(const QRawVector<T> &v)
+ { m_begin = v.m_begin; m_alloc = v.m_alloc; m_size = v.m_size; realloc(m_size, m_alloc, true); }
+ inline ~QRawVector() { free(m_begin, m_size); }
+ QRawVector<T> &operator=(const QRawVector<T> &v);
+ bool operator==(const QRawVector<T> &v) const;
+ inline bool operator!=(const QRawVector<T> &v) const { return !(*this == v); }
+
+ inline int size() const { return m_size; }
+
+ inline bool isEmpty() const { return m_size == 0; }
+
+ void resize(int size);
+
+ inline int capacity() const { return m_alloc; }
+ void reserve(int size);
+ inline void squeeze() { realloc(m_size, m_size, false); }
+
+ inline T *data() { return m_begin; }
+ inline const T *data() const { return m_begin; }
+ inline const T *constData() const { return m_begin; }
+ void clear();
+
+ const T &at(int i) const;
+ T &operator[](int i);
+ const T &operator[](int i) const;
+ void append(const T &t);
+ void prepend(const T &t);
+ void insert(int i, const T &t);
+ void insert(int i, int n, const T &t);
+ void replace(int i, const T &t);
+ void remove(int i);
+ void remove(int i, int n);
+
+ QRawVector<T> &fill(const T &t, int size = -1);
+
+ int indexOf(const T &t, int from = 0) const;
+ int lastIndexOf(const T &t, int from = -1) const;
+ bool contains(const T &t) const;
+ int count(const T &t) const;
+
+#ifdef QT_STRICT_ITERATORS
+ class iterator {
+ public:
+ T *i;
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef ptrdiff_t difference_type;
+ typedef T value_type;
+ typedef T *pointer;
+ typedef T &reference;
+
+ inline iterator() : i(0) {}
+ inline iterator(T *n) : i(n) {}
+ inline iterator(const iterator &o): i(o.i){}
+ inline T &operator*() const { return *i; }
+ inline T *operator->() const { return i; }
+ inline T &operator[](int j) const { return *(i + j); }
+ inline bool operator==(const iterator &o) const { return i == o.i; }
+ inline bool operator!=(const iterator &o) const { return i != o.i; }
+ inline bool operator<(const iterator& other) const { return i < other.i; }
+ inline bool operator<=(const iterator& other) const { return i <= other.i; }
+ inline bool operator>(const iterator& other) const { return i > other.i; }
+ inline bool operator>=(const iterator& other) const { return i >= other.i; }
+ inline iterator &operator++() { ++i; return *this; }
+ inline iterator operator++(int) { T *n = i; ++i; return n; }
+ inline iterator &operator--() { i--; return *this; }
+ inline iterator operator--(int) { T *n = i; i--; return n; }
+ inline iterator &operator+=(int j) { i+=j; return *this; }
+ inline iterator &operator-=(int j) { i-=j; return *this; }
+ inline iterator operator+(int j) const { return iterator(i+j); }
+ inline iterator operator-(int j) const { return iterator(i-j); }
+ inline int operator-(iterator j) const { return i - j.i; }
+ };
+ friend class iterator;
+
+ class const_iterator {
+ public:
+ T *i;
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef ptrdiff_t difference_type;
+ typedef T value_type;
+ typedef const T *pointer;
+ typedef const T &reference;
+
+ inline const_iterator() : i(0) {}
+ inline const_iterator(T *n) : i(n) {}
+ inline const_iterator(const const_iterator &o): i(o.i) {}
+ inline explicit const_iterator(const iterator &o): i(o.i) {}
+ inline const T &operator*() const { return *i; }
+ inline const T *operator->() const { return i; }
+ inline const T &operator[](int j) const { return *(i + j); }
+ inline bool operator==(const const_iterator &o) const { return i == o.i; }
+ inline bool operator!=(const const_iterator &o) const { return i != o.i; }
+ inline bool operator<(const const_iterator& other) const { return i < other.i; }
+ inline bool operator<=(const const_iterator& other) const { return i <= other.i; }
+ inline bool operator>(const const_iterator& other) const { return i > other.i; }
+ inline bool operator>=(const const_iterator& other) const { return i >= other.i; }
+ inline const_iterator &operator++() { ++i; return *this; }
+ inline const_iterator operator++(int) { T *n = i; ++i; return n; }
+ inline const_iterator &operator--() { i--; return *this; }
+ inline const_iterator operator--(int) { T *n = i; i--; return n; }
+ inline const_iterator &operator+=(int j) { i+=j; return *this; }
+ inline const_iterator &operator-=(int j) { i+=j; return *this; }
+ inline const_iterator operator+(int j) const { return const_iterator(i+j); }
+ inline const_iterator operator-(int j) const { return const_iterator(i-j); }
+ inline int operator-(const_iterator j) const { return i - j.i; }
+ };
+ friend class const_iterator;
+#else
+ // STL-style
+ typedef T *iterator;
+ typedef const T *const_iterator;
+#endif
+ inline iterator begin() { return m_begin; }
+ inline const_iterator begin() const { return m_begin; }
+ inline const_iterator constBegin() const { return m_begin; }
+ inline iterator end() { return m_begin + m_size; }
+ inline const_iterator end() const { return m_begin + m_size; }
+ inline const_iterator constEnd() const { return m_begin + m_size; }
+ iterator insert(iterator before, int n, const T &x);
+ inline iterator insert(iterator before, const T &x) { return insert(before, 1, x); }
+ iterator erase(iterator begin, iterator end);
+ inline iterator erase(iterator pos) { return erase(pos, pos+1); }
+
+ // more Qt
+ inline int count() const { return m_size; }
+ inline T& first() { Q_ASSERT(!isEmpty()); return *begin(); }
+ inline const T &first() const { Q_ASSERT(!isEmpty()); return *begin(); }
+ inline T& last() { Q_ASSERT(!isEmpty()); return *(end()-1); }
+ inline const T &last() const { Q_ASSERT(!isEmpty()); return *(end()-1); }
+ inline bool startsWith(const T &t) const { return !isEmpty() && first() == t; }
+ inline bool endsWith(const T &t) const { return !isEmpty() && last() == t; }
+ QRawVector<T> mid(int pos, int length = -1) const;
+
+ T value(int i) const;
+ T value(int i, const T &defaultValue) const;
+
+ // STL compatibility
+ typedef T value_type;
+ typedef value_type *pointer;
+ typedef const value_type *const_pointer;
+ typedef value_type &reference;
+ typedef const value_type &const_reference;
+ typedef ptrdiff_t difference_type;
+ typedef iterator Iterator;
+ typedef const_iterator ConstIterator;
+ typedef int size_type;
+ inline void push_back(const T &t) { append(t); }
+ inline void push_front(const T &t) { prepend(t); }
+ void pop_back() { Q_ASSERT(!isEmpty()); erase(end()-1); }
+ void pop_front() { Q_ASSERT(!isEmpty()); erase(begin()); }
+ inline bool empty() const { return m_size == 0; }
+ inline T &front() { return first(); }
+ inline const_reference front() const { return first(); }
+ inline reference back() { return last(); }
+ inline const_reference back() const { return last(); }
+
+ // comfort
+ QRawVector<T> &operator+=(const QRawVector<T> &l);
+ inline QRawVector<T> operator+(const QRawVector<T> &l) const
+ { QRawVector n = *this; n += l; return n; }
+ inline QRawVector<T> &operator+=(const T &t)
+ { append(t); return *this; }
+ inline QRawVector<T> &operator<< (const T &t)
+ { append(t); return *this; }
+ inline QRawVector<T> &operator<<(const QRawVector<T> &l)
+ { *this += l; return *this; }
+
+ QList<T> toList() const;
+
+ //static QRawVector<T> fromList(const QList<T> &list);
+
+#ifndef QT_NO_STL
+ static inline QRawVector<T> fromStdVector(const std::vector<T> &vector)
+ { QRawVector<T> tmp; qCopy(vector.begin(), vector.end(), std::back_inserter(tmp)); return tmp; }
+ inline std::vector<T> toStdVector() const
+ { std::vector<T> tmp; qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; }
+#endif
+
+private:
+ T *allocate(int alloc);
+ void realloc(int size, int alloc, bool ref);
+ void free(T *begin, int size);
+ int sizeOfTypedData() {
+ // this is more or less the same as sizeof(Data), except that it doesn't
+ // count the padding at the end
+ return reinterpret_cast<const char *>(&(reinterpret_cast<const Data *>(this))->array[1]) - reinterpret_cast<const char *>(this);
+ }
+ static inline int alignOfTypedData()
+ {
+#ifdef Q_ALIGNOF
+ return qMax<int>(sizeof(void*), Q_ALIGNOF(Data));
+#else
+ return 0;
+#endif
+ }
+
+public:
+ QVector<T> mutateToVector()
+ {
+ Data *d = toBase(m_begin);
+ d->ref = 1;
+ d->alloc = m_alloc;
+ d->size = m_size;
+ d->sharable = 0;
+ d->capacity = 0;
+
+ QVector<T> v;
+ *reinterpret_cast<QVectorData **>(&v) = d;
+ m_begin = fromBase(0);
+ m_size = m_alloc = 0;
+ return v;
+ }
+};
+
+
+template <typename T>
+void QRawVector<T>::reserve(int asize)
+{ if (asize > m_alloc) realloc(m_size, asize, false); }
+template <typename T>
+void QRawVector<T>::resize(int asize)
+{ realloc(asize, (asize > m_alloc || (asize < m_size && asize < (m_alloc >> 1)))
+ ? QVectorData::grow(sizeOfTypedData(), asize, sizeof(T), QTypeInfo<T>::isStatic)
+ : m_alloc, false); }
+template <typename T>
+inline void QRawVector<T>::clear()
+{ *this = QRawVector<T>(); }
+template <typename T>
+inline const T &QRawVector<T>::at(int i) const
+{ Q_ASSERT_X(i >= 0 && i < m_size, "QRawVector<T>::at", "index out of range");
+ return m_begin[i]; }
+template <typename T>
+inline const T &QRawVector<T>::operator[](int i) const
+{ Q_ASSERT_X(i >= 0 && i < m_size, "QRawVector<T>::operator[]", "index out of range");
+ return m_begin[i]; }
+template <typename T>
+inline T &QRawVector<T>::operator[](int i)
+{ Q_ASSERT_X(i >= 0 && i < m_size, "QRawVector<T>::operator[]", "index out of range");
+ return data()[i]; }
+template <typename T>
+inline void QRawVector<T>::insert(int i, const T &t)
+{ Q_ASSERT_X(i >= 0 && i <= m_size, "QRawVector<T>::insert", "index out of range");
+ insert(begin() + i, 1, t); }
+template <typename T>
+inline void QRawVector<T>::insert(int i, int n, const T &t)
+{ Q_ASSERT_X(i >= 0 && i <= m_size, "QRawVector<T>::insert", "index out of range");
+ insert(begin() + i, n, t); }
+template <typename T>
+inline void QRawVector<T>::remove(int i, int n)
+{ Q_ASSERT_X(i >= 0 && n >= 0 && i + n <= m_size, "QRawVector<T>::remove", "index out of range");
+ erase(begin() + i, begin() + i + n); }
+template <typename T>
+inline void QRawVector<T>::remove(int i)
+{ Q_ASSERT_X(i >= 0 && i < m_size, "QRawVector<T>::remove", "index out of range");
+ erase(begin() + i, begin() + i + 1); }
+template <typename T>
+inline void QRawVector<T>::prepend(const T &t)
+{ insert(begin(), 1, t); }
+
+template <typename T>
+inline void QRawVector<T>::replace(int i, const T &t)
+{
+ Q_ASSERT_X(i >= 0 && i < m_size, "QRawVector<T>::replace", "index out of range");
+ const T copy(t);
+ data()[i] = copy;
+}
+
+template <typename T>
+QRawVector<T> &QRawVector<T>::operator=(const QRawVector<T> &v)
+{
+ if (this != &v) {
+ free(m_begin, m_size);
+ m_alloc = v.m_alloc;
+ m_size = v.m_size;
+ m_begin = v.m_begin;
+ realloc(m_size, m_alloc, true);
+ }
+ return *this;
+}
+
+template <typename T>
+inline T *QRawVector<T>::allocate(int aalloc)
+{
+ QVectorData *d = QVectorData::allocate(sizeOfTypedData() + (aalloc - 1) * sizeof(T), alignOfTypedData());
+ Q_CHECK_PTR(d);
+ return fromBase(d);
+}
+
+template <typename T>
+QRawVector<T>::QRawVector(int asize)
+{
+ m_size = m_alloc = asize;
+ m_begin = allocate(asize);
+ if (QTypeInfo<T>::isComplex) {
+ T *b = m_begin;
+ T *i = m_begin + m_size;
+ while (i != b)
+ new (--i) T;
+ } else {
+ qMemSet(m_begin, 0, asize * sizeof(T));
+ }
+}
+
+template <typename T>
+QRawVector<T>::QRawVector(int asize, const T &t)
+{
+ m_size = m_alloc = asize;
+ m_begin = allocate(asize);
+ T *i = m_begin + m_size;
+ while (i != m_begin)
+ new (--i) T(t);
+}
+
+template <typename T>
+void QRawVector<T>::free(T *begin, int size)
+{
+ if (QTypeInfo<T>::isComplex) {
+ T *i = begin + size;
+ while (i-- != begin)
+ i->~T();
+ }
+ Data *x = toBase(begin);
+ x->free(x, alignOfTypedData());
+}
+
+template <typename T>
+void QRawVector<T>::realloc(int asize, int aalloc, bool ref)
+{
+ if (QTypeInfo<T>::isComplex && asize < m_size && !ref) {
+ // call the destructor on all objects that need to be
+ // destroyed when shrinking
+ T *pOld = m_begin + m_size;
+ while (asize < m_size) {
+ (--pOld)->~T();
+ --m_size;
+ }
+ }
+
+ int xalloc = m_alloc;
+ int xsize = m_size;
+ bool changed = false;
+ T *xbegin = m_begin;
+ if (aalloc != xalloc || ref) {
+ // (re)allocate memory
+ if (QTypeInfo<T>::isStatic) {
+ xbegin = allocate(aalloc);
+ xsize = 0;
+ changed = true;
+ } else if (ref) {
+ xbegin = allocate(aalloc);
+ if (QTypeInfo<T>::isComplex) {
+ xsize = 0;
+ } else {
+ ::memcpy(xbegin, m_begin, qMin(aalloc, xalloc) * sizeof(T));
+ xsize = m_size;
+ }
+ changed = true;
+ } else {
+ QT_TRY {
+ QVectorData *mem = QVectorData::reallocate(
+ toBase(m_begin), sizeOfTypedData() + (aalloc - 1) * sizeof(T),
+ sizeOfTypedData()
++ (xalloc - 1) * sizeof(T), alignOfTypedData());
+ Q_CHECK_PTR(mem);
+ xbegin = fromBase(mem);
+ xsize = m_size;
+ } QT_CATCH (const std::bad_alloc &) {
+ if (aalloc > xalloc) // ignore the error in case we are just shrinking.
+ QT_RETHROW;
+ }
+ }
+ xalloc = aalloc;
+ }
+
+ if (QTypeInfo<T>::isComplex) {
+ QT_TRY {
+ T *pOld = m_begin + xsize;
+ T *pNew = xbegin + xsize;
+ // copy objects from the old array into the new array
+ while (xsize < qMin(asize, m_size)) {
+ new (pNew++) T(*pOld++);
+ ++xsize;
+ }
+ // construct all new objects when growing
+ while (xsize < asize) {
+ new (pNew++) T;
+ ++xsize;
+ }
+ } QT_CATCH (...) {
+ free(xbegin, xsize);
+ QT_RETHROW;
+ }
+
+ } else if (asize > xsize) {
+ // initialize newly allocated memory to 0
+ qMemSet(xbegin + xsize, 0, (asize - xsize) * sizeof(T));
+ }
+ xsize = asize;
+
+ if (changed) {
+ if (!ref)
+ free(m_begin, m_size);
+ }
+ m_alloc = xalloc;
+ m_size = xsize;
+ m_begin = xbegin;
+}
+
+template<typename T>
+Q_OUTOFLINE_TEMPLATE T QRawVector<T>::value(int i) const
+{
+ return (i < 0 || i >= m_size) ? T() : m_begin[i];
+}
+template<typename T>
+Q_OUTOFLINE_TEMPLATE T QRawVector<T>::value(int i, const T &defaultValue) const
+{
+ return (i < 0 || i >= m_size) ? defaultValue : m_begin[i];
+}
+
+template <typename T>
+void QRawVector<T>::append(const T &t)
+{
+ if (m_size + 1 > m_alloc) {
+ const T copy(t);
+ realloc(m_size, QVectorData::grow(sizeOfTypedData(), m_size + 1, sizeof(T),
+ QTypeInfo<T>::isStatic), false);
+ if (QTypeInfo<T>::isComplex)
+ new (m_begin + m_size) T(copy);
+ else
+ m_begin[m_size] = copy;
+ } else {
+ if (QTypeInfo<T>::isComplex)
+ new (m_begin + m_size) T(t);
+ else
+ m_begin[m_size] = t;
+ }
+ ++m_size;
+}
+
+template <typename T>
+Q_TYPENAME QRawVector<T>::iterator QRawVector<T>::insert(iterator before, size_type n, const T &t)
+{
+ int offset = int(before - m_begin);
+ if (n != 0) {
+ const T copy(t);
+ if (m_size + n > m_alloc)
+ realloc(m_size, QVectorData::grow(sizeOfTypedData(), m_size + n, sizeof(T),
+ QTypeInfo<T>::isStatic), false);
+ if (QTypeInfo<T>::isStatic) {
+ T *b = m_begin + m_size;
+ T *i = m_begin + m_size + n;
+ while (i != b)
+ new (--i) T;
+ i = m_begin + m_size;
+ T *j = i + n;
+ b = m_begin + offset;
+ while (i != b)
+ *--j = *--i;
+ i = b+n;
+ while (i != b)
+ *--i = copy;
+ } else {
+ T *b = m_begin + offset;
+ T *i = b + n;
+ memmove(i, b, (m_size - offset) * sizeof(T));
+ while (i != b)
+ new (--i) T(copy);
+ }
+ m_size += n;
+ }
+ return m_begin + offset;
+}
+
+template <typename T>
+Q_TYPENAME QRawVector<T>::iterator QRawVector<T>::erase(iterator abegin, iterator aend)
+{
+ int f = int(abegin - m_begin);
+ int l = int(aend - m_begin);
+ int n = l - f;
+ if (QTypeInfo<T>::isComplex) {
+ qCopy(m_begin + l, m_begin + m_size, m_begin + f);
+ T *i = m_begin + m_size;
+ T *b = m_begin + m_size - n;
+ while (i != b) {
+ --i;
+ i->~T();
+ }
+ } else {
+ memmove(m_begin + f, m_begin + l, (m_size - l) * sizeof(T));
+ }
+ m_size -= n;
+ return m_begin + f;
+}
+
+template <typename T>
+bool QRawVector<T>::operator==(const QRawVector<T> &v) const
+{
+ if (m_size != v.m_size)
+ return false;
+ T* b = m_begin;
+ T* i = b + m_size;
+ T* j = v.m_begin + m_size;
+ while (i != b)
+ if (!(*--i == *--j))
+ return false;
+ return true;
+}
+
+template <typename T>
+QRawVector<T> &QRawVector<T>::fill(const T &from, int asize)
+{
+ const T copy(from);
+ resize(asize < 0 ? m_size : asize);
+ if (m_size) {
+ T *i = m_begin + m_size;
+ T *b = m_begin;
+ while (i != b)
+ *--i = copy;
+ }
+ return *this;
+}
+
+template <typename T>
+QRawVector<T> &QRawVector<T>::operator+=(const QRawVector &l)
+{
+ int newSize = m_size + l.m_size;
+ realloc(m_size, newSize, false);
+
+ T *w = m_begin + newSize;
+ T *i = l.m_begin + l.m_size;
+ T *b = l.m_begin;
+ while (i != b) {
+ if (QTypeInfo<T>::isComplex)
+ new (--w) T(*--i);
+ else
+ *--w = *--i;
+ }
+ m_size = newSize;
+ return *this;
+}
+
+template <typename T>
+int QRawVector<T>::indexOf(const T &t, int from) const
+{
+ if (from < 0)
+ from = qMax(from + m_size, 0);
+ if (from < m_size) {
+ T* n = m_begin + from - 1;
+ T* e = m_begin + m_size;
+ while (++n != e)
+ if (*n == t)
+ return n - m_begin;
+ }
+ return -1;
+}
+
+template <typename T>
+int QRawVector<T>::lastIndexOf(const T &t, int from) const
+{
+ if (from < 0)
+ from += m_size;
+ else if (from >= m_size)
+ from = m_size-1;
+ if (from >= 0) {
+ T* b = m_begin;
+ T* n = m_begin + from + 1;
+ while (n != b) {
+ if (*--n == t)
+ return n - b;
+ }
+ }
+ return -1;
+}
+
+template <typename T>
+bool QRawVector<T>::contains(const T &t) const
+{
+ T* b = m_begin;
+ T* i = m_begin + m_size;
+ while (i != b)
+ if (*--i == t)
+ return true;
+ return false;
+}
+
+template <typename T>
+int QRawVector<T>::count(const T &t) const
+{
+ int c = 0;
+ T* b = m_begin;
+ T* i = m_begin + m_size;
+ while (i != b)
+ if (*--i == t)
+ ++c;
+ return c;
+}
+
+template <typename T>
+Q_OUTOFLINE_TEMPLATE QRawVector<T> QRawVector<T>::mid(int pos, int length) const
+{
+ if (length < 0)
+ length = size() - pos;
+ if (pos == 0 && length == size())
+ return *this;
+ QRawVector<T> copy;
+ if (pos + length > size())
+ length = size() - pos;
+ for (int i = pos; i < pos + length; ++i)
+ copy += at(i);
+ return copy;
+}
+
+template <typename T>
+Q_OUTOFLINE_TEMPLATE QList<T> QRawVector<T>::toList() const
+{
+ QList<T> result;
+ for (int i = 0; i < size(); ++i)
+ result.append(at(i));
+ return result;
+}
+
+
+/*template <typename T>
+Q_OUTOFLINE_TEMPLATE QRawVector<T> QList<T>::toVector() const
+{
+ QRawVector<T> result(size());
+ for (int i = 0; i < size(); ++i)
+ result[i] = at(i);
+ return result;
+}
+
+template <typename T>
+QRawVector<T> QRawVector<T>::fromList(const QList<T> &list)
+{
+ return list.toVector();
+}
+
+template <typename T>
+QList<T> QList<T>::fromVector(const QRawVector<T> &vector)
+{
+ return vector.toList();
+}
+*/
+
+Q_DECLARE_SEQUENTIAL_ITERATOR(RawVector)
+Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(RawVector)
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QRAWVECTOR_H
diff --git a/tests/benchmarks/qvector/qvector.pro b/tests/benchmarks/qvector/qvector.pro
new file mode 100644
index 0000000..adb30c9
--- /dev/null
+++ b/tests/benchmarks/qvector/qvector.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+TARGET = tst_vector
+QT = core
+INCLUDEPATH += .
+SOURCES += main.cpp outofline.cpp outofline2.cpp
+CONFIG += release