From 9a556bf24af19bf2788fef447d095d97cff728a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Mon, 28 Mar 2016 18:11:00 -0700 Subject: [PATCH] [osx] Fixed tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous change includes an additional salient change: a newly minted offline pack’s state is inactive initially, not unknown. --- platform/osx/test/MGLOfflineStorageTests.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/osx/test/MGLOfflineStorageTests.m b/platform/osx/test/MGLOfflineStorageTests.m index 3657f93d4..8ffa1207c 100644 --- a/platform/osx/test/MGLOfflineStorageTests.m +++ b/platform/osx/test/MGLOfflineStorageTests.m @@ -55,7 +55,7 @@ XCTestExpectation *additionCompletionHandlerExpectation = [self expectationWithDescription:@"add pack completion handler"]; [[MGLOfflineStorage sharedOfflineStorage] addPackForRegion:region withContext:context completionHandler:^(MGLOfflinePack * _Nullable completionHandlerPack, NSError * _Nullable error) { XCTAssertNotNil(completionHandlerPack, @"Added pack should exist."); - XCTAssertEqual(completionHandlerPack.state, MGLOfflinePackStateUnknown, @"Pack should initially have unknown state."); + XCTAssertEqual(completionHandlerPack.state, MGLOfflinePackStateInactive, @"New pack should initially have inactive state."); pack = completionHandlerPack; [additionCompletionHandlerExpectation fulfill]; }]; @@ -72,7 +72,7 @@ XCTAssert([userInfo[nameKey] isKindOfClass:[NSString class]], @"Name of offline pack isn’t a string."); XCTAssertEqualObjects(userInfo[nameKey], name, @"Name of offline pack has changed."); - XCTAssertEqual(pack.state, MGLOfflinePackStateUnknown, @"Pack should initially have unknown state."); + XCTAssertEqual(pack.state, MGLOfflinePackStateInactive, @"New pack should initially have inactive state."); [self keyValueObservingExpectationForObject:pack keyPath:@"state" handler:^BOOL(id _Nonnull observedObject, NSDictionary * _Nonnull change) { NSKeyValueChange changeKind = [change[NSKeyValueChangeKindKey] unsignedIntegerValue]; @@ -96,6 +96,7 @@ return notificationPack == pack && pack.state == MGLOfflinePackStateInactive; }]; + [pack requestProgress]; [self waitForExpectationsWithTimeout:1 handler:nil]; }