diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-01-07 08:34:53 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-01-07 08:34:53 +0100 |
commit | 75391511ff75d6999822cda9f699da585f49ad37 (patch) | |
tree | 566dbd70ca624e733025a68612a95aaade463bba /tests | |
parent | fd9b0b86bb5f78ffa855409c4dd5976505ef83f5 (diff) | |
parent | 68c30e372b01561e8809fcfa5426ae896da70b8e (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ia2ce994c42adc010c453edaeea57f672556958f6
Diffstat (limited to 'tests')
16 files changed, 246 insertions, 99 deletions
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index ead5b685f2..9f022b3b14 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -277,6 +277,8 @@ private slots: void fromStdVariant(); void qt4UuidDataStream(); + void preferDirectConversionOverInterfaces(); + private: void dataStream_data(QDataStream::Version version); void loadQVariantFromDataStream(QDataStream::Version version); @@ -4716,5 +4718,47 @@ void tst_QVariant::qt4UuidDataStream() QCOMPARE(result.value<QUuid>(), source); } +void tst_QVariant::preferDirectConversionOverInterfaces() +{ + using namespace QtMetaTypePrivate; + bool calledCorrectConverter = false; + QMetaType::registerConverter<MyType, QSequentialIterableImpl>([](const MyType &) { + return QSequentialIterableImpl {}; + }); + QMetaType::registerConverter<MyType, QVariantList>([&calledCorrectConverter](const MyType &) { + calledCorrectConverter = true; + return QVariantList {}; + }); + QMetaType::registerConverter<MyType, QAssociativeIterableImpl>([](const MyType &) { + return QAssociativeIterableImpl {}; + }); + QMetaType::registerConverter<MyType, QVariantHash>([&calledCorrectConverter](const MyType &) { + calledCorrectConverter = true; + return QVariantHash {}; + }); + QMetaType::registerConverter<MyType, QVariantMap>([&calledCorrectConverter](const MyType &) { + calledCorrectConverter = true; + return QVariantMap {}; + }); + auto holder = QVariant::fromValue(MyType {}); + + QVERIFY(holder.canConvert<QSequentialIterableImpl>()); + QVERIFY(holder.canConvert<QVariantList>()); + QVERIFY(holder.canConvert<QAssociativeIterableImpl>()); + QVERIFY(holder.canConvert<QVariantHash>()); + QVERIFY(holder.canConvert<QVariantMap>()); + + holder.value<QVariantList>(); + QVERIFY(calledCorrectConverter); + calledCorrectConverter = false; + + holder.value<QVariantHash>(); + QVERIFY(calledCorrectConverter); + calledCorrectConverter = false; + + holder.value<QVariantMap>(); + QVERIFY(calledCorrectConverter); +} + QTEST_MAIN(tst_QVariant) #include "tst_qvariant.moc" diff --git a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp index 92a0d8bbfa..12279133a2 100644 --- a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp @@ -221,7 +221,7 @@ static QString documentElement(const QByteArray &document) * * See \l {http://www.w3.org/XML/Test/} {Extensible Markup Language (XML) Conformance Test Suites} */ -class TestSuiteHandler : public QXmlDefaultHandler +class TestSuiteHandler { public: /** @@ -286,29 +286,33 @@ public: m_baseURI.push(baseURI); } - virtual bool characters(const QString &chars) + bool runTests(QFile *file) { - m_ch = chars; - return true; + QXmlStreamReader reader(file); + while (!reader.atEnd() && !reader.hasError()) { + reader.readNext(); + + if (reader.isStartElement() && !startElement(reader.attributes())) + return false; + + if (reader.isEndElement() && !endElement(reader.name().toString())) + return false; + } + return !reader.hasError(); } - virtual bool startElement(const QString &, - const QString &, - const QString &, - const QXmlAttributes &atts) + bool startElement(const QXmlStreamAttributes &atts) { m_atts.push(atts); - const int i = atts.index(QLatin1String("xml:base")); - if(i != -1) - m_baseURI.push(m_baseURI.top().resolved(atts.value(i))); + const auto attr = atts.value(QLatin1String("xml:base")); + if (!attr.isEmpty()) + m_baseURI.push(m_baseURI.top().resolved(attr.toString())); return true; } - virtual bool endElement(const QString &, - const QString &localName, - const QString &) + bool endElement(const QString &localName) { if(localName == QLatin1String("TEST")) { @@ -329,19 +333,19 @@ public: return true; } - const QString inputFilePath(m_baseURI.top().resolved(m_atts.top().value(QString(), QLatin1String("URI"))) - .toLocalFile()); - const QString id(m_atts.top().value(QString(), QLatin1String("ID"))); - const QString type(m_atts.top().value(QString(), QLatin1String("TYPE"))); + const QString inputFilePath( + m_baseURI.top() + .resolved( + m_atts.top().value(QString(), QLatin1String("URI")).toString()) + .toLocalFile()); + const QString id(m_atts.top().value(QString(), QLatin1String("ID")).toString()); + const QString type(m_atts.top().value(QString(), QLatin1String("TYPE")).toString()); QString expectedFilePath; - const int index = m_atts.top().index(QString(), QLatin1String("OUTPUT")); - if(index != -1) - { - expectedFilePath = m_baseURI.top().resolved(m_atts.top().value(QString(), - QLatin1String("OUTPUT"))).toLocalFile(); - } + const auto attr = m_atts.top().value(QString(), QLatin1String("OUTPUT")); + if (!attr.isEmpty()) + expectedFilePath = m_baseURI.top().resolved(attr.toString()).toLocalFile(); /* testcases.dtd: 'No parser should accept a "not-wf" testcase * unless it's a nonvalidating parser and the test contains @@ -349,7 +353,7 @@ public: * * We also let this apply to "valid", "invalid" and "error" tests, although * I'm not fully sure this is correct. */ - const QString ents(m_atts.top().value(QString(), QLatin1String("ENTITIES"))); + const QString ents(m_atts.top().value(QString(), QLatin1String("ENTITIES")).toString()); m_atts.pop(); if(ents == QLatin1String("both") || @@ -455,8 +459,8 @@ public: qFatal("The input catalog is invalid."); return false; } - } - else if(localName == QLatin1String("TESTCASES") && m_atts.top().index(QLatin1String("xml:base")) != -1) + } else if (localName == QLatin1String("TESTCASES") + && m_atts.top().hasAttribute(QLatin1String("xml:base"))) m_baseURI.pop(); m_atts.pop(); @@ -516,9 +520,8 @@ public: } private: - QStack<QXmlAttributes> m_atts; - QString m_ch; - QStack<QUrl> m_baseURI; + QStack<QXmlStreamAttributes> m_atts; + QStack<QUrl> m_baseURI; }; QT_BEGIN_NAMESPACE Q_DECLARE_SHARED(TestSuiteHandler::MissedBaseline) @@ -592,11 +595,7 @@ void tst_QXmlStream::initTestCase() QVERIFY2(file.open(QIODevice::ReadOnly), qPrintable(QString::fromLatin1("Failed to open the test suite catalog; %1").arg(file.fileName()))); - QXmlInputSource source(&file); - QXmlSimpleReader reader; - reader.setContentHandler(&m_handler); - - QVERIFY(reader.parse(&source, false)); + QVERIFY(m_handler.runTests(&file)); } void tst_QXmlStream::cleanupTestCase() diff --git a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp index 6f88b7fab5..191260fd41 100644 --- a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp +++ b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp @@ -381,56 +381,6 @@ void tst_QRhi::nativeHandles() } } - // QRhiTexture::nativeHandles() - { - QScopedPointer<QRhiTexture> tex(rhi->newTexture(QRhiTexture::RGBA8, QSize(512, 256))); - QVERIFY(tex->build()); - - const QRhiNativeHandles *texHandles = tex->nativeHandles(); - QVERIFY(texHandles); - - switch (impl) { - case QRhi::Null: - break; -#ifdef TST_VK - case QRhi::Vulkan: - { - const QRhiVulkanTextureNativeHandles *vkHandles = static_cast<const QRhiVulkanTextureNativeHandles *>(texHandles); - QVERIFY(vkHandles->image); - QVERIFY(vkHandles->layout >= 1); // VK_IMAGE_LAYOUT_GENERAL - QVERIFY(vkHandles->layout <= 8); // VK_IMAGE_LAYOUT_PREINITIALIZED - } - break; -#endif -#ifdef TST_GL - case QRhi::OpenGLES2: - { - const QRhiGles2TextureNativeHandles *glHandles = static_cast<const QRhiGles2TextureNativeHandles *>(texHandles); - QVERIFY(glHandles->texture); - } - break; -#endif -#ifdef TST_D3D11 - case QRhi::D3D11: - { - const QRhiD3D11TextureNativeHandles *d3dHandles = static_cast<const QRhiD3D11TextureNativeHandles *>(texHandles); - QVERIFY(d3dHandles->texture); - } - break; -#endif -#ifdef TST_MTL - case QRhi::Metal: - { - const QRhiMetalTextureNativeHandles *mtlHandles = static_cast<const QRhiMetalTextureNativeHandles *>(texHandles); - QVERIFY(mtlHandles->texture); - } - break; -#endif - default: - Q_ASSERT(false); - } - } - // QRhiCommandBuffer::nativeHandles() { QRhiCommandBuffer *cb = nullptr; diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp index 3917c859cc..6eae6db12a 100644 --- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp @@ -194,6 +194,8 @@ private slots: void fontTagFace(); void clearUndoRedoStacks(); + void mergeFontFamilies(); + private: void backgroundImage_checkExpectedHtml(const QTextDocument &doc); void buildRegExpData(); @@ -3585,6 +3587,25 @@ void tst_QTextDocument::fontTagFace() } } +void tst_QTextDocument::mergeFontFamilies() +{ + QTextDocument td; + td.setHtml(QLatin1String( + "<html><body>" + "<span style=\" font-family:'MS Shell Dlg 2';\">Hello world</span>" + "</body></html>")); + + QTextCharFormat newFormat; + newFormat.setFontFamily(QLatin1String("Jokerman")); + + QTextCursor cursor = QTextCursor(&td); + cursor.setPosition(0); + cursor.setPosition(QByteArray("Hello World").length(), QTextCursor::KeepAnchor); + cursor.mergeCharFormat(newFormat); + + QVERIFY(td.toHtml().contains(QLatin1String("font-family:'Jokerman','MS Shell Dlg 2';"))); +} + void tst_QTextDocument::clearUndoRedoStacks() { QTextDocument doc; diff --git a/tests/auto/xml/dom/qdom/tst_qdom.cpp b/tests/auto/xml/dom/qdom/tst_qdom.cpp index afab31b382..9cb06f5185 100644 --- a/tests/auto/xml/dom/qdom/tst_qdom.cpp +++ b/tests/auto/xml/dom/qdom/tst_qdom.cpp @@ -173,7 +173,7 @@ void tst_QDom::setContent_data() " </b3>\n" "</a1>\n"); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15) // These configurations cannot be supported by the QXmlStreamReader-based implementation QTest::newRow( "02" ) << doc01 << QString("http://trolltech.com/xml/features/report-whitespace-only-CharData").split(' ') @@ -246,7 +246,9 @@ void tst_QDom::setContent() QFETCH( QString, doc ); QDomDocument domDoc; -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED QXmlInputSource source; source.setData( doc ); @@ -264,6 +266,7 @@ void tst_QDom::setContent() } QVERIFY( domDoc.setContent( &source, &reader ) ); +QT_WARNING_POP #else QXmlStreamReader reader(doc); QVERIFY(domDoc.setContent(&reader, true)); @@ -1483,7 +1486,7 @@ void tst_QDom::normalizeAttributes() const QDomDocument doc; QVERIFY(doc.setContent(&buffer, true)); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15) QEXPECT_FAIL("", "The parser doesn't perform Attribute Value Normalization. Fixing that would change behavior.", Continue); #endif QCOMPARE(doc.documentElement().attribute(QLatin1String("attribute")), QString::fromLatin1("a a")); @@ -1528,7 +1531,10 @@ void tst_QDom::serializeNamespaces() const QDomDocument doc; QByteArray ba(input); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED + QBuffer buffer(&ba); QVERIFY(buffer.open(QIODevice::ReadOnly)); @@ -1538,6 +1544,7 @@ void tst_QDom::serializeNamespaces() const reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false); QVERIFY(doc.setContent(&source, &reader)); +QT_WARNING_POP #else QXmlStreamReader streamReader(input); QVERIFY(doc.setContent(&streamReader, true)); @@ -1565,7 +1572,7 @@ void tst_QDom::flagInvalidNamespaces() const QDomDocument doc; QVERIFY(!doc.setContent(QString::fromLatin1(input, true))); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15) QEXPECT_FAIL("", "The parser doesn't flag identical qualified attribute names. Fixing this would change behavior.", Continue); #endif QVERIFY(!doc.setContent(QString::fromLatin1(input))); @@ -1580,7 +1587,9 @@ void tst_QDom::flagUndeclaredNamespace() const QDomDocument doc; QByteArray ba(input); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED QBuffer buffer(&ba); QVERIFY(buffer.open(QIODevice::ReadOnly)); @@ -1592,6 +1601,7 @@ void tst_QDom::flagUndeclaredNamespace() const QEXPECT_FAIL("", "The parser doesn't flag not declared prefixes. Fixing this would change behavior.", Continue); QVERIFY(!doc.setContent(&source, &reader)); +QT_WARNING_POP #else QXmlStreamReader streamReader(ba); QVERIFY(!doc.setContent(&streamReader, true)); @@ -1662,7 +1672,7 @@ void tst_QDom::reportDuplicateAttributes() const QDomDocument dd; bool isSuccess = dd.setContent(QLatin1String("<test x=\"1\" x=\"2\"/>")); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15) QEXPECT_FAIL("", "The parser doesn't flag duplicate attributes. Fixing this would change behavior.", Continue); #endif QVERIFY2(!isSuccess, "Duplicate attributes are well-formedness errors, and should be reported as such."); @@ -1864,11 +1874,14 @@ void tst_QDom::doubleNamespaceDeclarations() const QFile file(testFile); QVERIFY(file.open(QIODevice::ReadOnly)); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED QXmlSimpleReader reader; QXmlInputSource source(&file); QVERIFY(doc.setContent(&source, &reader)); +QT_WARNING_POP #else QXmlStreamReader streamReader(&file); QVERIFY(doc.setContent(&streamReader, true)); @@ -1889,11 +1902,14 @@ void tst_QDom::setContentQXmlReaderOverload() const { QDomDocument doc; -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED QXmlSimpleReader reader; QXmlInputSource data; data.setData(QByteArray("<e/>")); doc.setContent(&data, true); +QT_WARNING_POP #else QXmlStreamReader streamReader(QByteArray("<e/>")); doc.setContent(&streamReader, true); @@ -1995,7 +2011,7 @@ void tst_QDom::taskQTBUG4595_dontAssertWhenDocumentSpecifiesUnknownEncoding() co // QXmlStreamReader fails to read XML documents with unknown encoding. It // needs to be modified if we want to support this case with the QXmlStreamReader-based // implementation. -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15) QString xmlWithUnknownEncoding("<?xml version='1.0' encoding='unknown-encoding'?>" "<foo>" " <bar>How will this sentence be handled?</bar>" diff --git a/tests/auto/xml/sax/qxml/tst_qxml.cpp b/tests/auto/xml/sax/qxml/tst_qxml.cpp index 1cdb9701fa..db6584edda 100644 --- a/tests/auto/xml/sax/qxml/tst_qxml.cpp +++ b/tests/auto/xml/sax/qxml/tst_qxml.cpp @@ -26,7 +26,6 @@ ** ****************************************************************************/ - #include <QtTest/QtTest> #include <qcoreapplication.h> @@ -38,13 +37,17 @@ class tst_QXml : public QObject Q_OBJECT private slots: +#if QT_DEPRECATED_SINCE(5, 15) void getSetCheck(); void interpretedAs0D() const; #ifndef QT_NO_EXCEPTIONS void exception(); #endif +#endif // QT_DEPRECATED_SINCE(5, 15) }; +#if QT_DEPRECATED_SINCE(5, 15) + class MyXmlEntityResolver : public QXmlEntityResolver { public: @@ -225,5 +228,7 @@ void tst_QXml::exception() } #endif +#endif // QT_DEPRECATED_SINCE(5, 15) + QTEST_MAIN(tst_QXml) #include "tst_qxml.moc" diff --git a/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp b/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp index d40c8c2fd6..afdcc825d8 100644 --- a/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp +++ b/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp @@ -45,13 +45,18 @@ class tst_QXmlInputSource : public QObject { Q_OBJECT +#if QT_DEPRECATED_SINCE(5, 15) private slots: void reset() const; void resetSimplified() const; void waitForReadyIODevice() const; void inputFromSlowDevice() const; +#endif // QT_DEPRECATED_SINCE(5, 15) }; +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED /*! \internal \since 4.4 @@ -292,5 +297,8 @@ void tst_QXmlInputSource::inputFromSlowDevice() const QCOMPARE(data, expectedData); } +QT_WARNING_POP +#endif // QT_DEPRECATED_SINCE(5, 15) + QTEST_MAIN(tst_QXmlInputSource) #include "tst_qxmlinputsource.moc" diff --git a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp index 556603a681..44f8101955 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp +++ b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp @@ -26,12 +26,15 @@ ** ****************************************************************************/ +#include "parser.h" + +#if QT_DEPRECATED_SINCE(5, 15) #include <qxml.h> #include <qregularexpression.h> -#include "parser.h" - +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED class ContentHandler : public QXmlDefaultHandler { public: @@ -440,3 +443,6 @@ QString Parser::errorMsg() const { return handler->errorMsg(); } + +QT_WARNING_POP +#endif // QT_DEPRECATED_SINCE(5, 15) diff --git a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h index 604678f06b..9c51cdf095 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h +++ b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h @@ -28,6 +28,10 @@ #ifndef PARSER_H #define PARSER_H +#include <qglobal.h> + +#if QT_DEPRECATED_SINCE(5, 15) + #include <qfile.h> #include <qstring.h> #include <qxml.h> @@ -48,4 +52,6 @@ private: ContentHandler *handler; }; +#endif // QT_DEPRECATED_SINCE(5, 15) + #endif diff --git a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp index 8c4c6c7179..cea4e3c8b8 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp +++ b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp @@ -127,6 +127,7 @@ class tst_QXmlSimpleReader : public QObject { Q_OBJECT +#if QT_DEPRECATED_SINCE(5, 15) public: tst_QXmlSimpleReader(); ~tst_QXmlSimpleReader(); @@ -157,8 +158,13 @@ class tst_QXmlSimpleReader : public QObject static QDomDocument fromByteArray(const QString &title, const QByteArray &ba, bool *ok); XmlServer *server; QString prefix; +#endif // QT_DEPRECATED_SINCE(5, 15) }; +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED + tst_QXmlSimpleReader::tst_QXmlSimpleReader() : server(new XmlServer(this)) { server->start(); @@ -820,5 +826,8 @@ void tst_QXmlSimpleReader::dtdRecursionLimit() } } +QT_WARNING_POP +#endif // QT_DEPRECATED_SINCE(5, 15) + QTEST_MAIN(tst_QXmlSimpleReader) #include "tst_qxmlsimplereader.moc" diff --git a/tests/manual/widgets/widgets/qtabbar/qtabbar.pro b/tests/manual/widgets/widgets/qtabbar/qtabbar.pro new file mode 100644 index 0000000000..b39c81493b --- /dev/null +++ b/tests/manual/widgets/widgets/qtabbar/qtabbar.pro @@ -0,0 +1 @@ +SUBDIRS = stylesheet diff --git a/tests/manual/widgets/widgets/qtabbar/stylesheet/main.cpp b/tests/manual/widgets/widgets/qtabbar/stylesheet/main.cpp new file mode 100644 index 0000000000..02393f66f9 --- /dev/null +++ b/tests/manual/widgets/widgets/qtabbar/stylesheet/main.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** + ** + ** Copyright (C) 2020 The Qt Company Ltd. + ** Contact: https://www.qt.io/licensing/ + ** + ** This file is part of the test suite of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:BSD$ + ** 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 The Qt Company. For licensing terms + ** and conditions see https://www.qt.io/terms-conditions. For further + ** information use the contact form at https://www.qt.io/contact-us. + ** + ** BSD License Usage + ** Alternatively, you may use this file under the terms of the BSD license + ** as follows: + ** + ** "Redistribution and use in source and binary forms, with or without + ** modification, are permitted provided that the following conditions are + ** met: + ** * Redistributions of source code must retain the above copyright + ** notice, this list of conditions and the following disclaimer. + ** * Redistributions in binary form must reproduce the above copyright + ** notice, this list of conditions and the following disclaimer in + ** the documentation and/or other materials provided with the + ** distribution. + ** * Neither the name of The Qt Company Ltd nor the names of its + ** contributors may be used to endorse or promote products derived + ** from this software without specific prior written permission. + ** + ** + ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +// This test is for checking that when there is padding set on the stylesheet and the elide mode is +// set that it is correctly shown as elided and not clipped. + +#include <QApplication> +#include <QTabBar> +#include <QIcon> + +int main(int argc, char** argv) +{ + QApplication app(argc, argv); + app.setStyleSheet("QTabBar::tab { padding-left: 20px; }\n"); + QIcon icon(":/v.ico"); + + QTabBar b; + b.setElideMode(Qt::ElideRight); + b.addTab(icon, "some text"); + b.resize(80,32); + b.show(); + + return app.exec(); +} diff --git a/tests/manual/widgets/widgets/qtabbar/stylesheet/res.qrc b/tests/manual/widgets/widgets/qtabbar/stylesheet/res.qrc new file mode 100644 index 0000000000..9d0bb8e061 --- /dev/null +++ b/tests/manual/widgets/widgets/qtabbar/stylesheet/res.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>v.ico</file> + </qresource> +</RCC> diff --git a/tests/manual/widgets/widgets/qtabbar/stylesheet/stylesheet.pro b/tests/manual/widgets/widgets/qtabbar/stylesheet/stylesheet.pro new file mode 100644 index 0000000000..4957503abc --- /dev/null +++ b/tests/manual/widgets/widgets/qtabbar/stylesheet/stylesheet.pro @@ -0,0 +1,5 @@ +QT += widgets +TEMPLATE = app +TARGET = stylesheet +RESOURCES += res.qrc +SOURCES += main.cpp diff --git a/tests/manual/widgets/widgets/qtabbar/stylesheet/v.ico b/tests/manual/widgets/widgets/qtabbar/stylesheet/v.ico Binary files differnew file mode 100644 index 0000000000..90dfbc9f9b --- /dev/null +++ b/tests/manual/widgets/widgets/qtabbar/stylesheet/v.ico diff --git a/tests/manual/widgets/widgets/widgets.pro b/tests/manual/widgets/widgets/widgets.pro index 1fccb09d79..5a07e621e8 100644 --- a/tests/manual/widgets/widgets/widgets.pro +++ b/tests/manual/widgets/widgets/widgets.pro @@ -2,4 +2,5 @@ TEMPLATE = subdirs SUBDIRS = bigmenucreator \ defaultUpMenuBar \ multiscreen-menus \ - qtoolbutton/menuOnMultiScreens + qtoolbutton/menuOnMultiScreens \ + qtabbar |