summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSergio Ahumada <sergio.ahumada@digia.com>2013-09-27 11:14:48 +0200
committerSergio Ahumada <sergio.ahumada@digia.com>2013-09-27 11:15:09 +0200
commit16a36239ab9e9be45a940aeff94f35e29bdeb944 (patch)
treeed6c159f12fa2ff80cf39b97a65eab0546ffe639 /tests
parente37001aad7f6e4bbad250addba033f1eaf97d566 (diff)
parent00da2e615e89c46affbc130b4df6148785724a23 (diff)
Merge branch 'stable' into dev
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/global/qglobal/tst_qglobal.cpp2
-rw-r--r--tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp3
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp32
-rw-r--r--tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp11
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp5
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp12
-rw-r--r--tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp2
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp3
-rw-r--r--tests/auto/sql/kernel/qsql/tst_qsql.cpp20
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp20
10 files changed, 58 insertions, 52 deletions
diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
index 290afec776..4a50a45ea6 100644
--- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
+++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
@@ -324,7 +324,7 @@ void tst_QGlobal::qCoreAppStartupFunction()
{
QCOMPARE(qStartupFunctionValue, 0);
int argc = 1;
- char *argv[] = { const_cast<char*>("tst_qglobal") };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
QCOMPARE(qStartupFunctionValue, 124);
}
diff --git a/tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp b/tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp
index 33146cafd1..21d03cd04d 100644
--- a/tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp
+++ b/tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp
@@ -70,8 +70,7 @@ void tst_QProcessNoApplication::initializationDeadlock()
}
};
- static char argv0[] = "tst_QProcessNoApplication";
- char *argv[] = { argv0, 0 };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()), 0 };
int argc = 1;
QCoreApplication app(argc, argv);
MyThread thread;
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
index ccaa2bec4f..78f2cdae69 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
+++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
@@ -88,7 +88,7 @@ public:
void tst_QCoreApplication::sendEventsOnProcessEvents()
{
int argc = 1;
- char *argv[] = { const_cast<char*>("tst_qcoreapplication") };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
EventSpy spy;
@@ -110,7 +110,7 @@ void tst_QCoreApplication::getSetCheck()
// Test the property
{
int argc = 1;
- char *argv[] = { const_cast<char*>("tst_qcoreapplication") };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
QCOMPARE(app.property("applicationVersion").toString(), v);
}
@@ -135,7 +135,7 @@ void tst_QCoreApplication::argc()
{
{
int argc = 1;
- char *argv[] = { const_cast<char*>("tst_qcoreapplication") };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
QCOMPARE(argc, 1);
QCOMPARE(app.arguments().count(), 1);
@@ -143,7 +143,7 @@ void tst_QCoreApplication::argc()
{
int argc = 4;
- char *argv[] = { const_cast<char*>("tst_qcoreapplication"),
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()),
const_cast<char*>("arg1"),
const_cast<char*>("arg2"),
const_cast<char*>("arg3") };
@@ -162,7 +162,7 @@ void tst_QCoreApplication::argc()
{
int argc = 2;
- char *argv[] = { const_cast<char*>("tst_qcoreapplication"),
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()),
const_cast<char*>("-qmljsdebugger=port:3768,block") };
QCoreApplication app(argc, argv);
QCOMPARE(argc, 1);
@@ -196,7 +196,7 @@ public:
void tst_QCoreApplication::postEvent()
{
int argc = 1;
- char *argv[] = { const_cast<char*>("tst_qcoreapplication") };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
EventSpy spy;
@@ -281,7 +281,7 @@ void tst_QCoreApplication::postEvent()
void tst_QCoreApplication::removePostedEvents()
{
int argc = 1;
- char *argv[] = { const_cast<char*>("tst_qcoreapplication") };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
EventSpy spy;
@@ -460,7 +460,7 @@ public:
void tst_QCoreApplication::deliverInDefinedOrder()
{
int argc = 1;
- char *argv[] = { const_cast<char*>("tst_qcoreapplication") };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
DeliverInDefinedOrderObject obj(&app);
@@ -500,7 +500,7 @@ public:
void tst_QCoreApplication::globalPostedEventsCount()
{
int argc = 1;
- char *argv[] = { const_cast<char*>("tst_qcoreapplication") };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
QCoreApplication::sendPostedEvents();
@@ -546,7 +546,7 @@ public:
void tst_QCoreApplication::processEventsAlwaysSendsPostedEvents()
{
int argc = 1;
- char *argv[] = { const_cast<char*>("tst_qcoreapplication") };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
ProcessEventsAlwaysSendsPostedEventsObject object;
@@ -564,7 +564,7 @@ void tst_QCoreApplication::processEventsAlwaysSendsPostedEvents()
void tst_QCoreApplication::reexec()
{
int argc = 1;
- char *argv[] = { const_cast<char*>("tst_qcoreapplication") };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
// exec once
@@ -579,7 +579,7 @@ void tst_QCoreApplication::reexec()
void tst_QCoreApplication::execAfterExit()
{
int argc = 1;
- char *argv[] = { const_cast<char*>("tst_qcoreapplication") };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
app.exit(1);
@@ -590,7 +590,7 @@ void tst_QCoreApplication::execAfterExit()
void tst_QCoreApplication::eventLoopExecAfterExit()
{
int argc = 1;
- char *argv[] = { const_cast<char*>("tst_qcoreapplication") };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
// exec once and exit
@@ -648,7 +648,7 @@ void tst_QCoreApplication::customEventDispatcher()
QVERIFY(!weak_ed.isNull());
{
int argc = 1;
- char *argv[] = { const_cast<char*>("tst_qcoreapplication") };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
// instantiating app should not overwrite the ED
QCOMPARE(QCoreApplication::eventDispatcher(), ed);
@@ -763,7 +763,7 @@ private slots:
void tst_QCoreApplication::testQuitLock()
{
int argc = 1;
- char *argv[] = { const_cast<char*>("tst_qcoreapplication") };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
QuitTester tester;
@@ -782,7 +782,7 @@ void tst_QCoreApplication::QTBUG31606_QEventDestructorDeadLock()
};
int argc = 1;
- char *argv[] = { const_cast<char*>("tst_qcoreapplication") };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
EventSpy spy;
diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
index 9219ff72df..d8965dee5d 100644
--- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
+++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp
@@ -48,6 +48,9 @@ class tst_QCommandLineParser : public QObject
{
Q_OBJECT
+public slots:
+ void initTestCase();
+
private slots:
void parsingModes_data();
@@ -81,9 +84,15 @@ private slots:
void testQuoteEscaping();
};
-static char *empty_argv[] = { const_cast<char*>("tst_qcommandlineparser") };
+static char *empty_argv[] = { 0 };
static int empty_argc = 1;
+void tst_QCommandLineParser::initTestCase()
+{
+ Q_ASSERT(!empty_argv[0]);
+ empty_argv[0] = const_cast<char*>(QTest::currentAppName());
+}
+
Q_DECLARE_METATYPE(QCommandLineParser::SingleDashWordOptionMode)
void tst_QCommandLineParser::parsingModes_data()
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index 8411cfe29b..d6dea05755 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -1407,10 +1407,7 @@ void tst_QLocale::macDefaultLocale()
QCOMPARE(locale.decimalPoint(), QChar('.'));
QCOMPARE(locale.groupSeparator(), QChar(','));
QCOMPARE(locale.dateFormat(QLocale::ShortFormat), QString("M/d/yy"));
- if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_6)
- QCOMPARE(locale.dateFormat(QLocale::LongFormat), QString("MMMM d, y"));
- else
- QCOMPARE(locale.dateFormat(QLocale::LongFormat), QString("MMMM d, yyyy"));
+ QCOMPARE(locale.dateFormat(QLocale::LongFormat), QString("MMMM d, yyyy"));
QCOMPARE(locale.timeFormat(QLocale::ShortFormat), QString("h:mm AP"));
QCOMPARE(locale.timeFormat(QLocale::LongFormat), QString("h:mm:ss AP t"));
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 0148ba6d03..48874781c0 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -5240,6 +5240,18 @@ void tst_QString::resizeAfterReserve()
s += "hello world";
s.resize(0);
QVERIFY(s.capacity() == 100);
+
+ // reserve() can't be used to truncate data
+ s.fill('x', 100);
+ s.reserve(50);
+ QVERIFY(s.capacity() == 100);
+ QVERIFY(s.size() == 100);
+
+ // even with increased ref count truncation isn't allowed
+ QString t = s;
+ s.reserve(50);
+ QVERIFY(s.capacity() == 100);
+ QVERIFY(s.size() == 100);
}
void tst_QString::resizeWithNegative() const
diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
index 0f224c4909..7884426d68 100644
--- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
+++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
@@ -768,7 +768,7 @@ void tst_QGuiApplication::genericPluginsAndWindowSystemEvents()
testPluginInfo.rawMetaData = qt_plugin_query_metadata;
qRegisterStaticPluginFunction(testPluginInfo);
int argc = 3;
- char *argv[] = { const_cast<char*>("tst_qguiapplication"), const_cast<char*>("-plugin"), const_cast<char*>("testplugin") };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()), const_cast<char*>("-plugin"), const_cast<char*>("testplugin") };
QGuiApplication app(argc, argv);
QVERIFY(QGuiApplication::primaryScreen());
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 3d57345d2d..0e8d9fa2a3 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -1416,7 +1416,8 @@ void tst_QNetworkReply::initTestCase()
void tst_QNetworkReply::cleanupTestCase()
{
#if !defined Q_OS_WIN
- QFile::remove(wronlyFileName);
+ if (!wronlyFileName.isNull())
+ QFile::remove(wronlyFileName);
#endif
#ifndef QT_NO_BEARERMANAGEMENT
if (networkSession && networkSession->isOpen()) {
diff --git a/tests/auto/sql/kernel/qsql/tst_qsql.cpp b/tests/auto/sql/kernel/qsql/tst_qsql.cpp
index bc6b36931a..5747683e4e 100644
--- a/tests/auto/sql/kernel/qsql/tst_qsql.cpp
+++ b/tests/auto/sql/kernel/qsql/tst_qsql.cpp
@@ -114,8 +114,8 @@ void tst_QSql::cleanup()
void tst_QSql::basicDriverTest()
{
int argc = 1;
- const char *argv[] = {"test"};
- QGuiApplication app(argc, const_cast<char **>(argv), false);
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
+ QGuiApplication app(argc, argv, false);
tst_Databases dbs;
dbs.open();
@@ -155,10 +155,10 @@ void tst_QSql::open()
{
int i;
int argc = 1;
- const char *argv[] = {"test"};
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
int count = -1;
for (i = 0; i < 10; ++i) {
- QGuiApplication app(argc, const_cast<char **>(argv), false);
+ QGuiApplication app(argc, argv, false);
tst_Databases dbs;
dbs.open();
@@ -184,8 +184,8 @@ void tst_QSql::openInvalid()
void tst_QSql::concurrentAccess()
{
int argc = 1;
- const char *argv[] = {"test"};
- QGuiApplication app(argc, const_cast<char **>(argv), false);
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
+ QGuiApplication app(argc, argv, false);
tst_Databases dbs;
dbs.open();
@@ -213,8 +213,8 @@ void tst_QSql::concurrentAccess()
void tst_QSql::openErrorRecovery()
{
int argc = 1;
- const char *argv[] = {"test"};
- QGuiApplication app(argc, const_cast<char **>(argv), false);
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
+ QGuiApplication app(argc, argv, false);
tst_Databases dbs;
dbs.addDbs();
@@ -261,8 +261,8 @@ void tst_QSql::openErrorRecovery()
void tst_QSql::registerSqlDriver()
{
int argc = 1;
- const char *argv[] = {"test"};
- QGuiApplication app(argc, const_cast<char **>(argv), false);
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
+ QGuiApplication app(argc, argv, false);
QSqlDatabase::registerSqlDriver("QSQLTESTDRIVER", new QSqlDriverCreator<QSqlNullDriver>);
QVERIFY(QSqlDatabase::drivers().contains("QSQLTESTDRIVER"));
diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
index c3fc050275..c240b5eb35 100644
--- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
+++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
@@ -439,14 +439,8 @@ void tst_QWizard::setPixmap()
QVERIFY(wizard.pixmap(QWizard::BannerPixmap).isNull());
QVERIFY(wizard.pixmap(QWizard::LogoPixmap).isNull());
QVERIFY(wizard.pixmap(QWizard::WatermarkPixmap).isNull());
-#ifdef Q_OS_MAC
- if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_3) {
- QEXPECT_FAIL("", "QTBUG-23701", Continue);
- QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull() == false);
- } else {
- // fall through since the image doesn't exist on a 10.3 system.
- QVERIFY(page->pixmap(QWizard::BackgroundPixmap).isNull());
- }
+#ifdef Q_OS_MACX
+ QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull() == false);
#else
QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull());
#endif
@@ -454,14 +448,8 @@ void tst_QWizard::setPixmap()
QVERIFY(page->pixmap(QWizard::BannerPixmap).isNull());
QVERIFY(page->pixmap(QWizard::LogoPixmap).isNull());
QVERIFY(page->pixmap(QWizard::WatermarkPixmap).isNull());
-#ifdef Q_OS_MAC
- if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_3) {
- QEXPECT_FAIL("", "QTBUG-23701", Continue);
- QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull() == false);
- } else {
- // fall through since the image doesn't exist on a 10.3 system.
- QVERIFY(page->pixmap(QWizard::BackgroundPixmap).isNull());
- }
+#ifdef Q_OS_MACX
+ QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull() == false);
#else
QVERIFY(page->pixmap(QWizard::BackgroundPixmap).isNull());
#endif