Skip to content

Commit 077da45

Browse files
committed
Add test case
1 parent a42ccb8 commit 077da45

File tree

3 files changed

+84
-1
lines changed

3 files changed

+84
-1
lines changed

OpenGpxTracker.xcodeproj/project.pbxproj

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
4588D66B230D23AA009AA75F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4588D66D230D23AA009AA75F /* InfoPlist.strings */; };
1616
4588D66F230D2476009AA75F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4588D671230D2476009AA75F /* InfoPlist.strings */; };
1717
45A430E9230D61240003C2F2 /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 45A430EB230D61240003C2F2 /* Interface.storyboard */; };
18+
836B1BAD2E7DC69900285130 /* ViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 836B1BAC2E7DC69900285130 /* ViewControllerTests.swift */; };
1819
8913CD8C1BDB0A9A009EC729 /* PreferencesTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8913CD8B1BDB0A9A009EC729 /* PreferencesTableViewController.swift */; };
1920
8913CD8E1BDB2477009EC729 /* PreferencesTableViewControllerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8913CD8D1BDB2477009EC729 /* PreferencesTableViewControllerDelegate.swift */; };
2021
893BEC8619C7E62200C77354 /* GPXWaypoint+MKAnnotation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 893BEC8519C7E62200C77354 /* GPXWaypoint+MKAnnotation.swift */; };
@@ -51,6 +52,7 @@
5152
89F6E107227F7C5500CE3E3F /* Double+Measures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89F6E0F4227D091900CE3E3F /* Double+Measures.swift */; };
5253
89F8749B1BBB7362004EF41A /* GPXTrack+length.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89F8749A1BBB7362004EF41A /* GPXTrack+length.swift */; };
5354
89F8749F1BBCB97F004EF41A /* GPXRoot+length.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89F8749E1BBCB97F004EF41A /* GPXRoot+length.swift */; };
55+
AD7D776C1332F97B0F10401A /* Pods_OpenGpxTrackerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 139616AA52679AF6C793CA25 /* Pods_OpenGpxTrackerTests.framework */; };
5456
BF15092223916FC100F51F1B /* UIColor+DarkMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF15092123916FC100F51F1B /* UIColor+DarkMode.swift */; };
5557
BF177EEA24D54F9200D5E021 /* CoreDataHelper+BatchDelete.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF177EE924D54F9200D5E021 /* CoreDataHelper+BatchDelete.swift */; };
5658
BF1FE1A8230EAB9B00404B59 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = BF1FE1A6230EAB9B00404B59 /* Localizable.strings */; };
@@ -168,6 +170,7 @@
168170
12D4905524C448540065D995 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
169171
12D4905624C448540065D995 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/InfoPlist.strings; sourceTree = "<group>"; };
170172
12D4905724C448540065D995 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/InfoPlist.strings; sourceTree = "<group>"; };
173+
139616AA52679AF6C793CA25 /* Pods_OpenGpxTrackerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_OpenGpxTrackerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
171174
3C3088B74A230AB1FD234D6F /* Pods_OpenGpxTracker_Watch.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_OpenGpxTracker_Watch.framework; sourceTree = BUILT_PRODUCTS_DIR; };
172175
44E786790A477838358F948C /* Pods-OpenGpxTracker.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OpenGpxTracker.debug.xcconfig"; path = "Pods/Target Support Files/Pods-OpenGpxTracker/Pods-OpenGpxTracker.debug.xcconfig"; sourceTree = "<group>"; };
173176
455F78BE230AA9D6003705F3 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Main.strings; sourceTree = "<group>"; };
@@ -178,7 +181,11 @@
178181
45A430EA230D61240003C2F2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Interface.storyboard; sourceTree = "<group>"; };
179182
45A430ED230D612B0003C2F2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Interface.strings; sourceTree = "<group>"; };
180183
45A430EF230D612C0003C2F2 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Interface.strings; sourceTree = "<group>"; };
184+
4D4846D740851C2838EFED65 /* Pods-OpenGpxTrackerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OpenGpxTrackerTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-OpenGpxTrackerTests/Pods-OpenGpxTrackerTests.debug.xcconfig"; sourceTree = "<group>"; };
181185
554D2ACAA71E64B3A7B1A167 /* Pods-OpenGpxTracker-Watch Extension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OpenGpxTracker-Watch Extension.release.xcconfig"; path = "Pods/Target Support Files/Pods-OpenGpxTracker-Watch Extension/Pods-OpenGpxTracker-Watch Extension.release.xcconfig"; sourceTree = "<group>"; };
186+
836B1BAC2E7DC69900285130 /* ViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewControllerTests.swift; sourceTree = "<group>"; };
187+
836B1BAE2E7DC7D500285130 /* MapCache.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = MapCache.framework; sourceTree = BUILT_PRODUCTS_DIR; };
188+
836B1BB22E7DC7E900285130 /* CoreGPX.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = CoreGPX.framework; sourceTree = BUILT_PRODUCTS_DIR; };
182189
84DE40602499509900ED7D6D /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/InfoPlist.strings; sourceTree = "<group>"; };
183190
84DE40612499509900ED7D6D /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Interface.strings; sourceTree = "<group>"; };
184191
84DE40622499509900ED7D6D /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; };
@@ -232,6 +239,7 @@
232239
89F6E0F6227E107C00CE3E3F /* Preferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = "<group>"; };
233240
89F8749A1BBB7362004EF41A /* GPXTrack+length.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "GPXTrack+length.swift"; sourceTree = "<group>"; };
234241
89F8749E1BBCB97F004EF41A /* GPXRoot+length.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "GPXRoot+length.swift"; sourceTree = "<group>"; };
242+
91430500A0A86B4A063D0325 /* Pods-OpenGpxTrackerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OpenGpxTrackerTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-OpenGpxTrackerTests/Pods-OpenGpxTrackerTests.release.xcconfig"; sourceTree = "<group>"; };
235243
93BD71BED3CF101C2B01ABDA /* Pods_OpenGpxTracker_Watch_Extension.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_OpenGpxTracker_Watch_Extension.framework; sourceTree = BUILT_PRODUCTS_DIR; };
236244
95D28CBDF2535138FA16F38F /* Pods_OpenGpxTracker.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_OpenGpxTracker.framework; sourceTree = BUILT_PRODUCTS_DIR; };
237245
9A591D96EF2E41D00AD6BB3A /* Pods-OpenGpxTracker-Watch Extension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OpenGpxTracker-Watch Extension.debug.xcconfig"; path = "Pods/Target Support Files/Pods-OpenGpxTracker-Watch Extension/Pods-OpenGpxTracker-Watch Extension.debug.xcconfig"; sourceTree = "<group>"; };
@@ -298,6 +306,7 @@
298306
isa = PBXFrameworksBuildPhase;
299307
buildActionMask = 2147483647;
300308
files = (
309+
AD7D776C1332F97B0F10401A /* Pods_OpenGpxTrackerTests.framework in Frameworks */,
301310
);
302311
runOnlyForDeploymentPostprocessing = 0;
303312
};
@@ -402,6 +411,7 @@
402411
children = (
403412
898EECF319C49B5800B4B207 /* OpenGpxTrackerTests.swift */,
404413
898EECF119C49B5800B4B207 /* Supporting Files */,
414+
836B1BAC2E7DC69900285130 /* ViewControllerTests.swift */,
405415
);
406416
path = OpenGpxTrackerTests;
407417
sourceTree = "<group>";
@@ -417,6 +427,8 @@
417427
898EED0119C4A16600B4B207 /* Frameworks */ = {
418428
isa = PBXGroup;
419429
children = (
430+
836B1BB22E7DC7E900285130 /* CoreGPX.framework */,
431+
836B1BAE2E7DC7D500285130 /* MapCache.framework */,
420432
BF637D122216C5FA0003EC04 /* WatchConnectivity.framework */,
421433
89D2F8FE1DD7FAFF00A52D64 /* TBXML.framework */,
422434
89D2F8FC1DD7FAFA00A52D64 /* iOS_GPX_Framework.framework */,
@@ -429,6 +441,7 @@
429441
95D28CBDF2535138FA16F38F /* Pods_OpenGpxTracker.framework */,
430442
3C3088B74A230AB1FD234D6F /* Pods_OpenGpxTracker_Watch.framework */,
431443
93BD71BED3CF101C2B01ABDA /* Pods_OpenGpxTracker_Watch_Extension.framework */,
444+
139616AA52679AF6C793CA25 /* Pods_OpenGpxTrackerTests.framework */,
432445
);
433446
name = Frameworks;
434447
sourceTree = "<group>";
@@ -492,6 +505,8 @@
492505
F8AD19460733F6AD5C43BE2D /* Pods-OpenGpxTracker.release.xcconfig */,
493506
9A591D96EF2E41D00AD6BB3A /* Pods-OpenGpxTracker-Watch Extension.debug.xcconfig */,
494507
554D2ACAA71E64B3A7B1A167 /* Pods-OpenGpxTracker-Watch Extension.release.xcconfig */,
508+
4D4846D740851C2838EFED65 /* Pods-OpenGpxTrackerTests.debug.xcconfig */,
509+
91430500A0A86B4A063D0325 /* Pods-OpenGpxTrackerTests.release.xcconfig */,
495510
);
496511
name = Pods;
497512
sourceTree = "<group>";
@@ -550,9 +565,11 @@
550565
isa = PBXNativeTarget;
551566
buildConfigurationList = 898EECFA19C49B5800B4B207 /* Build configuration list for PBXNativeTarget "OpenGpxTrackerTests" */;
552567
buildPhases = (
568+
D21C66F6BAED3A258B92093F /* [CP] Check Pods Manifest.lock */,
553569
898EECE919C49B5800B4B207 /* Sources */,
554570
898EECEA19C49B5800B4B207 /* Frameworks */,
555571
898EECEB19C49B5800B4B207 /* Resources */,
572+
08D273CC3020DBC58C5A9660 /* [CP] Embed Pods Frameworks */,
556573
);
557574
buildRules = (
558575
);
@@ -719,6 +736,26 @@
719736
/* End PBXResourcesBuildPhase section */
720737

