summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp36
-rw-r--r--tests/auto/gui/text/qfont/tst_qfont.cpp1
-rw-r--r--tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp4
-rw-r--r--tests/auto/gui/text/qinputcontrol/qinputcontrol.pro7
-rw-r--r--tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp100
-rw-r--r--tests/auto/gui/text/qstatictext/tst_qstatictext.cpp2
-rw-r--r--tests/auto/gui/text/text.pro3
7 files changed, 150 insertions, 3 deletions
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index a9ac18144e..3562bc63f4 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -300,6 +300,9 @@ private slots:
void QTBUG56252();
+ void blendNullRGB32();
+ void toRGB64();
+
private:
void fillData();
void setPenColor(QPainter& p);
@@ -5151,6 +5154,39 @@ void tst_QPainter::QTBUG56252()
// If no crash or illegal memory read, all is fine
}
+void tst_QPainter::blendNullRGB32()
+{
+ quint32 data[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+ QImage nullImage((const uchar*)data, 16, 1, QImage::Format_RGB32);
+ QImage image(16, 1, QImage::Format_RGB32);
+ image.fill(Qt::white);
+
+ QPainter paint(&image);
+ paint.setCompositionMode(QPainter::CompositionMode_Source);
+ paint.setOpacity(0.5);
+ paint.drawImage(0, 0, nullImage);
+ paint.end();
+
+ for (int i=0; i < image.width(); ++i)
+ QVERIFY(image.pixel(i,0) != 0xffffffff);
+}
+
+void tst_QPainter::toRGB64()
+{
+ QImage dst(10, 1, QImage::Format_BGR30);
+ QImage src(10, 1, QImage::Format_RGB16);
+ src.fill(Qt::white);
+
+ QPainter paint(&dst);
+ paint.drawImage(0, 0, src);
+ paint.end();
+
+ for (int i=0; i < dst.width(); ++i) {
+ QVERIFY(dst.pixelColor(i,0) == QColor(Qt::white));
+ }
+}
+
QTEST_MAIN(tst_QPainter)
#include "tst_qpainter.moc"
diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp
index ca984a26a5..a6d8944656 100644
--- a/tests/auto/gui/text/qfont/tst_qfont.cpp
+++ b/tests/auto/gui/text/qfont/tst_qfont.cpp
@@ -130,7 +130,6 @@ void tst_QFont::italicOblique()
QString family = *f_it;
QStringList styles = fdb.styles(family);
- QVERIFY(!styles.isEmpty());
QStringList::ConstIterator s_it, s_end = styles.end();
for (s_it = styles.begin(); s_it != s_end; ++s_it) {
QString style = *s_it;
diff --git a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
index 8c26f8a91f..e8244a0e5d 100644
--- a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
+++ b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
@@ -326,6 +326,10 @@ void tst_QFontDatabase::condensedFontMatching()
QFont tfcByStyleName("QtBidiTestFont");
tfcByStyleName.setStyleName("Condensed");
+#ifdef Q_OS_WIN
+ QEXPECT_FAIL("","No matching of sub-family by stretch on Windows", Continue);
+#endif
+
QCOMPARE(QFontMetrics(tfcByStretch).width(testString()),
QFontMetrics(tfcByStyleName).width(testString()));
diff --git a/tests/auto/gui/text/qinputcontrol/qinputcontrol.pro b/tests/auto/gui/text/qinputcontrol/qinputcontrol.pro
new file mode 100644
index 0000000000..811c9aab90
--- /dev/null
+++ b/tests/auto/gui/text/qinputcontrol/qinputcontrol.pro
@@ -0,0 +1,7 @@
+CONFIG += testcase
+TARGET = tst_qinputcontrol
+
+QT = core gui gui-private testlib
+
+SOURCES += \
+ tst_qinputcontrol.cpp
diff --git a/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp b/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp
new file mode 100644
index 0000000000..ad5ba6affb
--- /dev/null
+++ b/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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:GPL-EXCEPT$
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#include <private/qinputcontrol_p.h>
+#include <QtGui/QKeyEvent>
+
+class tst_QInputControl: public QObject
+{
+ Q_OBJECT
+private slots:
+ void isAcceptableInput_data();
+ void isAcceptableInput();
+ void tabOnlyAcceptableInputForTextEdit();
+};
+
+void tst_QInputControl::isAcceptableInput_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<Qt::KeyboardModifiers>("modifiers");
+ QTest::addColumn<bool>("acceptable");
+
+ QTest::newRow("empty-string") << QString() << Qt::KeyboardModifiers() << false;
+ QTest::newRow("zwnj") << QString(QChar(0x200C)) << Qt::KeyboardModifiers() << true;
+ QTest::newRow("zwnj-with-ctrl") << QString(QChar(0x200C)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true;
+ QTest::newRow("zwnj-with-ctrl-shift") << QString(QChar(0x200C)) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << true;
+ QTest::newRow("zwj") << QString(QChar(0x200D)) << Qt::KeyboardModifiers() << true;
+ QTest::newRow("zwj-with-ctrl") << QString(QChar(0x200D)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true;
+ QTest::newRow("zwj-with-ctrl-shift") << QString(QChar(0x200D)) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << true;
+ QTest::newRow("printable-latin") << QString(QLatin1Char('a')) << Qt::KeyboardModifiers() << true;
+ QTest::newRow("printable-latin-with-ctrl") << QString(QLatin1Char('a')) << Qt::KeyboardModifiers(Qt::ControlModifier) << false;
+ QTest::newRow("printable-latin-with-ctrl-shift") << QString(QLatin1Char('a')) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << false;
+ QTest::newRow("printable-hebrew") << QString(QChar(0x2135)) << Qt::KeyboardModifiers() << true;
+ QTest::newRow("private-use-area") << QString(QChar(0xE832)) << Qt::KeyboardModifiers() << true;
+ QTest::newRow("multiple-printable") << QStringLiteral("foobar") << Qt::KeyboardModifiers() << true;
+}
+
+void tst_QInputControl::isAcceptableInput()
+{
+ QFETCH(QString, text);
+ QFETCH(Qt::KeyboardModifiers, modifiers);
+ QFETCH(bool, acceptable);
+
+ QKeyEvent keyEvent(QKeyEvent::KeyPress, Qt::Key_unknown, modifiers, text);
+
+ {
+ QInputControl inputControl(QInputControl::TextEdit);
+ QCOMPARE(inputControl.isAcceptableInput(&keyEvent), acceptable);
+ }
+
+ {
+ QInputControl inputControl(QInputControl::LineEdit);
+ QCOMPARE(inputControl.isAcceptableInput(&keyEvent), acceptable);
+ }
+}
+
+void tst_QInputControl::tabOnlyAcceptableInputForTextEdit()
+{
+ QKeyEvent keyEvent(QKeyEvent::KeyPress, Qt::Key_unknown, Qt::KeyboardModifiers(), QLatin1String("\t"));
+
+ {
+ QInputControl inputControl(QInputControl::TextEdit);
+ QCOMPARE(inputControl.isAcceptableInput(&keyEvent), true);
+ }
+
+ {
+ QInputControl inputControl(QInputControl::LineEdit);
+ QCOMPARE(inputControl.isAcceptableInput(&keyEvent), false);
+ }
+}
+
+QTEST_MAIN(tst_QInputControl)
+#include "tst_qinputcontrol.moc"
+
diff --git a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
index b3d1b75a42..9f84f64ee9 100644
--- a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
+++ b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
@@ -859,7 +859,7 @@ void tst_QStaticText::textDocumentColor()
class TestPaintEngine: public QPaintEngine
{
public:
- void drawTextItem(const QPointF &p, const QTextItem &textItem) Q_DECL_OVERRIDE
+ void drawTextItem(const QPointF &p, const QTextItem &) Q_DECL_OVERRIDE
{
differentVerticalPositions.insert(qRound(p.y()));
}
diff --git a/tests/auto/gui/text/text.pro b/tests/auto/gui/text/text.pro
index bb4984767f..d1a3eda4fc 100644
--- a/tests/auto/gui/text/text.pro
+++ b/tests/auto/gui/text/text.pro
@@ -23,7 +23,8 @@ SUBDIRS=\
qtextscriptengine \
qtexttable \
qzip \
- qtextodfwriter
+ qtextodfwriter \
+ qinputcontrol
win32:SUBDIRS -= qtextpiecetable