]>
cloud.milkyroute.net Git - dolphin.git/blob - src/tests/draganddrophelpertest.cpp
8166b5bf2800fa061139efad4bb3496c0bb99f31
1 /***************************************************************************
2 * Copyright (C) 2017 by Emirald Mateli <aldo.mateli@gmail.com> *
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 *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
21 #include <views/draganddrophelper.h>
23 class DragAndDropHelperTest
: public QObject
28 void testUrlListMatchesUrl_data();
29 void testUrlListMatchesUrl();
32 void DragAndDropHelperTest::testUrlListMatchesUrl_data()
34 QTest::addColumn
<QList
<QUrl
>>("urlList");
35 QTest::addColumn
<QUrl
>("url");
36 QTest::addColumn
<bool>("expected");
38 QTest::newRow("test_equal")
39 << QList
<QUrl
> {QUrl::fromLocalFile("/root")}
40 << QUrl::fromLocalFile("/root")
43 QTest::newRow("test_trailing_slash")
44 << QList
<QUrl
> {QUrl::fromLocalFile("/root/")}
45 << QUrl::fromLocalFile("/root")
48 QTest::newRow("test_ftp_scheme")
49 << QList
<QUrl
> {QUrl("ftp://server:2211/dir")}
50 << QUrl("ftp://server:2211/dir")
53 QTest::newRow("test_not_matched")
54 << QList
<QUrl
> {QUrl::fromLocalFile("/usr/share"), QUrl::fromLocalFile("/usr/local/bin")}
55 << QUrl::fromLocalFile("/usr/bin")
58 QTest::newRow("test_empty_target")
59 << QList
<QUrl
> {QUrl::fromLocalFile("/usr/share"), QUrl::fromLocalFile("/usr/local/bin")}
63 QTest::newRow("test_empty_list")
65 << QUrl::fromLocalFile("/usr/bin")
69 void DragAndDropHelperTest::testUrlListMatchesUrl()
71 QFETCH(QList
<QUrl
>, urlList
);
73 QFETCH(bool, expected
);
75 QCOMPARE(DragAndDropHelper::urlListMatchesUrl(urlList
, url
), expected
);
79 QTEST_MAIN(DragAndDropHelperTest
)
81 #include "draganddrophelpertest.moc"