summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp1
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp4
-rw-r--r--tests/auto/gui/text/qglyphrun/qglyphrun.pro9
-rw-r--r--tests/auto/gui/text/qglyphrun/testdata.qrc2
-rw-r--r--tests/auto/gui/text/qrawfont/qrawfont.pro8
-rw-r--r--tests/auto/gui/text/qrawfont/testdata.qrc2
-rw-r--r--tests/auto/shared/resources/test.ttf (renamed from tests/auto/gui/text/qglyphrun/test.ttf)bin2008 -> 2008 bytes
-rw-r--r--tests/auto/shared/resources/testfont.ttf (renamed from tests/auto/gui/text/qrawfont/testfont.ttf)bin63212 -> 63212 bytes
-rw-r--r--tests/auto/widgets/dialogs/qfontdialog/qfontdialog.pro2
-rw-r--r--tests/auto/widgets/dialogs/qfontdialog/testfonts.qrc6
-rw-r--r--tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp30
11 files changed, 51 insertions, 13 deletions
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index 109b726880..d12b109d9f 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -322,6 +322,7 @@ void QFontDialogPrivate::init()
familyList->setFocus();
retranslateStrings();
+ sampleEdit->setObjectName(QLatin1String("qt_fontDialog_sampleEdit"));
}
/*!
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index a9e13bad49..e9f20de842 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -5828,6 +5828,10 @@ bool QStyleSheetStyle::event(QEvent *e)
void QStyleSheetStyle::updateStyleSheetFont(QWidget* w) const
{
+ // Qt's fontDialog relies on the font of the sample edit for its selection,
+ // we should never override it.
+ if (w->objectName() == QLatin1String("qt_fontDialog_sampleEdit"))
+ return;
QWidget *container = containerWidget(w);
QRenderRule rule = renderRule(container, PseudoElement_None,
PseudoClass_Active | PseudoClass_Enabled | extendedPseudoClass(container));
diff --git a/tests/auto/gui/text/qglyphrun/qglyphrun.pro b/tests/auto/gui/text/qglyphrun/qglyphrun.pro
index 0993a5c49c..b7d9f164c9 100644
--- a/tests/auto/gui/text/qglyphrun/qglyphrun.pro
+++ b/tests/auto/gui/text/qglyphrun/qglyphrun.pro
@@ -8,14 +8,13 @@ linux: CONFIG += insignificant_test
SOURCES += \
tst_qglyphrun.cpp
-android {
- RESOURCES += \
- testdata.qrc
-}
wince* {
additionalFiles.files = test.ttf
- additionalFiles.path = .
+ additionalFiles.path = ../../../shared/resources/
DEPLOYMENT += additionalFiles
+} else {
+ RESOURCES += \
+ testdata.qrc
}
diff --git a/tests/auto/gui/text/qglyphrun/testdata.qrc b/tests/auto/gui/text/qglyphrun/testdata.qrc
index c4e237ad2f..25cadc477e 100644
--- a/tests/auto/gui/text/qglyphrun/testdata.qrc
+++ b/tests/auto/gui/text/qglyphrun/testdata.qrc
@@ -1,5 +1,5 @@
<RCC>
<qresource prefix="/">
- <file>test.ttf</file>
+ <file alias="test.ttf">../../../shared/resources/test.ttf</file>
</qresource>
</RCC>
diff --git a/tests/auto/gui/text/qrawfont/qrawfont.pro b/tests/auto/gui/text/qrawfont/qrawfont.pro
index 1891e7a9bf..20da2e9a22 100644
--- a/tests/auto/gui/text/qrawfont/qrawfont.pro
+++ b/tests/auto/gui/text/qrawfont/qrawfont.pro
@@ -7,9 +7,5 @@ QT = core core-private gui gui-private testlib
SOURCES += \
tst_qrawfont.cpp
-TESTDATA += testfont_bold_italic.ttf testfont.ttf
-
-android {
- RESOURCES += \
- testdata.qrc
-}
+RESOURCES += \
+ testdata.qrc
diff --git a/tests/auto/gui/text/qrawfont/testdata.qrc b/tests/auto/gui/text/qrawfont/testdata.qrc
index 7bea0d5a39..8f8e32ed24 100644
--- a/tests/auto/gui/text/qrawfont/testdata.qrc
+++ b/tests/auto/gui/text/qrawfont/testdata.qrc
@@ -1,6 +1,6 @@
<RCC>
<qresource prefix="/">
<file>testfont_bold_italic.ttf</file>
- <file>testfont.ttf</file>
+ <file alias="testfont.ttf">../../../shared/resources/testfont.ttf</file>
</qresource>
</RCC>
diff --git a/tests/auto/gui/text/qglyphrun/test.ttf b/tests/auto/shared/resources/test.ttf
index 382b2547b0..382b2547b0 100644
--- a/tests/auto/gui/text/qglyphrun/test.ttf
+++ b/tests/auto/shared/resources/test.ttf
Binary files differ
diff --git a/tests/auto/gui/text/qrawfont/testfont.ttf b/tests/auto/shared/resources/testfont.ttf
index d6042d2e58..d6042d2e58 100644
--- a/tests/auto/gui/text/qrawfont/testfont.ttf
+++ b/tests/auto/shared/resources/testfont.ttf
Binary files differ
diff --git a/tests/auto/widgets/dialogs/qfontdialog/qfontdialog.pro b/tests/auto/widgets/dialogs/qfontdialog/qfontdialog.pro
index 8116fe379a..dc1702971e 100644
--- a/tests/auto/widgets/dialogs/qfontdialog/qfontdialog.pro
+++ b/tests/auto/widgets/dialogs/qfontdialog/qfontdialog.pro
@@ -7,6 +7,8 @@ QT += core-private gui-private
SOURCES += tst_qfontdialog.cpp
+RESOURCES += testfonts.qrc
+
mac {
# ### fixme
# OBJECTIVE_SOURCES += tst_qfontdialog_mac_helpers.mm
diff --git a/tests/auto/widgets/dialogs/qfontdialog/testfonts.qrc b/tests/auto/widgets/dialogs/qfontdialog/testfonts.qrc
new file mode 100644
index 0000000000..cdfa287b39
--- /dev/null
+++ b/tests/auto/widgets/dialogs/qfontdialog/testfonts.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file alias="test.ttf">../../../shared/resources/test.ttf</file>
+ <file alias="testfont.ttf">../../../shared/resources/testfont.ttf</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp
index 22c84c2244..92ea7e5e57 100644
--- a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp
+++ b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp
@@ -36,6 +36,7 @@
#include <qapplication.h>
+#include <qfontdatabase.h>
#include <qfontinfo.h>
#include <qtimer.h>
#include <qmainwindow.h>
@@ -70,6 +71,10 @@ private slots:
void setFont();
void task256466_wrongStyle();
void setNonStandardFontSize();
+#ifndef QT_NO_STYLE_STYLESHEET
+ void qtbug_41513_stylesheetStyle();
+#endif
+
private:
void runSlotWithFailsafeTimer(const char *member);
@@ -201,6 +206,31 @@ void tst_QFontDialog::setNonStandardFontSize()
{
runSlotWithFailsafeTimer(SLOT(testNonStandardFontSize()));
}
+#ifndef QT_NO_STYLE_STYLESHEET
+static const QString offendingStyleSheet = QStringLiteral("* { font-family: \"QtBidiTestFont\"; }");
+
+void tst_QFontDialog::qtbug_41513_stylesheetStyle()
+{
+ if (QFontDatabase::addApplicationFont(QFINDTESTDATA("test.ttf")) < 0)
+ QSKIP("Test fonts not found.");
+ if (QFontDatabase::addApplicationFont(QFINDTESTDATA("testfont.ttf")) < 0)
+ QSKIP("Test fonts not found.");
+ QFont testFont = QFont(QStringLiteral("QtsSpecialTestFont"));
+ qApp->setStyleSheet(offendingStyleSheet);
+ bool accepted = false;
+ QTimer::singleShot(2000, this, SLOT(postKeyReturn()));
+ QFont resultFont = QFontDialog::getFont(&accepted, testFont,
+ QApplication::activeWindow(),
+ QLatin1String("QFontDialog - Stylesheet Test"),
+ QFontDialog::DontUseNativeDialog);
+ QVERIFY(accepted);
+
+ QCOMPARE(resultFont, testFont);
+
+ // reset stylesheet
+ qApp->setStyleSheet(QString());
+}
+#endif // QT_NO_STYLE_STYLESHEET
void tst_QFontDialog::testNonStandardFontSize()
{