diff options
Diffstat (limited to 'tests/auto/other')
-rw-r--r-- | tests/auto/other/android/android.pro | 11 | ||||
-rw-r--r-- | tests/auto/other/android/testdata/assets/test.txt | 1 | ||||
-rw-r--r-- | tests/auto/other/android/tst_android.cpp | 69 | ||||
-rw-r--r-- | tests/auto/other/lancelot/paintcommands.cpp | 4 | ||||
-rw-r--r-- | tests/auto/other/languagechange/tst_languagechange.cpp | 2 | ||||
-rw-r--r-- | tests/auto/other/other.pro | 4 | ||||
-rw-r--r-- | tests/auto/other/qaccessibility/qaccessibility.pro | 2 | ||||
-rw-r--r-- | tests/auto/other/qaccessibility/tst_qaccessibility.cpp | 8 | ||||
-rw-r--r-- | tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm | 10 | ||||
-rw-r--r-- | tests/auto/other/qprocess_and_guieventloop/write-read-write/main.cpp | 2 | ||||
-rw-r--r-- | tests/auto/other/toolsupport/toolsupport.pro | 4 | ||||
-rw-r--r-- | tests/auto/other/toolsupport/tst_toolsupport.cpp | 153 |
12 files changed, 255 insertions, 15 deletions
diff --git a/tests/auto/other/android/android.pro b/tests/auto/other/android/android.pro new file mode 100644 index 0000000000..60faf8050e --- /dev/null +++ b/tests/auto/other/android/android.pro @@ -0,0 +1,11 @@ +CONFIG += testcase +TARGET = tst_android +QT = core testlib + +SOURCES += \ + tst_android.cpp + +ANDROID_PACKAGE_SOURCE_DIR = $$PWD/testdata + +DISTFILES += \ + testdata/assets/test.txt diff --git a/tests/auto/other/android/testdata/assets/test.txt b/tests/auto/other/android/testdata/assets/test.txt new file mode 100644 index 0000000000..61e2c47c25 --- /dev/null +++ b/tests/auto/other/android/testdata/assets/test.txt @@ -0,0 +1 @@ +FooBar
\ No newline at end of file diff --git a/tests/auto/other/android/tst_android.cpp b/tests/auto/other/android/tst_android.cpp new file mode 100644 index 0000000000..245382ded3 --- /dev/null +++ b/tests/auto/other/android/tst_android.cpp @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtTest/QtTest> + +class tst_Android : public QObject +{ +Q_OBJECT +private slots: + void assetsRead(); + void assetsNotWritable(); +}; + +void tst_Android::assetsRead() +{ + { + QFile file("assets:/test.txt"); + QVERIFY(file.open(QIODevice::ReadOnly)); + QCOMPARE(file.readAll(), QByteArray("FooBar")); + } + + { + QFile file("assets:/test.txt"); + QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); + QCOMPARE(file.readAll(), QByteArray("FooBar")); + } +} + +void tst_Android::assetsNotWritable() +{ + QFile file("assets:/test.txt"); + QVERIFY(!file.open(QIODevice::WriteOnly)); + QVERIFY(!file.open(QIODevice::ReadWrite)); + QVERIFY(!file.open(QIODevice::Append)); +} + +QTEST_MAIN(tst_Android) +#include "tst_android.moc" + diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp index 76a309a7ec..c0034153d3 100644 --- a/tests/auto/other/lancelot/paintcommands.cpp +++ b/tests/auto/other/lancelot/paintcommands.cpp @@ -2385,7 +2385,7 @@ void PaintCommands::command_surface_begin(QRegExp re) m_painter = new QPainter(m_surface_glpaintdevice); m_painter->fillRect(QRect(0, 0, qRound(w), qRound(h)), Qt::transparent); #endif -#ifdef Q_WS_X11 +#ifdef Q_DEAD_CODE_FROM_QT4_X11 } else if (m_type == WidgetType) { m_surface_pixmap = QPixmap(qRound(w), qRound(h)); m_surface_pixmap.fill(Qt::transparent); @@ -2436,7 +2436,7 @@ void PaintCommands::command_surface_end(QRegExp) m_painter->beginNativePainting(); m_painter->endNativePainting(); #endif -#ifdef Q_WS_X11 +#ifdef Q_DEAD_CODE_FROM_QT4_X11 } else if (m_type == WidgetType) { m_painter->drawPixmap(m_surface_rect.topLeft(), m_surface_pixmap); m_surface_pixmap = QPixmap(); diff --git a/tests/auto/other/languagechange/tst_languagechange.cpp b/tests/auto/other/languagechange/tst_languagechange.cpp index 7b71231382..caf000a418 100644 --- a/tests/auto/other/languagechange/tst_languagechange.cpp +++ b/tests/auto/other/languagechange/tst_languagechange.cpp @@ -243,7 +243,7 @@ void tst_languageChange::retranslatability() QSKIP("The input data are not suitable for this layout (QDialogButtonBox::GnomeLayout)"); // This will always be queried for when a language changes - expected.insert("QCoreApplication::QT_LAYOUT_DIRECTION::Translate this string to the string 'LTR' in left-to-right " + expected.insert("QGuiApplication::QT_LAYOUT_DIRECTION::Translate this string to the string 'LTR' in left-to-right " "languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to " "get proper widget layout."); diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro index bd3997f8c9..c5673727be 100644 --- a/tests/auto/other/other.pro +++ b/tests/auto/other/other.pro @@ -24,6 +24,7 @@ SUBDIRS=\ qprocess_and_guieventloop \ qtokenautomaton \ windowsmobile \ + toolsupport \ !qtHaveModule(widgets): SUBDIRS -= \ baselineexample \ @@ -70,3 +71,6 @@ wince*|!contains(QT_CONFIG, accessibility): SUBDIRS -= qaccessibility winrt: SUBDIRS -= \ qprocess_and_guieventloop + +android: SUBDIRS += \ + android diff --git a/tests/auto/other/qaccessibility/qaccessibility.pro b/tests/auto/other/qaccessibility/qaccessibility.pro index 8d445437df..70cced1dac 100644 --- a/tests/auto/other/qaccessibility/qaccessibility.pro +++ b/tests/auto/other/qaccessibility/qaccessibility.pro @@ -5,7 +5,7 @@ QT += testlib core-private gui-private widgets-private SOURCES += tst_qaccessibility.cpp HEADERS += accessiblewidgets.h -unix:!mac:LIBS+=-lm +unix:!mac:!haiku:LIBS+=-lm wince*: { accessneeded.files = $$QT_BUILD_TREE\\plugins\\accessible\\*.dll diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index e59509a944..19462b5342 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -41,13 +41,7 @@ # include <servprov.h> # include <winuser.h> # ifdef QT_SUPPORTS_IACCESSIBLE2 -# include <Accessible2.h> -# include <AccessibleAction.h> -# include <AccessibleComponent.h> -# include <AccessibleEditableText.h> -# include <AccessibleText.h> -# include <AccessibleTable2.h> -# include <AccessibleTableCell.h> +# include <ia2_api_all.h> # endif #endif #include <QtTest/QtTest> diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm index a0dfe5446e..4c57e4d42a 100644 --- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm +++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm @@ -80,11 +80,13 @@ bool trusted() { AXUIElementRef reference; NSString *_role; + NSString *_title; NSString *_description; NSString *_value; CGRect _rect; } @property (readonly) NSString *role; + @property (readonly) NSString *title; @property (readonly) NSString *description; @property (readonly) NSString *value; @property (readonly) CGRect rect; @@ -93,6 +95,7 @@ bool trusted() @implementation TestAXObject @synthesize role = _role; + @synthesize title = _title; @synthesize description = _description; @synthesize value = _value; @synthesize rect = _rect; @@ -102,6 +105,7 @@ bool trusted() if ( self = [super init] ) { reference = ref; AXUIElementCopyAttributeValue(ref, kAXRoleAttribute, (CFTypeRef*)&_role); + AXUIElementCopyAttributeValue(ref, kAXTitleAttribute, (CFTypeRef*)&_title); AXUIElementCopyAttributeValue(ref, kAXDescriptionAttribute, (CFTypeRef*)&_description); AXUIElementCopyAttributeValue(ref, kAXValueAttribute, (CFTypeRef*)&_value); AXValueRef sizeValue; @@ -116,7 +120,7 @@ bool trusted() - (AXUIElementRef) ref { return reference; } - (void) print { - NSLog(@"Accessible Object role: '%@', description: '%@', value: '%@', rect: '%@'", self.role, self.description, self.value, NSStringFromRect(self.rect)); + NSLog(@"Accessible Object role: '%@', title: '%@', description: '%@', value: '%@', rect: '%@'", self.role, self.title, self.description, self.value, NSStringFromRect(self.rect)); NSLog(@" Children: %ld", [[self childList] count]); } @@ -282,7 +286,7 @@ bool testHierarchy(QWidget *w) TestAXObject *focusButton2 = [[TestAXObject alloc] initWithAXUIElementRef: focussedElement]; EXPECT([[focusButton2 role] isEqualToString: NSAccessibilityButtonRole]); - EXPECT([[focusButton2 description] isEqualToString: @"Button 2"]); + EXPECT([[focusButton2 title] isEqualToString: @"Button 2"]); button1->setFocus(); @@ -292,7 +296,7 @@ bool testHierarchy(QWidget *w) EXPECT(focussedElement); TestAXObject *focusButton1 = [[TestAXObject alloc] initWithAXUIElementRef: focussedElement]; EXPECT([[focusButton1 role] isEqualToString: NSAccessibilityButtonRole]); - EXPECT([[focusButton1 description] isEqualToString: @"I am a button"]); + EXPECT([[focusButton1 title] isEqualToString: @"I am a button"]); return true; } diff --git a/tests/auto/other/qprocess_and_guieventloop/write-read-write/main.cpp b/tests/auto/other/qprocess_and_guieventloop/write-read-write/main.cpp index bddffc2c6a..352968729e 100644 --- a/tests/auto/other/qprocess_and_guieventloop/write-read-write/main.cpp +++ b/tests/auto/other/qprocess_and_guieventloop/write-read-write/main.cpp @@ -33,7 +33,7 @@ #include <stdio.h> -int main(int argc, char **argv) +int main(int, char **argv) { const char *msg = argv[1]; char buf[2]; diff --git a/tests/auto/other/toolsupport/toolsupport.pro b/tests/auto/other/toolsupport/toolsupport.pro new file mode 100644 index 0000000000..274ead2c35 --- /dev/null +++ b/tests/auto/other/toolsupport/toolsupport.pro @@ -0,0 +1,4 @@ +CONFIG += testcase parallel_test +TARGET = tst_toolsupport +QT = testlib core-private +SOURCES = $$PWD/tst_toolsupport.cpp diff --git a/tests/auto/other/toolsupport/tst_toolsupport.cpp b/tests/auto/other/toolsupport/tst_toolsupport.cpp new file mode 100644 index 0000000000..0785033621 --- /dev/null +++ b/tests/auto/other/toolsupport/tst_toolsupport.cpp @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include <QtTest> + +// Don't do this at home. This is test code, not production. +#define protected public +#define private public + +#include <private/qdatetime_p.h> +#include <private/qfile_p.h> +#include <private/qfileinfo_p.h> +#include <private/qobject_p.h> +#include <qobject.h> + +#if defined(Q_CC_GNU) || defined(Q_CC_MSVC) +#define RUN_MEMBER_OFFSET_TEST 1 +#else +#define RUN_MEMBER_OFFSET_TEST 0 +#endif + +#if RUN_MEMBER_OFFSET_TEST +template <typename T, typename K> +size_t pmm_to_offsetof(T K:: *pmm) +{ +#ifdef Q_CC_MSVC + // Even on 64 bit MSVC uses 4 byte offsets. + quint32 ret; +#else + size_t ret; +#endif + Q_STATIC_ASSERT(sizeof(ret) == sizeof(pmm)); + memcpy(&ret, &pmm, sizeof(ret)); + return ret; +} +#endif + +class tst_toolsupport : public QObject +{ + Q_OBJECT + +private slots: + void offsets(); + void offsets_data(); +}; + +void tst_toolsupport::offsets() +{ + QFETCH(size_t, actual); + QFETCH(int, expected32); + QFETCH(int, expected64); + size_t expect = sizeof(void *) == 4 ? expected32 : expected64; + QCOMPARE(actual, expect); +} + +void tst_toolsupport::offsets_data() +{ + QTest::addColumn<size_t>("actual"); + QTest::addColumn<int>("expected32"); + QTest::addColumn<int>("expected64"); + + { + QTestData &data = QTest::newRow("sizeof(QObjectData)") + << sizeof(QObjectData); + data << 28 << 48; // vptr + 3 ptr + 2 int + ptr + } + +#if RUN_MEMBER_OFFSET_TEST + { + QTestData &data = QTest::newRow("QObjectPrivate::extraData") + << pmm_to_offsetof(&QObjectPrivate::extraData); + data << 28 << 48; // sizeof(QObjectData) + } + + { + QTestData &data = QTest::newRow("QFileInfoPrivate::fileEntry") + << pmm_to_offsetof(&QFileInfoPrivate::fileEntry); + data << 4 << 8; + } + + { + QTestData &data = QTest::newRow("QFileSystemEntry::filePath") + << pmm_to_offsetof(&QFileSystemEntry::m_filePath); + data << 0 << 0; + } + +#ifdef Q_OS_LINUX + if (sizeof(void *) == 8) { + QTestData &data = QTest::newRow("QFilePrivate::fileName") + << pmm_to_offsetof(&QFilePrivate::fileName); + data << -1 << 248; + } +#endif + + { +#ifdef Q_OS_WIN + QTest::newRow("QDateTimePrivate::m_msecs") + << pmm_to_offsetof(&QDateTimePrivate::m_msecs) << 8 << 8; + QTest::newRow("QDateTimePrivate::m_spec") + << pmm_to_offsetof(&QDateTimePrivate::m_spec) << 16 << 16; + QTest::newRow("QDateTimePrivate::m_offsetFromUtc") + << pmm_to_offsetof(&QDateTimePrivate::m_offsetFromUtc) << 20 << 20; + QTest::newRow("QDateTimePrivate::m_timeZone") + << pmm_to_offsetof(&QDateTimePrivate::m_timeZone) << 24 << 24; + QTest::newRow("QDateTimePrivate::m_status") + << pmm_to_offsetof(&QDateTimePrivate::m_status) << 28 << 32; +#else + QTest::newRow("QDateTimePrivate::m_msecs") + << pmm_to_offsetof(&QDateTimePrivate::m_msecs) << 4 << 8; + QTest::newRow("QDateTimePrivate::m_spec") + << pmm_to_offsetof(&QDateTimePrivate::m_spec) << 12 << 16; + QTest::newRow("QDateTimePrivate::m_offsetFromUtc") + << pmm_to_offsetof(&QDateTimePrivate::m_offsetFromUtc) << 16 << 20; + QTest::newRow("QDateTimePrivate::m_timeZone") + << pmm_to_offsetof(&QDateTimePrivate::m_timeZone) << 20 << 24; + QTest::newRow("QDateTimePrivate::m_status") + << pmm_to_offsetof(&QDateTimePrivate::m_status) << 24 << 32; +#endif + } +#endif // RUN_MEMBER_OFFSET_TEST +} + + +QTEST_APPLESS_MAIN(tst_toolsupport); + +#include "tst_toolsupport.moc" + |