summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-05-02 07:03:53 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2016-05-02 07:03:53 +0000
commit46798611057285b31c6a134e3f4461ac6aad03c5 (patch)
treea441d501f19d57f42b1dec6602acd0cee2bc0139 /tests
parent6cbcff49716e8632fa5d41f68fc11e9ebaf1d3c6 (diff)
parentb894a8def5d9107663e4968d2d395f5ef3059125 (diff)
Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/tools/qtimezone/BLACKLIST2
-rw-r--r--tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp18
-rw-r--r--tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp21
-rw-r--r--tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h1
-rw-r--r--tests/auto/other/compiler/tst_compiler.cpp90
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp22
-rw-r--r--tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp51
-rw-r--r--tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp1
-rw-r--r--tests/manual/manual.pro1
-rw-r--r--tests/manual/qtabletevent/device_information/tabletwidget.cpp8
-rw-r--r--tests/manual/qtabletevent/device_information/tabletwidget.h1
-rw-r--r--tests/manual/qtbug-52641/main.cpp87
-rw-r--r--tests/manual/qtbug-52641/qtbug-52641.pro5
13 files changed, 287 insertions, 21 deletions
diff --git a/tests/auto/corelib/tools/qtimezone/BLACKLIST b/tests/auto/corelib/tools/qtimezone/BLACKLIST
deleted file mode 100644
index 665e78bc08..0000000000
--- a/tests/auto/corelib/tools/qtimezone/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[tzTest]
-opensuse-13.1
diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
index 077a6a20f1..9fd418742c 100644
--- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
+++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
@@ -762,16 +762,22 @@ void tst_QTimeZone::tzTest()
// Warning: This could vary depending on age of TZ file!
// Test low date uses first rule found
+ // Note: Depending on the OS in question, the database may be carrying the
+ // Local Mean Time. which for Berlin is 0:53:28
QTimeZonePrivate::Data dat = tzp.data(-9999999999999);
QCOMPARE(dat.atMSecsSinceEpoch, (qint64)-9999999999999);
- QCOMPARE(dat.standardTimeOffset, 3600);
QCOMPARE(dat.daylightTimeOffset, 0);
+ if (dat.abbreviation == "LMT") {
+ QCOMPARE(dat.standardTimeOffset, 3208);
+ } else {
+ QCOMPARE(dat.standardTimeOffset, 3600);
- // Test previous to low value is invalid
- dat = tzp.previousTransition(-9999999999999);
- QCOMPARE(dat.atMSecsSinceEpoch, std::numeric_limits<qint64>::min());
- QCOMPARE(dat.standardTimeOffset, std::numeric_limits<int>::min());
- QCOMPARE(dat.daylightTimeOffset, std::numeric_limits<int>::min());
+ // Test previous to low value is invalid
+ dat = tzp.previousTransition(-9999999999999);
+ QCOMPARE(dat.atMSecsSinceEpoch, std::numeric_limits<qint64>::min());
+ QCOMPARE(dat.standardTimeOffset, std::numeric_limits<int>::min());
+ QCOMPARE(dat.daylightTimeOffset, std::numeric_limits<int>::min());
+ }
dat = tzp.nextTransition(-9999999999999);
QCOMPARE(dat.atMSecsSinceEpoch, (qint64)-2422054408000);
diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
index 3418a34c12..0163f44a36 100644
--- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
+++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
@@ -1213,6 +1213,27 @@ void tst_QDBusConnection::callVirtualObjectLocal()
QCOMPARE(obj.replyArguments, subPathReply.arguments());
}
+void tst_QDBusConnection::pendingCallWhenDisconnected()
+{
+ if (!QCoreApplication::instance())
+ QSKIP("Test requires a QCoreApplication");
+
+ QDBusServer *server = new QDBusServer;
+ QDBusConnection con = QDBusConnection::connectToPeer(server->address(), "disconnect");
+ QTestEventLoop::instance().enterLoop(2);
+ QVERIFY(con.isConnected());
+ QDBusMessage message = QDBusMessage::createMethodCall("", "/", QString(), "method");
+ QDBusPendingCall reply = con.asyncCall(message);
+
+ delete server;
+
+ QTestEventLoop::instance().enterLoop(2);
+ QVERIFY(!con.isConnected());
+ QVERIFY(reply.isFinished());
+ QVERIFY(reply.isError());
+ QVERIFY(reply.error().type() == QDBusError::Disconnected);
+}
+
QString MyObject::path;
QString MyObjectWithoutInterface::path;
QString MyObjectWithoutInterface::interface;
diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h
index 0e2943b1c4..0402889c6e 100644
--- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h
+++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h
@@ -116,6 +116,7 @@ private slots:
void registerVirtualObject();
void callVirtualObject();
void callVirtualObjectLocal();
+ void pendingCallWhenDisconnected();
public:
QString serviceName() const { return "org.qtproject.Qt.Autotests.QDBusConnection"; }
diff --git a/tests/auto/other/compiler/tst_compiler.cpp b/tests/auto/other/compiler/tst_compiler.cpp
index d554a50c8d..50cfe48cdf 100644
--- a/tests/auto/other/compiler/tst_compiler.cpp
+++ b/tests/auto/other/compiler/tst_compiler.cpp
@@ -679,25 +679,105 @@ void tst_Compiler::cxx11_atomics()
#endif
}
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_CLANG("-Wignored-attributes")
+QT_WARNING_DISABLE_CLANG("-Wunused-local-typedefs")
+QT_WARNING_DISABLE_GCC("-Wattributes")
+QT_WARNING_DISABLE_GCC("-Wunused-local-typedefs")
+
+#ifndef __has_cpp_attribute
+# define __has_cpp_attribute(x) 0
+#endif
+#ifdef Q_COMPILER_ATTRIBUTES
+[[noreturn]] void attribute_f1();
+void attribute_f2 [[noreturn]] ();
+# if (defined(__cpp_namespace_attributes) && __cpp_namespace_attributes >= 201411) && __has_cpp_attribute(deprecated)
+namespace NS [[deprecated]] { }
+# endif
+#endif
+
void tst_Compiler::cxx11_attributes()
{
#ifndef Q_COMPILER_ATTRIBUTES
QSKIP("Compiler does not support C++11 feature");
#else
- struct [[deprecated]] C {};
+ // Attributes in function parameters and using clauses cause MSVC 2015 to crash
+ // https://connect.microsoft.com/VisualStudio/feedback/details/2011594
+# if (!defined(Q_CC_MSVC) || _MSC_FULL_VER >= 190023811) && !defined(Q_CC_INTEL)
+ void f([[ ]] int);
+ [[ ]] using namespace QtPrivate;
+ [[ ]] try {
+ } catch ([[]] int) {
+ }
+# endif
+
+ struct [[ ]] A { };
+ struct B : A {
+ [[ ]] int m_i : 32;
+ [[noreturn]] void f() const { ::exit(0); }
+
+# ifdef Q_COMPILER_DEFAULT_DELETE_MEMBERS
+ [[ ]] ~B() = default;
+ [[ ]] B(const B &) = delete;
+# endif
+ };
+# if __has_cpp_attribute(deprecated)
+ struct [[deprecated]] C { };
+# endif
+ enum [[ ]] E { };
+ [[ ]] void [[ ]] * [[ ]] * [[ ]] ptr = 0;
+ int B::* [[ ]] pmm = 0;
+
+# if __has_cpp_attribute(deprecated)
+ enum [[deprecated]] E2 {
+# if defined(__cpp_enumerator_attributes) && __cpp_enumerator_attributes >= 201411
+ value [[deprecated]] = 0
+# endif
+ };
+# endif
+# ifdef Q_COMPILER_LAMBDA
+ []()[[ ]] {}();
+# endif
+# ifdef Q_COMPILER_TEMPLATE_ALIAS
+ using B2 [[ ]] = B;
+# endif
+
+ [[ ]] goto end;
+# ifdef Q_CC_GNU
+ // Attributes in gnu:: namespace
+ [[gnu::unused]] end:
+ ;
[[gnu::unused]] struct D {} d;
- [[noreturn]] void f();
struct D e [[gnu::used, gnu::unused]];
- [[gnu::aligned(8)]] int i;
+ [[gnu::aligned(8)]] int i [[ ]];
+ int array[][[]] = { 1 };
+# else
+ // Non GNU, so use an empty attribute
+ [[ ]] end:
+ ;
+ [[ ]] struct D {} d;
+ struct D e [[ ]];
+ [[ ]] int i [[ ]];
+ int array[][[]] = { 1 };
+# endif
-[[gnu::unused]] end:
- ;
+ int & [[ ]] lref = i;
+ int && [[ ]] rref = 1;
+ [[ ]] (void)1;
+ [[ ]] for (i = 0; i < 2; ++i)
+ ;
+ Q_UNUSED(ptr);
+ Q_UNUSED(pmm);
Q_UNUSED(d);
Q_UNUSED(e);
Q_UNUSED(i);
+ Q_UNUSED(array);
+ Q_UNUSED(lref);
+ Q_UNUSED(rref);
#endif
}
+QT_WARNING_POP
#ifdef Q_COMPILER_AUTO_FUNCTION
auto autoFunction() -> unsigned
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 3183fc7375..f0e7cb5901 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -465,6 +465,7 @@ private:
const QString m_platform;
QSize m_testWidgetSize;
QPoint m_availableTopLeft;
+ QPoint m_safeCursorPos;
const bool m_windowsAnimationsEnabled;
};
@@ -622,6 +623,7 @@ void tst_QWidget::getSetCheck()
tst_QWidget::tst_QWidget()
: m_platform(QGuiApplication::platformName().toLower())
+ , m_safeCursorPos(0, 0)
, m_windowsAnimationsEnabled(windowsAnimationsEnabled())
{
if (m_windowsAnimationsEnabled) // Disable animations which can interfere with screen grabbing in moveChild(), showAndMoveChild()
@@ -664,7 +666,13 @@ void tst_QWidget::initTestCase()
// to avoid Windows warnings about minimum size for decorated windows.
int width = 200;
const QScreen *screen = QGuiApplication::primaryScreen();
- m_availableTopLeft = screen->availableGeometry().topLeft();
+ const QRect availableGeometry = screen->availableGeometry();
+ m_availableTopLeft = availableGeometry.topLeft();
+ // XCB: Determine "safe" cursor position at bottom/right corner of screen.
+ // Pushing the mouse rapidly to the top left corner can trigger KDE / KWin's
+ // "Present all Windows" (Ctrl+F9) feature also programmatically.
+ if (m_platform == QLatin1String("xcb"))
+ m_safeCursorPos = availableGeometry.bottomRight() - QPoint(40, 40);
const int screenWidth = screen->geometry().width();
if (screenWidth > 2000)
width = 100 * ((screenWidth + 500) / 1000);
@@ -5664,7 +5672,7 @@ void tst_QWidget::setToolTip()
// Mouse over doesn't work on Windows mobile, so skip the rest of the test for that platform.
#ifndef Q_OS_WINCE_WM
for (int pass = 0; pass < 2; ++pass) {
- QCursor::setPos(0, 0);
+ QCursor::setPos(m_safeCursorPos);
QScopedPointer<QWidget> popup(new QWidget(0, Qt::Popup));
popup->setObjectName(QLatin1String("tst_qwidget setToolTip #") + QString::number(pass));
popup->setWindowTitle(popup->objectName());
@@ -6015,7 +6023,7 @@ void tst_QWidget::childEvents()
// Move away the cursor; otherwise it might result in an enter event if it's
// inside the widget when the widget is shown.
- QCursor::setPos(qApp->desktop()->availableGeometry().bottomRight());
+ QCursor::setPos(m_safeCursorPos);
QTest::qWait(100);
{
@@ -8878,7 +8886,7 @@ void tst_QWidget::syntheticEnterLeave()
int numLeaveEvents;
};
- QCursor::setPos(QPoint(0,0));
+ QCursor::setPos(m_safeCursorPos);
MyWidget window;
window.setWindowFlags(Qt::WindowStaysOnTopHint);
@@ -8998,7 +9006,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave()
int numEnterEvents, numMouseMoveEvents;
};
- QCursor::setPos(QPoint(0,0));
+ QCursor::setPos(m_safeCursorPos);
SELParent parent;
parent.move(200, 200);
@@ -10174,7 +10182,7 @@ void tst_QWidget::destroyedSignal()
void tst_QWidget::underMouse()
{
// Move the mouse cursor to a safe location
- QCursor::setPos(0,0);
+ QCursor::setPos(m_safeCursorPos);
ColorWidget topLevelWidget(0, Qt::FramelessWindowHint, Qt::blue);
ColorWidget childWidget1(&topLevelWidget, Qt::Widget, Qt::yellow);
@@ -10430,7 +10438,7 @@ public:
void tst_QWidget::taskQTBUG_27643_enterEvents()
{
// Move the mouse cursor to a safe location so it won't interfere
- QCursor::setPos(0,0);
+ QCursor::setPos(m_safeCursorPos);
EnterTestMainDialog dialog;
QPushButton button(&dialog);
diff --git a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp
index d4b221a4a7..e68463a00e 100644
--- a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp
+++ b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp
@@ -77,6 +77,8 @@ private slots:
#ifndef QT_NO_WHEELEVENT
void wheelEvent_data();
void wheelEvent();
+ void fineGrainedWheelEvent_data();
+ void fineGrainedWheelEvent();
#endif
void sliderPressedReleased_data();
void sliderPressedReleased();
@@ -892,6 +894,55 @@ void tst_QAbstractSlider::wheelEvent()
if (expectedSignalCount)
QVERIFY(actionTriggeredTimeStamp < valueChangedTimeStamp);
}
+
+void tst_QAbstractSlider::fineGrainedWheelEvent_data()
+{
+ QTest::addColumn<bool>("invertedControls");
+ QTest::newRow("invertedControls=false") << false;
+ QTest::newRow("invertedControls=true") << true;
+}
+
+void tst_QAbstractSlider::fineGrainedWheelEvent()
+{
+ QFETCH(bool, invertedControls);
+
+ QCoreApplication *applicationInstance = QCoreApplication::instance();
+ QVERIFY(applicationInstance != 0);
+ QApplication::setWheelScrollLines(3);
+
+ slider->setRange(0, 10);
+ slider->setSingleStep(1);
+ slider->setPageStep(10);
+ slider->setInvertedControls(invertedControls);
+ slider->setOrientation(Qt::Vertical);
+ slider->setSliderPosition(0);
+
+ const int singleStepDelta = invertedControls ? (-WHEEL_DELTA / 3) : (WHEEL_DELTA / 3);
+
+ QWheelEvent eventDown(slider->rect().bottomRight(), singleStepDelta / 2,
+ Qt::NoButton, Qt::NoModifier, Qt::Vertical);
+ QVERIFY(applicationInstance->sendEvent(slider,&eventDown));
+ QCOMPARE(slider->sliderPosition(), 0);
+ QVERIFY(applicationInstance->sendEvent(slider,&eventDown));
+ QCOMPARE(slider->sliderPosition(), 1);
+
+ QWheelEvent eventUp(slider->rect().bottomRight(), -singleStepDelta / 2,
+ Qt::NoButton, Qt::NoModifier, Qt::Vertical);
+ QVERIFY(applicationInstance->sendEvent(slider,&eventUp));
+ QCOMPARE(slider->sliderPosition(), 1);
+ QVERIFY(applicationInstance->sendEvent(slider,&eventUp));
+ QCOMPARE(slider->sliderPosition(), 0);
+ QVERIFY(applicationInstance->sendEvent(slider,&eventUp));
+ QCOMPARE(slider->sliderPosition(), 0);
+ QVERIFY(applicationInstance->sendEvent(slider,&eventUp));
+ QCOMPARE(slider->sliderPosition(), 0);
+
+ QVERIFY(applicationInstance->sendEvent(slider,&eventDown));
+ QCOMPARE(slider->sliderPosition(), 0);
+ QVERIFY(applicationInstance->sendEvent(slider,&eventDown));
+ QCOMPARE(slider->sliderPosition(), 1);
+}
+
#endif // !QT_NO_WHEELEVENT
void tst_QAbstractSlider::sliderPressedReleased_data()
diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
index 607fc1625a..d568cf63d4 100644
--- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
+++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
@@ -492,6 +492,7 @@ void tst_QMdiArea::subWindowActivated2()
spy.clear();
mdiArea.show();
+ mdiArea.activateWindow();
QVERIFY(QTest::qWaitForWindowActive(&mdiArea));
QTRY_COMPARE(spy.count(), 1);
QVERIFY(mdiArea.currentSubWindow());
diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro
index 8777cc6e11..bec098d462 100644
--- a/tests/manual/manual.pro
+++ b/tests/manual/manual.pro
@@ -31,6 +31,7 @@ qsysinfo \
qtabletevent \
qtexteditlist \
qtbug-8933 \
+qtbug-52641 \
qtouchevent \
touch \
qwidget_zorder \
diff --git a/tests/manual/qtabletevent/device_information/tabletwidget.cpp b/tests/manual/qtabletevent/device_information/tabletwidget.cpp
index a30e32b6d9..b4273bde8e 100644
--- a/tests/manual/qtabletevent/device_information/tabletwidget.cpp
+++ b/tests/manual/qtabletevent/device_information/tabletwidget.cpp
@@ -33,7 +33,7 @@
#include <QMetaObject>
#include <QMetaEnum>
-TabletWidget::TabletWidget(bool mouseToo) : mMouseToo(mouseToo)
+TabletWidget::TabletWidget(bool mouseToo) : mMouseToo(mouseToo), mWheelEventCount(0)
{
QPalette newPalette = palette();
newPalette.setColor(QPalette::Window, Qt::white);
@@ -82,6 +82,10 @@ bool TabletWidget::eventFilter(QObject *, QEvent *ev)
mGPos = event->globalPos();
mTimestamp = event->timestamp();
}
+ break;
+ case QEvent::Wheel:
+ ++mWheelEventCount;
+ break;
default:
break;
}
@@ -176,6 +180,8 @@ void TabletWidget::paintEvent(QPaintEvent *)
eventInfo << QString("z: %1").arg(QString::number(mZ));
eventInfo << QString("Unique Id: %1").arg(QString::number(mUnique));
+
+ eventInfo << QString("Total wheel events: %1").arg(QString::number(mWheelEventCount));
}
QString text = eventInfo.join("\n");
diff --git a/tests/manual/qtabletevent/device_information/tabletwidget.h b/tests/manual/qtabletevent/device_information/tabletwidget.h
index 4e6520e4cc..2b014a213a 100644
--- a/tests/manual/qtabletevent/device_information/tabletwidget.h
+++ b/tests/manual/qtabletevent/device_information/tabletwidget.h
@@ -61,6 +61,7 @@ private:
qint64 mUnique;
bool mMouseToo;
ulong mTimestamp;
+ int mWheelEventCount;
};
#endif // TABLETWIDGET_H
diff --git a/tests/manual/qtbug-52641/main.cpp b/tests/manual/qtbug-52641/main.cpp
new file mode 100644
index 0000000000..33ebd8584c
--- /dev/null
+++ b/tests/manual/qtbug-52641/main.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Kai Pastor
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QFileDialog>
+#include <QPainter>
+#include <QPdfWriter>
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+ QString filepath = QFileDialog::getSaveFileName(nullptr, "Save File", "",
+ "PDF files (*.pdf)");
+ if (filepath.isEmpty())
+ return 1;
+ QPdfWriter writer(filepath);
+ writer.setPageSize(QPageSize(QPageSize::A4));
+ writer.setResolution(300);
+
+ QPainterPath path;
+ path.moveTo(0,0);
+ path.lineTo(1000,0);
+ path.lineTo(1000,1000);
+ path.lineTo(0,800);
+ path.lineTo(500,100);
+ path.lineTo(800,900);
+ path.lineTo(300,600);
+
+ QPen pen;
+ pen.setWidth(30);
+ pen.setJoinStyle(Qt::MiterJoin);
+
+ // The black path on the first page must always be visible in the PDF viewer.
+ QPainter p(&writer);
+ pen.setMiterLimit(6.0);
+ p.setPen(pen);
+ p.drawPath(path);
+
+ // If a miter limit below 1.0 is written to the PDF,
+ // broken PDF viewers may not show the red path on the second page.
+ writer.newPage();
+ pen.setMiterLimit(0.6);
+ pen.setColor(Qt::red);
+ p.setPen(pen);
+ p.drawPath(path);
+
+ p.end();
+ return 0;
+}
diff --git a/tests/manual/qtbug-52641/qtbug-52641.pro b/tests/manual/qtbug-52641/qtbug-52641.pro
new file mode 100644
index 0000000000..5a9ff6df52
--- /dev/null
+++ b/tests/manual/qtbug-52641/qtbug-52641.pro
@@ -0,0 +1,5 @@
+TARGET = qtbug-52641
+TEMPLATE = app
+QT = core gui widgets
+SOURCES = main.cpp
+