File indexing completed on 2024-04-28 03:58:55
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2019 David Faure <faure@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.1-or-later 0006 */ 0007 #include <kcharselect.h> 0008 0009 #include <QComboBox> 0010 #include <QLineEdit> 0011 #include <QTest> 0012 0013 class KCharSelectTest : public QObject 0014 { 0015 Q_OBJECT 0016 0017 private Q_SLOTS: 0018 void initTestCase() 0019 { 0020 } 0021 0022 void createInstance() 0023 { 0024 KCharSelect selector(nullptr, nullptr); 0025 QCOMPARE(selector.displayedCodePoints().count(), 128); 0026 QCOMPARE(selector.currentCodePoint(), 0); 0027 } 0028 0029 void changeBlock() 0030 { 0031 KCharSelect selector(nullptr, nullptr); 0032 QComboBox *blockCombo = selector.findChild<QComboBox *>(QStringLiteral("blockCombo")); 0033 QVERIFY(blockCombo); 0034 blockCombo->setCurrentIndex(1); 0035 QCOMPARE(selector.currentCodePoint(), 128); 0036 } 0037 0038 void search2Chars() 0039 { 0040 KCharSelect selector(nullptr, nullptr); 0041 QLineEdit *searchLineEdit = selector.findChild<QLineEdit *>(); 0042 QVERIFY(searchLineEdit); 0043 searchLineEdit->setText(QStringLiteral("pi")); 0044 Q_EMIT searchLineEdit->returnPressed(); 0045 QVERIFY(selector.displayedChars().contains(QChar(960))); // 960 == π 0046 } 0047 }; 0048 0049 QTEST_MAIN(KCharSelectTest) 0050 0051 #include "kcharselect_unittest.moc"