summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qchar/tst_qchar.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-12-13 02:41:55 +0100
committerMarc Mutz <marc.mutz@kdab.com>2015-12-13 13:14:43 +0000
commita8ff0bc887f192bd03cdd937972491059fbebf53 (patch)
tree7aa87f7c70f6e205d8b667ed015c67a4023a42d0 /tests/auto/corelib/tools/qchar/tst_qchar.cpp
parente5a20cb864aba3fc9ca6814e54c62b0e25cffb2d (diff)
tst_QChar: add a check for comparing against int/uint
This is used throughout Qt and resolves to operator op(QChar, QChar) This test makes sure we don't break those use-cases as we fix missing relational operators as found by tst_QStringBinOps. In the other direction, 0 op QChar is ambiguous, due to op(const char*, QString) etc, so only test the uint op QChar case. Change-Id: Ifae7fb65bf3269583898cfea3fc6c95547c75122 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'tests/auto/corelib/tools/qchar/tst_qchar.cpp')
-rw-r--r--tests/auto/corelib/tools/qchar/tst_qchar.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp
index 32002fe7ed..29e48a1cc8 100644
--- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp
+++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp
@@ -44,6 +44,7 @@ class tst_QChar : public QObject
{
Q_OBJECT
private slots:
+ void operator_eqeq_int();
void operators_data();
void operators();
void toUpper();
@@ -79,6 +80,30 @@ private slots:
void unicodeVersion();
};
+void tst_QChar::operator_eqeq_int()
+{
+ {
+ const QChar ch = QLatin1Char(' ');
+ QVERIFY(ch != 0);
+ QVERIFY(!(ch == 0));
+
+ QVERIFY(ch == 0x20);
+ QVERIFY(!(ch != 0x20));
+ QVERIFY(0x20 == ch);
+ QVERIFY(!(0x20 != ch));
+ }
+ {
+ const QChar ch = QLatin1Char('\0');
+ QVERIFY(ch == 0);
+ QVERIFY(!(ch != 0));
+
+ QVERIFY(ch != 0x20);
+ QVERIFY(!(ch == 0x20));
+ QVERIFY(0x20 != ch);
+ QVERIFY(!(0x20 == ch));
+ }
+}
+
void tst_QChar::operators_data()
{
QTest::addColumn<QChar>("lhs");