| 114 | } |
| 115 | |
| 116 | void testAbsolutePath() |
| 117 | { |
| 118 | #ifndef Q_OS_WIN |
| 119 | const QString expected = "/dds/root"; |
| 120 | #else |
| 121 | const QString expected = "c:/dds/root"; |
| 122 | #endif // !Q_OS_WIN |
| 123 | FileAccessMoc mocFile; |
| 124 | mocFile.setEngine(new FileAccessJobHandlerMoc(&mocFile)); |
| 125 | |
| 126 | const QUrl url = QUrl("fish://i@0.0.0.0/root"); |
| 127 | |
| 128 | QCOMPARE(FileAccess::prettyAbsPath(url), url.toDisplayString()); |
| 129 | QCOMPARE(FileAccess::prettyAbsPath(QUrl("file:///dds/root")).toLower(), expected); |
| 130 | QCOMPARE(FileAccess::prettyAbsPath(QUrl("/dds/root")).toLower(), expected); |
| 131 | QCOMPARE(FileAccess::prettyAbsPath(QUrl("c:/dds/root")).toLower(), "c:/dds/root"); |
| 132 | //work around for bad path in windows drop event urls. (Qt 5.15.2 affected) |
| 133 | #ifndef Q_OS_WIN |
| 134 | QCOMPARE(FileAccess::prettyAbsPath(QUrl("file:///c:/dds/root")).toLower(), "/c:/dds/root"); |
| 135 | #else |
| 136 | QCOMPARE(FileAccess::prettyAbsPath(QUrl("file:///c:/dds/root")).toLower(), "c:/dds/root"); |
| 137 | #endif // !Q_OS_WIN |
| 138 | |
| 139 | mocFile.setFile(url); |
| 140 | QCOMPARE(mocFile.prettyAbsPath(), url.toDisplayString()); |
| 141 | |
| 142 | mocFile.setFile(QUrl("file:///dds/root")); |
| 143 | QCOMPARE(mocFile.prettyAbsPath().toLower(), expected); |
| 144 | |
| 145 | mocFile.setFile(QUrl("/dds/root")); |
| 146 | QCOMPARE(mocFile.prettyAbsPath().toLower(), expected); |
| 147 | |
| 148 | mocFile.setFile(QStringLiteral("file:///dds/root")); |
| 149 | QCOMPARE(mocFile.prettyAbsPath().toLower(), expected); |
| 150 | |
| 151 | mocFile.setFile(QStringLiteral("/dds/root")); |
| 152 | QCOMPARE(mocFile.prettyAbsPath().toLower(), expected); |
| 153 | } |
| 154 | |
| 155 | void liveTest() |
| 156 | { |
nothing calls this directly
no test coverage detected