~ubuntu-branches/ubuntu/vivid/kfilemetadata-kf5/vivid-proposed

« back to all changes in this revision

Viewing changes to autotests/propertyinfotest.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2014-07-28 17:20:53 UTC
  • Revision ID: package-import@ubuntu.com-20140728172053-9foljfyirk3kwuai
Tags: upstream-5.0.0a
ImportĀ upstreamĀ versionĀ 5.0.0a

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of the KDE KFileMetaData project
 
3
 * Copyright (C) 2014  Vishesh Handa <me@vhanda.in>
 
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  02110-1301  USA
 
18
 *
 
19
 */
 
20
 
 
21
#include "propertyinfotest.h"
 
22
#include "propertyinfo.h"
 
23
 
 
24
#include <QtTest>
 
25
 
 
26
using namespace KFileMetaData;
 
27
 
 
28
void PropertyInfoTest::testNameIdMapping()
 
29
{
 
30
    // The +1 is to avoid the Empty Property
 
31
    int i = static_cast<int>(Property::FirstProperty) + 1;
 
32
    int e = static_cast<int>(Property::LastProperty);
 
33
 
 
34
    for (; i <= e; i++) {
 
35
        Property::Property p = static_cast<Property::Property>(i);
 
36
        PropertyInfo pi(p);
 
37
 
 
38
        // qDebug() << pi.name();
 
39
        QCOMPARE(pi.property(), p);
 
40
        QVERIFY(!pi.name().isEmpty());
 
41
        QVERIFY(!pi.displayName().isEmpty());
 
42
 
 
43
        PropertyInfo pi2 = PropertyInfo::fromName(pi.name());
 
44
        QCOMPARE(pi2.property(), p);
 
45
    }
 
46
}
 
47
 
 
48
QTEST_MAIN(PropertyInfoTest)