summaryrefslogtreecommitdiff
path: root/platform/darwin
diff options
context:
space:
mode:
authorFabian Guerra <fabian.guerra@mapbox.com>2018-09-19 14:41:28 -0700
committerFabian Guerra Soto <fabian.guerra@mapbox.com>2018-09-19 15:13:05 -0700
commit9b09ec1e6a4de3acfddd8dcd83e9c8596c60e0e0 (patch)
tree7961adf648beb76dfbb64c0ce4eca58554b773fb /platform/darwin
parentab8b6b74dcce3c483d73e52cc5b9b2bd92e57252 (diff)
downloadqtlocation-mapboxgl-9b09ec1e6a4de3acfddd8dcd83e9c8596c60e0e0.tar.gz
[ios, macos] Fix add file content test, create Documents folder when missing.
Diffstat (limited to 'platform/darwin')
-rw-r--r--platform/darwin/test/MGLOfflineStorageTests.mm11
1 files changed, 8 insertions, 3 deletions
diff --git a/platform/darwin/test/MGLOfflineStorageTests.mm b/platform/darwin/test/MGLOfflineStorageTests.mm
index f89d922f11..261e9a3a9c 100644
--- a/platform/darwin/test/MGLOfflineStorageTests.mm
+++ b/platform/darwin/test/MGLOfflineStorageTests.mm
@@ -293,8 +293,13 @@
NSString *filePath = [documentDir stringByAppendingPathComponent:@"barcelona.db"];
NSFileManager *fileManager = [NSFileManager defaultManager];
- BOOL exists = [fileManager fileExistsAtPath:filePath];
- if (exists) {
+ BOOL directoryExists = [fileManager fileExistsAtPath:documentDir];
+ if (!directoryExists) {
+ [fileManager createDirectoryAtPath:documentDir withIntermediateDirectories:YES attributes:nil error:nil];
+ }
+
+ BOOL databaseExists = [fileManager fileExistsAtPath:filePath];
+ if (databaseExists) {
[fileManager removeItemAtPath:filePath error:nil];
}
@@ -311,7 +316,7 @@
long long fileSize = [fileSizeNumber longLongValue];
long long dabaseFileSize = 32391168;
// Merging databases creates an empty file if the file does not exist at the given path.
- XCTAssertEqual(fileSize, dabaseFileSize, @"The dabase file size must be:%l actual size:%l", dabaseFileSize, fileSize);
+ XCTAssertEqual(fileSize, dabaseFileSize, @"The dabase file size must be:%lld actual size:%lld", dabaseFileSize, fileSize);
NSUInteger countOfPacks = [MGLOfflineStorage sharedOfflineStorage].packs.count;