summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-05-28 09:15:41 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-05-28 09:15:41 (GMT)
commitddff256949b93171d4428aaa037051bb5f1fca02 (patch)
treebb900bade37c45210e229bb4cd976c5fc7814cc2 /tests/auto
parent369f899e69362b2156800f8c90dfb0bdbe5f2598 (diff)
parent85fa83ac89367bf4f3a85d038ef64a362aa8377e (diff)
downloadQt-ddff256949b93171d4428aaa037051bb5f1fca02.zip
Qt-ddff256949b93171d4428aaa037051bb5f1fca02.tar.gz
Qt-ddff256949b93171d4428aaa037051bb5f1fca02.tar.bz2
Merge branch 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration into 4.7-integration
* 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration: Added some changes for 4.6.3 Fix compilation for tst_qtextcodec with QT_NO_CONCURRENT defined. Allow auto-test to compile when using namespaces Fix regression in QVarLengthArray::operator= Removed unnecessary PlatSec capabilities from spectrum demo DLL Make test work with shadow builds again. Added missing PlatSec capabilities to spectrum demo DLL My 4.6.3 changes Tidy changes file for 4.6.3. My 4.6.3 changes My 4.6.3 changes Fix the compilation for tst_qabstractprintdialog and tst_qprinter on symbian. Build fix for spectrum demo when -qtnamespace is used Fixed license headers in spectrum demo Qt app draws background incorrectly when animated wallpaper is used Don't use QAtomicInt in statics because they are non-POD. QTBUG-5955: Qt fails to build on alpha architecture
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qabstractprintdialog/tst_qabstractprintdialog.cpp8
-rw-r--r--tests/auto/qprinter/tst_qprinter.cpp11
-rw-r--r--tests/auto/qtextcodec/tst_qtextcodec.cpp4
-rw-r--r--tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp8
-rw-r--r--tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp298
5 files changed, 322 insertions, 7 deletions
diff --git a/tests/auto/qabstractprintdialog/tst_qabstractprintdialog.cpp b/tests/auto/qabstractprintdialog/tst_qabstractprintdialog.cpp
index 15f427c..0700e9e 100644
--- a/tests/auto/qabstractprintdialog/tst_qabstractprintdialog.cpp
+++ b/tests/auto/qabstractprintdialog/tst_qabstractprintdialog.cpp
@@ -50,6 +50,8 @@
//TESTED_CLASS=
//TESTED_FILES=
+#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG)
+
class tst_QAbstractPrintDialog : public QObject
{
Q_OBJECT
@@ -141,3 +143,9 @@ void tst_QAbstractPrintDialog::setFromTo()
QTEST_MAIN(tst_QAbstractPrintDialog)
#include "tst_qabstractprintdialog.moc"
+
+#else
+
+QTEST_NOOP_MAIN
+
+#endif
diff --git a/tests/auto/qprinter/tst_qprinter.cpp b/tests/auto/qprinter/tst_qprinter.cpp
index 8b79533..e908961 100644
--- a/tests/auto/qprinter/tst_qprinter.cpp
+++ b/tests/auto/qprinter/tst_qprinter.cpp
@@ -64,11 +64,13 @@
Q_DECLARE_METATYPE(QRect)
-
+QT_FORWARD_DECLARE_CLASS(QPrinter)
//TESTED_CLASS=
//TESTED_FILES=
+#ifndef QT_NO_PRINTER
+
class tst_QPrinter : public QObject
{
Q_OBJECT
@@ -217,7 +219,6 @@ tst_QPrinter::tst_QPrinter()
tst_QPrinter::~tst_QPrinter()
{
-
}
// initTestCase will be executed once before the first testfunction is executed.
@@ -1056,3 +1057,9 @@ void tst_QPrinter::testPdfTitle()
QTEST_MAIN(tst_QPrinter)
#include "tst_qprinter.moc"
+
+#else //QT_NO_PRINTER
+
+QTEST_NOOP_MAIN
+
+#endif //QT_NO_PRINTER
diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp
index 4e7123f..c91201e 100644
--- a/tests/auto/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp
@@ -2002,6 +2002,8 @@ void tst_QTextCodec::threadSafety()
QCOMPARE(res.results(), codecList);
QCOMPARE(res2.results(), mibList);
#endif
+ QSKIP("This function is not yet supported with QT_NO_CONCURRENT defined.", SkipAll);
+#endif
}
void tst_QTextCodec::invalidNames()
@@ -2012,7 +2014,7 @@ void tst_QTextCodec::invalidNames()
QVERIFY(!QTextCodec::codecForName("\1a\2b\3a\4d\5c\6s\7a\xffr\xec_\x9c_"));
QVERIFY(!QTextCodec::codecForName("\n"));
QVERIFY(!QTextCodec::codecForName("don't exist"));
- QByteArray huge = "azertyuiop^$qsdfghjklm<wxcvbn,;:=1234567890°_";
+ QByteArray huge = "azertyuiop^$qsdfghjklm<wxcvbn,;:=1234567890�_";
huge = huge + huge + huge + huge + huge + huge + huge + huge;
huge = huge + huge + huge + huge + huge + huge + huge + huge;
huge = huge + huge + huge + huge + huge + huge + huge + huge;
diff --git a/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp
index dac631b..1f65ae7 100644
--- a/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp
+++ b/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp
@@ -56,7 +56,7 @@
#elif defined(Q_OS_WINCE)
#define LACKEYDIR SRCDIR
#else
-#define LACKEYDIR SRCDIR "../lackey"
+#define LACKEYDIR "../lackey"
#endif
Q_DECLARE_METATYPE(QSharedMemory::SharedMemoryError)
@@ -421,7 +421,7 @@ void tst_QSharedMemory::readOnly()
QString program = LACKEYDIR "/lackey";
QStringList arguments;
rememberKey("readonly_segfault");
- arguments << LACKEYDIR "/scripts/readonly_segfault.js";
+ arguments << SRCDIR "../lackey/scripts/readonly_segfault.js";
// ### on windows disable the popup somehow
QProcess p;
@@ -734,7 +734,7 @@ void tst_QSharedMemory::simpleProcessProducerConsumer()
rememberKey("market");
- QStringList arguments = QStringList() << LACKEYDIR "/scripts/producer.js";
+ QStringList arguments = QStringList() << SRCDIR "../lackey/scripts/producer.js";
QProcess producer;
producer.setProcessChannelMode(QProcess::ForwardedChannels);
producer.start( LACKEYDIR "/lackey", arguments);
@@ -744,7 +744,7 @@ void tst_QSharedMemory::simpleProcessProducerConsumer()
QList<QProcess*> consumers;
unsigned int failedProcesses = 0;
for (int i = 0; i < processes; ++i) {
- QStringList arguments = QStringList() << LACKEYDIR "/scripts/consumer.js";
+ QStringList arguments = QStringList() << SRCDIR "../lackey/scripts/consumer.js";
QProcess *p = new QProcess;
p->setProcessChannelMode(QProcess::ForwardedChannels);
#ifdef Q_OS_WINCE
diff --git a/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp
index 5708726..26da506 100644
--- a/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp
+++ b/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp
@@ -63,6 +63,7 @@ private slots:
void oldTests();
void task214223();
void QTBUG6718_resize();
+ void QTBUG10978_realloc();
};
int fooCtor = 0;
@@ -304,5 +305,302 @@ void tst_QVarLengthArray::QTBUG6718_resize()
}
}
+struct MyBase
+{
+ MyBase()
+ : data(this)
+ , isCopy(false)
+ {
+ ++liveCount;
+ }
+
+ MyBase(MyBase const &)
+ : data(this)
+ , isCopy(true)
+ {
+ ++copyCount;
+ ++liveCount;
+ }
+
+ MyBase & operator=(MyBase const &)
+ {
+ if (!isCopy) {
+ isCopy = true;
+ ++copyCount;
+ } else {
+ ++errorCount;
+ }
+
+ return *this;
+ }
+
+ ~MyBase()
+ {
+ if (isCopy) {
+ if (!copyCount)
+ ++errorCount;
+ else
+ --copyCount;
+ }
+
+ if (!liveCount)
+ ++errorCount;
+ else
+ --liveCount;
+ }
+
+ bool hasMoved() const
+ {
+ return this != data;
+ }
+
+protected:
+ MyBase const * const data;
+ bool isCopy;
+
+public:
+ static int errorCount;
+ static int liveCount;
+ static int copyCount;
+};
+
+int MyBase::errorCount = 0;
+int MyBase::liveCount = 0;
+int MyBase::copyCount = 0;
+
+struct MyPrimitive
+ : MyBase
+{
+ MyPrimitive()
+ {
+ ++errorCount;
+ }
+
+ ~MyPrimitive()
+ {
+ ++errorCount;
+ }
+
+ MyPrimitive(MyPrimitive const &other)
+ : MyBase(other)
+ {
+ ++errorCount;
+ }
+};
+
+struct MyMovable
+ : MyBase
+{
+};
+
+struct MyComplex
+ : MyBase
+{
+};
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_TYPEINFO(MyPrimitive, Q_PRIMITIVE_TYPE);
+Q_DECLARE_TYPEINFO(MyMovable, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(MyComplex, Q_COMPLEX_TYPE);
+
+QT_END_NAMESPACE
+
+bool QTBUG10978_proceed = true;
+
+template <class T, int PreAlloc>
+int countMoved(QVarLengthArray<T, PreAlloc> const &c)
+{
+ int result = 0;
+ for (int i = 0; i < c.size(); ++i)
+ if (c[i].hasMoved())
+ ++result;
+
+ return result;
+}
+
+template <class T>
+void QTBUG10978_test()
+{
+ QTBUG10978_proceed = false;
+
+ typedef QVarLengthArray<T, 16> Container;
+ enum {
+ isStatic = QTypeInfo<T>::isStatic,
+ isComplex = QTypeInfo<T>::isComplex,
+
+ isPrimitive = !isComplex && !isStatic,
+ isMovable = !isStatic
+ };
+
+ // Constructors
+ Container a;
+ QCOMPARE( MyBase::liveCount, 0 );
+ QCOMPARE( MyBase::copyCount, 0 );
+
+ QVERIFY( a.capacity() >= 16 );
+ QCOMPARE( a.size(), 0 );
+
+ Container b_real(8);
+ Container const &b = b_real;
+ QCOMPARE( MyBase::liveCount, isPrimitive ? 0 : 8 );
+ QCOMPARE( MyBase::copyCount, 0 );
+
+ QVERIFY( b.capacity() >= 16 );
+ QCOMPARE( b.size(), 8 );
+
+ // Assignment
+ a = b;
+ QCOMPARE( MyBase::liveCount, isPrimitive ? 0 : 16 );
+ QCOMPARE( MyBase::copyCount, isComplex ? 8 : 0 );
+ QVERIFY( a.capacity() >= 16 );
+ QCOMPARE( a.size(), 8 );
+
+ QVERIFY( b.capacity() >= 16 );
+ QCOMPARE( b.size(), 8 );
+
+ // append
+ a.append(b.data(), b.size());
+ QCOMPARE( MyBase::liveCount, isPrimitive ? 0 : 24 );
+ QCOMPARE( MyBase::copyCount, isComplex ? 16 : 0 );
+
+ QVERIFY( a.capacity() >= 16 );
+ QCOMPARE( a.size(), 16 );
+
+ QVERIFY( b.capacity() >= 16 );
+ QCOMPARE( b.size(), 8 );
+
+ // removeLast
+ a.removeLast();
+ QCOMPARE( MyBase::liveCount, isPrimitive ? 0 : 23 );
+ QCOMPARE( MyBase::copyCount, isComplex ? 15 : 0 );
+
+ QVERIFY( a.capacity() >= 16 );
+ QCOMPARE( a.size(), 15 );
+
+ QVERIFY( b.capacity() >= 16 );
+ QCOMPARE( b.size(), 8 );
+
+ // Movable types
+ const int capacity = a.capacity();
+ if (!isPrimitive)
+ QCOMPARE( countMoved(a), 0 );
+
+ // Reserve, no re-allocation
+ a.reserve(capacity);
+ if (!isPrimitive)
+ QCOMPARE( countMoved(a), 0 );
+ QCOMPARE( MyBase::liveCount, isPrimitive ? 0 : 23 );
+ QCOMPARE( MyBase::copyCount, isComplex ? 15 : 0 );
+
+ QCOMPARE( a.capacity(), capacity );
+ QCOMPARE( a.size(), 15 );
+
+ QVERIFY( b.capacity() >= 16 );
+ QCOMPARE( b.size(), 8 );
+
+ // Reserve, force re-allocation
+ a.reserve(capacity * 2);
+ if (!isPrimitive)
+ QCOMPARE( countMoved(a), isMovable ? 15 : 0 );
+ QCOMPARE( MyBase::liveCount, isPrimitive ? 0 : 23 );
+ QCOMPARE( MyBase::copyCount, isComplex ? 15 : 0 );
+
+ QVERIFY( a.capacity() >= capacity * 2 );
+ QCOMPARE( a.size(), 15 );
+
+ QVERIFY( b.capacity() >= 16 );
+ QCOMPARE( b.size(), 8 );
+
+ // resize, grow
+ a.resize(40);
+ if (!isPrimitive)
+ QCOMPARE( countMoved(a), isMovable ? 15 : 0 );
+ QCOMPARE( MyBase::liveCount, isPrimitive ? 0 : 48 );
+ QCOMPARE( MyBase::copyCount, isComplex ? 15 : 0 );
+
+ QVERIFY( a.capacity() >= a.size() );
+ QCOMPARE( a.size(), 40 );
+
+ QVERIFY( b.capacity() >= 16 );
+ QCOMPARE( b.size(), 8 );
+
+ // Copy constructor, allocate
+ {
+ Container c(a);
+ if (!isPrimitive)
+ QCOMPARE( countMoved(c), 0 );
+ QCOMPARE( MyBase::liveCount, isPrimitive ? 0 : 88 );
+ QCOMPARE( MyBase::copyCount, isComplex ? 55 : 0 );
+
+ QVERIFY( a.capacity() >= a.size() );
+ QCOMPARE( a.size(), 40 );
+
+ QVERIFY( b.capacity() >= 16 );
+ QCOMPARE( b.size(), 8 );
+
+ QVERIFY( c.capacity() >= 40 );
+ QCOMPARE( c.size(), 40 );
+ }
+
+ // resize, shrink
+ a.resize(10);
+ if (!isPrimitive)
+ QCOMPARE( countMoved(a), isMovable ? 10 : 0 );
+ QCOMPARE( MyBase::liveCount, isPrimitive ? 0 : 18 );
+ QCOMPARE( MyBase::copyCount, isComplex ? 10 : 0 );
+
+ QVERIFY( a.capacity() >= a.size() );
+ QCOMPARE( a.size(), 10 );
+
+ QVERIFY( b.capacity() >= 16 );
+ QCOMPARE( b.size(), 8 );
+
+ // Copy constructor, don't allocate
+ {
+ Container c(a);
+ if (!isPrimitive)
+ QCOMPARE( countMoved(c), 0 );
+ QCOMPARE( MyBase::liveCount, isPrimitive ? 0 : 28 );
+ QCOMPARE( MyBase::copyCount, isComplex ? 20 : 0 );
+
+ QVERIFY( a.capacity() >= a.size() );
+ QCOMPARE( a.size(), 10 );
+
+ QVERIFY( b.capacity() >= 16 );
+ QCOMPARE( b.size(), 8 );
+
+ QVERIFY( c.capacity() >= 16 );
+ QCOMPARE( c.size(), 10 );
+ }
+
+ a.clear();
+ QCOMPARE( a.size(), 0 );
+
+ b_real.clear();
+ QCOMPARE( b.size(), 0 );
+
+ QCOMPARE(MyBase::errorCount, 0);
+ QCOMPARE(MyBase::liveCount, 0);
+
+ // All done
+ QTBUG10978_proceed = true;
+}
+
+void tst_QVarLengthArray::QTBUG10978_realloc()
+{
+ QTBUG10978_test<MyBase>();
+ QVERIFY(QTBUG10978_proceed);
+
+ QTBUG10978_test<MyPrimitive>();
+ QVERIFY(QTBUG10978_proceed);
+
+ QTBUG10978_test<MyMovable>();
+ QVERIFY(QTBUG10978_proceed);
+
+ QTBUG10978_test<MyComplex>();
+ QVERIFY(QTBUG10978_proceed);
+}
+
QTEST_APPLESS_MAIN(tst_QVarLengthArray)
#include "tst_qvarlengtharray.moc"