-
-
Notifications
You must be signed in to change notification settings - Fork 506
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add simulated location support on testable target configuration (#6187)
* Support simulated location for testable targets * Fix typo in default location * Add simulated location to `ios_app_with_custom_scheme` fixture * Add test for finding GPX files * Avoid breaking compatibility * Add assertions for simulated location * Make assertion method clear
- Loading branch information
Showing
16 changed files
with
395 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import Foundation | ||
|
||
/// Simulated location represents a GPS location that is used when running an app on the simulator. | ||
public struct SimulatedLocation: Codable, Equatable { | ||
/// The identifier of the location (e.g. London, England) | ||
public var identifier: String? | ||
/// Path to a .gpx file that indicates the location | ||
public var gpxFile: Path? | ||
|
||
private init( | ||
identifier: String? = nil, | ||
gpxFile: Path? = nil | ||
) { | ||
self.identifier = identifier | ||
self.gpxFile = gpxFile | ||
} | ||
|
||
public static func custom(gpxFile: Path) -> SimulatedLocation { | ||
.init(gpxFile: gpxFile) | ||
} | ||
|
||
public static var london: SimulatedLocation { | ||
.init(identifier: "London, England") | ||
} | ||
|
||
public static var johannesburg: SimulatedLocation { | ||
.init(identifier: "Johannesburg, South Africa") | ||
} | ||
|
||
public static var moscow: SimulatedLocation { | ||
.init(identifier: "Moscow, Russia") | ||
} | ||
|
||
public static var mumbai: SimulatedLocation { | ||
.init(identifier: "Mumbai, India") | ||
} | ||
|
||
public static var tokyo: SimulatedLocation { | ||
.init(identifier: "Tokyo, Japan") | ||
} | ||
|
||
public static var sydney: SimulatedLocation { | ||
.init(identifier: "Sydney, Australia") | ||
} | ||
|
||
public static var hongKong: SimulatedLocation { | ||
.init(identifier: "Hong Kong, China") | ||
} | ||
|
||
public static var honolulu: SimulatedLocation { | ||
.init(identifier: "Honolulu, HI, USA") | ||
} | ||
|
||
public static var sanFrancisco: SimulatedLocation { | ||
.init(identifier: "San Francisco, CA, USA") | ||
} | ||
|
||
public static var mexicoCity: SimulatedLocation { | ||
.init(identifier: "Mexico City, Mexico") | ||
} | ||
|
||
public static var newYork: SimulatedLocation { | ||
.init(identifier: "New York, NY, USA") | ||
} | ||
|
||
public static var rioDeJaneiro: SimulatedLocation { | ||
.init(identifier: "Rio de Janeiro, Brazil") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.