~artmello/gallery-app/gallery-app-open_new_photo_from_scope

« back to all changes in this revision

Viewing changes to tests/unittests/resource/tst_resource.cpp

  • Committer: Guenter Schwann
  • Date: 2013-04-15 12:05:00 UTC
  • mto: This revision was merged to the branch mainline in revision 653.
  • Revision ID: guenter.schwann@canonical.com-20130415120500-fh98u8vuuu7lg1rb
Use cmake instead of qmake

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
  Q_OBJECT
28
28
 
29
29
private slots:
30
 
    void is_installed_data();
31
 
    void is_installed();
32
 
 
33
 
    void trailing_slash();
34
 
 
35
 
    void get_rc_url_data();
36
 
    void get_rc_url();
37
 
 
38
30
    void maxTextureSize();
39
31
};
40
32
 
41
 
 
42
 
void tst_Resource::is_installed_data()
43
 
{
44
 
    QTest::addColumn<QString>("appDir");
45
 
    QTest::addColumn<QString>("installDir");
46
 
    QTest::addColumn<bool>("installed");
47
 
 
48
 
    QTest::newRow("system") << QString("/usr/bin") << QString("/usr") << true;
49
 
    QTest::newRow("local") << QString("/home/user/dev/gallery") << QString("/usr") << false;
50
 
}
51
 
void tst_Resource::is_installed()
52
 
{
53
 
    QFETCH(QString, appDir);
54
 
    QFETCH(QString, installDir);
55
 
    QFETCH(bool, installed);
56
 
 
57
 
    Resource resource(appDir, installDir, 0);
58
 
    QCOMPARE(resource.is_installed(), installed);
59
 
}
60
 
 
61
 
void tst_Resource::trailing_slash()
62
 
{
63
 
    Resource resource("", "", 0);
64
 
    QCOMPARE(resource.trailing_slash("/usr"), QString("/usr/"));
65
 
    QCOMPARE(resource.trailing_slash("/usr/"), QString("/usr/"));
66
 
}
67
 
 
68
 
void tst_Resource::get_rc_url_data()
69
 
{
70
 
    QTest::addColumn<QString>("appDir");
71
 
    QTest::addColumn<QString>("installDir");
72
 
    QTest::addColumn<QString>("path");
73
 
    QTest::addColumn<QUrl>("url");
74
 
 
75
 
    QTest::newRow("system") << QString("/usr/bin") << QString("/usr") << QString("img/icon.png")
76
 
                            << QUrl("file:///usr/share/gallery-app/rc/img/icon.png");
77
 
    QTest::newRow("local") << QString("/home/user/dev/gallery/src") << QString("/usr") << QString("img/icon.png")
78
 
                           << QUrl("file:///home/user/dev/gallery/src/../rc/img/icon.png");
79
 
}
80
 
void tst_Resource::get_rc_url()
81
 
{
82
 
    QFETCH(QString, appDir);
83
 
    QFETCH(QString, installDir);
84
 
    QFETCH(QString, path);
85
 
    QFETCH(QUrl, url);
86
 
 
87
 
    Resource resource(appDir, installDir, 0);
88
 
    QCOMPARE(resource.get_rc_url(path), url);
89
 
}
90
 
 
91
33
void tst_Resource::maxTextureSize()
92
34
{
93
 
    Resource resource("", "", 0);
 
35
    Resource resource(0);
94
36
    QCOMPARE(resource.maxTextureSize(), 0);
95
37
}
96
38