~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kcontrol/keyboard/tests/iso_codes_test.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (C) 2011 Andriy Rysin (rysin@kde.org)
 
3
 *
 
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.
 
8
 *
 
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.
 
13
 *
 
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.
 
17
 */
 
18
 
 
19
#include <kdebug.h>
 
20
#include <QtGui/QApplication>
 
21
#include <qtest_kde.h>
 
22
 
 
23
#include "../iso_codes.h"
 
24
 
 
25
 
 
26
class IsoCodesTest : public QObject
 
27
{
 
28
    Q_OBJECT
 
29
 
 
30
    IsoCodes* isoCodes;
 
31
 
 
32
private Q_SLOTS:
 
33
    void initTestCase() {
 
34
        isoCodes = new IsoCodes(IsoCodes::iso_639);
 
35
    }
 
36
 
 
37
    void cleanupTestCase() {
 
38
        delete isoCodes;
 
39
    }
 
40
 
 
41
    void testIsoCodes() {
 
42
        QVERIFY( isoCodes != NULL );
 
43
        QVERIFY( ! isoCodes->getEntryList().isEmpty() );
 
44
        const IsoCodeEntry* isoEntry = isoCodes->getEntry(IsoCodes::attr_iso_639_2T_code, "eng");
 
45
        QVERIFY( isoEntry != NULL );
 
46
        QVERIFY( ! isoEntry->empty() );
 
47
        QCOMPARE( isoEntry->value(IsoCodes::attr_iso_639_2T_code), QString("eng") );
 
48
        QCOMPARE( isoEntry->value(IsoCodes::attr_iso_639_2B_code), QString("eng") );
 
49
        QCOMPARE( isoEntry->value(IsoCodes::attr_iso_639_1_code), QString("en") );
 
50
    }
 
51
 
 
52
    void loadIsoCodesBenchmark() {
 
53
        QBENCHMARK {
 
54
                IsoCodes* isoCodes = new IsoCodes(IsoCodes::iso_639);
 
55
                delete isoCodes;
 
56
        }
 
57
    }
 
58
 
 
59
};
 
60
 
 
61
//TODO: something lighter than KDEMAIN ?
 
62
QTEST_KDEMAIN( IsoCodesTest, NoGUI )
 
63
 
 
64
#include "iso_codes_test.moc"