721738
/* Begin PBXShellScriptBuildPhase section */
739+
08D273CC3020DBC58C5A9660 /* [CP] Embed Pods Frameworks */ = {
740+
isa = PBXShellScriptBuildPhase;
741+
buildActionMask = 2147483647;
742+
files = (
743+
);
744+
inputPaths = (
745+
"${PODS_ROOT}/Target Support Files/Pods-OpenGpxTrackerTests/Pods-OpenGpxTrackerTests-frameworks.sh",
746+
"${BUILT_PRODUCTS_DIR}/CoreGPX-iOS/CoreGPX.framework",
747+
"${BUILT_PRODUCTS_DIR}/MapCache/MapCache.framework",
748+
);
749+
name = "[CP] Embed Pods Frameworks";
750+
outputPaths = (
751+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CoreGPX.framework",
752+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MapCache.framework",
753+
);
754+
runOnlyForDeploymentPostprocessing = 0;
755+
shellPath = /bin/sh;
756+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-OpenGpxTrackerTests/Pods-OpenGpxTrackerTests-frameworks.sh\"\n";
757+
showEnvVarsInLog = 0;
758+
};
722759
196CCD645C9925FAA058D622 /* [CP] Check Pods Manifest.lock */ = {
723760
isa = PBXShellScriptBuildPhase;
724761
buildActionMask = 2147483647;
@@ -775,6 +812,28 @@
775812
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-OpenGpxTracker/Pods-OpenGpxTracker-frameworks.sh\"\n";
776813
showEnvVarsInLog = 0;
777814
};
815+
D21C66F6BAED3A258B92093F /* [CP] Check Pods Manifest.lock */ = {
816+
isa = PBXShellScriptBuildPhase;
817+
buildActionMask = 2147483647;
818+
files = (
819+
);
820+
inputFileListPaths = (
821+
);
822+
inputPaths = (
823+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
824+
"${PODS_ROOT}/Manifest.lock",
825+
);
826+
name = "[CP] Check Pods Manifest.lock";
827+
outputFileListPaths = (
828+
);
829+
outputPaths = (
830+
"$(DERIVED_FILE_DIR)/Pods-OpenGpxTrackerTests-checkManifestLockResult.txt",
831+
);
832+
runOnlyForDeploymentPostprocessing = 0;
833+
shellPath = /bin/sh;
834+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
835+
showEnvVarsInLog = 0;
836+
};
778837
DC6FB8E11C49DF2C00B378D4 /* SwiftLint */ = {
779838
isa = PBXShellScriptBuildPhase;
780839
alwaysOutOfDate = 1;
@@ -865,6 +924,7 @@
865924
isa = PBXSourcesBuildPhase;
866925
buildActionMask = 2147483647;
867926
files = (
927+
836B1BAD2E7DC69900285130 /* ViewControllerTests.swift in Sources */,
868928
898EECF419C49B5800B4B207 /* OpenGpxTrackerTests.swift in Sources */,
869929
);
870930
runOnlyForDeploymentPostprocessing = 0;
@@ -1176,6 +1236,7 @@
11761236
};
11771237
898EECFB19C49B5800B4B207 /* Debug */ = {
11781238
isa = XCBuildConfiguration;
1239+
baseConfigurationReference = 4D4846D740851C2838EFED65 /* Pods-OpenGpxTrackerTests.debug.xcconfig */;
11791240
buildSettings = {
11801241
BUNDLE_LOADER = "$(TEST_HOST)";
11811242
DEVELOPMENT_TEAM = "";
@@ -1202,6 +1263,7 @@
12021263
};
12031264
898EECFC19C49B5800B4B207 /* Release */ = {
12041265
isa = XCBuildConfiguration;
1266+
baseConfigurationReference = 91430500A0A86B4A063D0325 /* Pods-OpenGpxTrackerTests.release.xcconfig */;
12051267
buildSettings = {
12061268
BUNDLE_LOADER = "$(TEST_HOST)";
12071269
DEVELOPMENT_TEAM = "";

OpenGpxTracker/Base.lproj/Main.storyboard

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<!--View Controller-->
1313
<scene sceneID="tne-QT-ifu">
1414
<objects>
15-
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="OpenGpxTracker" customModuleProvider="target" sceneMemberID="viewController">
15+
<viewController storyboardIdentifier="RootViewController" id="BYZ-38-t0r" customClass="ViewController" customModule="OpenGpxTracker" customModuleProvider="target" sceneMemberID="viewController">
1616
<layoutGuides>
1717
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
1818
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//
2+
// ViewControllerTests.swift
3+
// OpenGpxTrackerTests
4+
//
5+
// Created by Tieda Wei on 2025-09-19.
6+
//
7+
8+
import XCTest
9+
@testable import OpenGpxTracker
10+
11+
final class ViewControllerTests: XCTestCase {
12+
func test_containsScaleBarView() throws {
13+
let storyboard = UIStoryboard(name: "Main", bundle: nil)
14+
let vc = storyboard.instantiateViewController(withIdentifier: "RootViewController") as? ViewController
15+
let sut = try XCTUnwrap(vc)
16+
XCTAssertTrue(sut.view.subviews.contains(where: { v in
17+
v === sut.scaleBar
18+
}))
19+
XCTAssertEqual(sut.scaleBar.mapView, sut.map)
20+
}
21+
}

0 commit comments

Comments
 (0)