Changeset View
Changeset View
Standalone View
Standalone View
autotests/localfilelistingtest.cpp
Show All 35 Lines | |||||
36 | 36 | | |||
37 | #include <QDebug> | 37 | #include <QDebug> | ||
38 | 38 | | |||
39 | #include <QtTest> | 39 | #include <QtTest> | ||
40 | #include <QTest> | 40 | #include <QTest> | ||
41 | 41 | | |||
42 | #include <algorithm> | 42 | #include <algorithm> | ||
43 | 43 | | |||
44 | #if !defined Q_OS_FREEBSD && !defined Q_OS_MACOS | | |||
45 | #include <filesystem> | | |||
46 | #endif | | |||
47 | | ||||
48 | class LocalFileListingTests: public QObject, public DatabaseTestData | 44 | class LocalFileListingTests: public QObject, public DatabaseTestData | ||
49 | { | 45 | { | ||
50 | Q_OBJECT | 46 | Q_OBJECT | ||
51 | 47 | | |||
52 | public: | 48 | public: | ||
53 | 49 | | |||
54 | LocalFileListingTests(QObject *parent = nullptr) : QObject(parent) | 50 | LocalFileListingTests(QObject *parent = nullptr) : QObject(parent) | ||
55 | { | 51 | { | ||
▲ Show 20 Lines • Show All 328 Lines • ▼ Show 20 Line(s) | 321 | { | |||
384 | 380 | | |||
385 | auto newTracksSignal = tracksListSpy.at(0); | 381 | auto newTracksSignal = tracksListSpy.at(0); | ||
386 | auto newTracks = newTracksSignal.at(0).value<QList<MusicAudioTrack>>(); | 382 | auto newTracks = newTracksSignal.at(0).value<QList<MusicAudioTrack>>(); | ||
387 | auto newCovers = newTracksSignal.at(1).value<QHash<QString, QUrl>>(); | 383 | auto newCovers = newTracksSignal.at(1).value<QHash<QString, QUrl>>(); | ||
388 | 384 | | |||
389 | QCOMPARE(newTracks.count(), 1); | 385 | QCOMPARE(newTracks.count(), 1); | ||
390 | QCOMPARE(newCovers.count(), 1); | 386 | QCOMPARE(newCovers.count(), 1); | ||
391 | 387 | | |||
392 | #if defined Q_OS_FREEBSD || defined Q_OS_MACOS | 388 | QDir().rename(musicPath, musicFriendPath); | ||
393 | QString commandLine(QStringLiteral("mv ") + musicPath + QStringLiteral(" ") + musicFriendPath); | | |||
394 | system(commandLine.toLatin1().data()); | | |||
395 | #else | | |||
396 | std::rename(musicPath.toStdString().c_str(), musicFriendPath.toStdString().c_str()); | | |||
397 | #endif | | |||
398 | 389 | | |||
pino: Even easier: QDir().rename(...); | |||||
399 | auto removedFilesWorking = removedTracksListSpy.wait(); | 390 | auto removedFilesWorking = removedTracksListSpy.wait(); | ||
400 | 391 | | |||
401 | if (!removedFilesWorking && errorWatchingFileSystemChangesSpy.count()) { | 392 | if (!removedFilesWorking && errorWatchingFileSystemChangesSpy.count()) { | ||
402 | QEXPECT_FAIL("", "Impossible watching file system for changes", Abort); | 393 | QEXPECT_FAIL("", "Impossible watching file system for changes", Abort); | ||
403 | } | 394 | } | ||
404 | QCOMPARE(removedFilesWorking, true); | 395 | QCOMPARE(removedFilesWorking, true); | ||
405 | 396 | | |||
406 | QCOMPARE(tracksListSpy.count(), 1); | 397 | QCOMPARE(tracksListSpy.count(), 1); | ||
▲ Show 20 Lines • Show All 103 Lines • Show Last 20 Lines |
Even easier: QDir().rename(...);