testfolder.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * This software is in the public domain, furnished "as is", without technical
  3. * support, and with no warranty, express or implied, as to its usefulness for
  4. * any purpose.
  5. *
  6. */
  7. #include <QtTest>
  8. #include "common/utility.h"
  9. #include "folder.h"
  10. using namespace OCC;
  11. class TestFolder: public QObject
  12. {
  13. Q_OBJECT
  14. private slots:
  15. void testFolder()
  16. {
  17. QFETCH(QString, folder);
  18. QFETCH(QString, expectedFolder);
  19. Folder *f = new Folder("alias", folder, "http://foo.bar.net");
  20. QCOMPARE(f->path(), expectedFolder);
  21. delete f;
  22. }
  23. void testFolder_data()
  24. {
  25. QTest::addColumn<QString>("folder");
  26. QTest::addColumn<QString>("expectedFolder");
  27. QTest::newRow("unixcase") << "/foo/bar" << "/foo/bar";
  28. QTest::newRow("doubleslash") << "/foo//bar" << "/foo/bar";
  29. QTest::newRow("tripleslash") << "/foo///bar" << "/foo/bar";
  30. QTest::newRow("mixedslash") << "/foo/\\bar" << "/foo/bar";
  31. QTest::newRow("windowsfwslash") << "C:/foo/bar" << "C:/foo/bar";
  32. QTest::newRow("windowsbwslash") << "C:\\foo" << "C:/foo";
  33. QTest::newRow("windowsbwslash2") << "C:\\foo\\bar" << "C:/foo/bar";
  34. }
  35. };
  36. QTEST_APPLESS_MAIN(TestFolder)
  37. #include "testfolder.moc"