Changeset View
Changeset View
Standalone View
Standalone View
autotests/kcharselect_unittest.cpp
- This file was added.
1 | /* This file is part of the KDE libraries | ||||
---|---|---|---|---|---|
2 | * | ||||
3 | * Copyright (c) 2019 David Faure <faure@kde.org> | ||||
4 | * | ||||
5 | * This library is free software; you can redistribute it and/or | ||||
6 | * modify it under the terms of the GNU Lesser General Public | ||||
7 | * License as published by the Free Software Foundation; either | ||||
8 | * version 2.1 of the License, or (at your option) any later version. | ||||
9 | * | ||||
10 | * This library is distributed in the hope that it will be useful, | ||||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
13 | * Lesser General Public License for more details. | ||||
14 | * | ||||
15 | * You should have received a copy of the GNU Lesser General Public | ||||
16 | * License along with this library; if not, write to the Free Software | ||||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||||
18 | * 02110-1301 USA | ||||
19 | */ | ||||
20 | #include <kcharselect.h> | ||||
21 | | ||||
22 | #include <QComboBox> | ||||
23 | #include <QTest> | ||||
24 | | ||||
25 | class KCharSelectTest : public QObject | ||||
26 | { | ||||
27 | Q_OBJECT | ||||
28 | | ||||
29 | private Q_SLOTS: | ||||
30 | void initTestCase() | ||||
31 | { | ||||
32 | } | ||||
33 | | ||||
34 | void createInstance() | ||||
35 | { | ||||
36 | KCharSelect selector(nullptr, nullptr); | ||||
37 | QCOMPARE(selector.displayedCodePoints().count(), 128); | ||||
38 | QCOMPARE(selector.currentCodePoint(), 0); | ||||
39 | } | ||||
40 | | ||||
41 | void changeBlock() | ||||
42 | { | ||||
43 | KCharSelect selector(nullptr, nullptr); | ||||
44 | // This asserts in QHeaderView, fix is up at https://codereview.qt-project.org/258967 | ||||
45 | #if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0) | ||||
46 | QComboBox *blockCombo = selector.findChild<QComboBox *>(QStringLiteral("blockCombo")); | ||||
47 | QVERIFY(blockCombo); | ||||
48 | blockCombo->setCurrentIndex(1); | ||||
49 | QCOMPARE(selector.currentCodePoint(), 128); | ||||
50 | #endif | ||||
51 | } | ||||
52 | }; | ||||
53 | | ||||
54 | QTEST_MAIN(KCharSelectTest) | ||||
55 | | ||||
56 | #include "kcharselect_unittest.moc" |