2
* Copyright (C) 2011 Andriy Rysin (rysin@kde.org)
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
//#include <kapplication.h>
22
#include <qtest_kde.h>
23
#include <QtGui/QIcon>
26
#include "../xkb_rules.h"
27
#include "../keyboard_config.h"
28
#include "../keyboard_daemon.h"
31
class KeyboardDaemonTest : public QObject
35
KeyboardDaemon* keyboardDaemon;
36
// KApplication* kapplication;
40
// kapplication = new KApplication();
41
// const KAboutData* kAboutData = new KAboutData(i18n("a").toAscii(), i18n("a").toAscii(), KLocalizedString(), i18n("a").toAscii());
42
// KCmdLineArgs::init(kAboutData);
43
keyboardDaemon = new KeyboardDaemon(this, QList<QVariant>());
46
void cleanupTestCase() {
47
delete keyboardDaemon;
48
// delete kapplication;
52
QVERIFY( keyboardDaemon != NULL );
54
// QVERIFY( ! flags->getTransparentPixmap().isNull() );
56
// const QIcon iconUs(flags->getIcon("us"));
57
// QVERIFY( ! iconUs.isNull() );
58
// QVERIFY( flags->getIcon("--").isNull() );
60
// KeyboardConfig keyboardConfig;
61
// LayoutUnit layoutUnit("us");
62
// LayoutUnit layoutUnit1("us", "intl");
63
// layoutUnit1.setDisplayName("usi");
64
// LayoutUnit layoutUnit2("us", "other");
66
// keyboardConfig.showFlag = true;
67
// const QIcon iconUsFlag = flags->getIconWithText(layoutUnit, keyboardConfig);
68
// QVERIFY( ! iconUsFlag.isNull() );
69
// QCOMPARE( image(iconUsFlag), image(iconUs) );
71
// keyboardConfig.showFlag = false;
72
// const QIcon iconUsText = flags->getIconWithText(layoutUnit, keyboardConfig);
73
// QVERIFY( ! iconUsText.isNull() );
74
// QVERIFY( image(iconUsText) != image(iconUs) );
76
// keyboardConfig.layouts.append(layoutUnit1);
77
// QCOMPARE( flags->getShortText(layoutUnit, keyboardConfig), QString("us") );
78
// QCOMPARE( flags->getShortText(layoutUnit1, keyboardConfig), QString("usi") );
79
// QCOMPARE( flags->getShortText(layoutUnit2, keyboardConfig), QString("us") );
81
// const Rules* rules = Rules::readRules();
82
// QCOMPARE( flags->getLongText(layoutUnit, rules), QString("USA") );
83
// QVERIFY( flags->getLongText(layoutUnit1, rules).startsWith("USA - International") );
84
// QCOMPARE( flags->getLongText(layoutUnit2, rules), QString("USA - other") );
86
// flags->clearCache();
89
// void loadRulesBenchmark() {
91
// Flags* flags = new Flags();
98
// need GUI for xkb protocol in xkb_rules.cpp
99
QTEST_KDEMAIN( KeyboardDaemonTest, GUI )
101
#include "keyboard_daemon_test.moc"