Skip to content

Commit f3524cc

Browse files
Lay Foundation For Automation Testing (#1804)
1 parent 407c34d commit f3524cc

File tree

17 files changed

+397
-112
lines changed

17 files changed

+397
-112
lines changed

CodeEdit.xcodeproj/project.pbxproj

+54-8
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,10 @@
325325
61A53A812B4449F00093BF8A /* WorkspaceDocument+Index.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61A53A802B4449F00093BF8A /* WorkspaceDocument+Index.swift */; };
326326
661EF7B82BEE215300C3E577 /* ImageFileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 661EF7B72BEE215300C3E577 /* ImageFileView.swift */; };
327327
661EF7BD2BEE215300C3E577 /* LoadingFileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 661EF7BC2BEE215300C3E577 /* LoadingFileView.swift */; };
328-
669A50512C380C1800304CD8 /* String+escapedWhiteSpaces.swift in Sources */ = {isa = PBXBuildFile; fileRef = 669A50502C380C1800304CD8 /* String+escapedWhiteSpaces.swift */; };
329-
669A50532C380C8E00304CD8 /* Collection+subscript_safe.swift in Sources */ = {isa = PBXBuildFile; fileRef = 669A50522C380C8E00304CD8 /* Collection+subscript_safe.swift */; };
330328
664935422C35A5BC00461C35 /* NSTableViewWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 664935412C35A5BC00461C35 /* NSTableViewWrapper.swift */; };
331329
6653EE552C34817900B82DE2 /* QuickSearchResultLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6653EE542C34817900B82DE2 /* QuickSearchResultLabel.swift */; };
330+
669A50512C380C1800304CD8 /* String+escapedWhiteSpaces.swift in Sources */ = {isa = PBXBuildFile; fileRef = 669A50502C380C1800304CD8 /* String+escapedWhiteSpaces.swift */; };
331+
669A50532C380C8E00304CD8 /* Collection+subscript_safe.swift in Sources */ = {isa = PBXBuildFile; fileRef = 669A50522C380C8E00304CD8 /* Collection+subscript_safe.swift */; };
332332
669BC4082BED306400D1197C /* AnyFileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 669BC4072BED306400D1197C /* AnyFileView.swift */; };
333333
66AF6CE22BF17CC300D83C9D /* StatusBarViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66AF6CE12BF17CC300D83C9D /* StatusBarViewModel.swift */; };
334334
66AF6CE42BF17F6800D83C9D /* StatusBarFileInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66AF6CE32BF17F6800D83C9D /* StatusBarFileInfoView.swift */; };
@@ -405,6 +405,9 @@
405405
6C85BB412C21061A00EB5DEF /* GitHubComment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 587B9E3C29301D8F00AC7927 /* GitHubComment.swift */; };
406406
6C85BB442C210EFD00EB5DEF /* SwiftUIIntrospect in Frameworks */ = {isa = PBXBuildFile; productRef = 6C85BB432C210EFD00EB5DEF /* SwiftUIIntrospect */; };
407407
6C91D57229B176FF0059A90D /* EditorManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C91D57129B176FF0059A90D /* EditorManager.swift */; };
408+
6C9619202C3F27E3009733CE /* ProjectNavigatorUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C96191B2C3F27E3009733CE /* ProjectNavigatorUITests.swift */; };
409+
6C9619222C3F27F1009733CE /* Query.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C9619212C3F27F1009733CE /* Query.swift */; };
410+
6C9619242C3F2809009733CE /* ProjectPath.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C9619232C3F2809009733CE /* ProjectPath.swift */; };
408411
6C97EBCC2978760400302F95 /* AcknowledgementsWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C97EBCB2978760400302F95 /* AcknowledgementsWindowController.swift */; };
409412
6CA1AE952B46950000378EAB /* EditorInstance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CA1AE942B46950000378EAB /* EditorInstance.swift */; };
410413
6CAAF68A29BC9C2300A1F48A /* (null) in Sources */ = {isa = PBXBuildFile; };
@@ -1015,6 +1018,10 @@
10151018
6C82D6BB29C00CD900495C54 /* FirstResponderPropertyWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstResponderPropertyWrapper.swift; sourceTree = "<group>"; };
10161019
6C82D6C529C012AD00495C54 /* NSApp+openWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSApp+openWindow.swift"; sourceTree = "<group>"; };
10171020
6C91D57129B176FF0059A90D /* EditorManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditorManager.swift; sourceTree = "<group>"; };
1021+
6C96191B2C3F27E3009733CE /* ProjectNavigatorUITests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProjectNavigatorUITests.swift; sourceTree = "<group>"; };
1022+
6C9619212C3F27F1009733CE /* Query.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Query.swift; sourceTree = "<group>"; };
1023+
6C9619232C3F2809009733CE /* ProjectPath.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectPath.swift; sourceTree = "<group>"; };
1024+
6C9619262C3F285C009733CE /* CodeEditTestPlan.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = CodeEditTestPlan.xctestplan; sourceTree = "<group>"; };
10181025
6C97EBCB2978760400302F95 /* AcknowledgementsWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AcknowledgementsWindowController.swift; sourceTree = "<group>"; };
10191026
6CA1AE942B46950000378EAB /* EditorInstance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditorInstance.swift; sourceTree = "<group>"; };
10201027
6CABB1A029C5593800340467 /* SearchPanelView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchPanelView.swift; sourceTree = "<group>"; };
@@ -1676,8 +1683,8 @@
16761683
043C321327E31FF6006AE443 /* CodeEditDocumentController.swift */,
16771684
04660F6927E51E5C00477777 /* CodeEditWindowController.swift */,
16781685
B6152B7F2ADAE421004C6012 /* CodeEditWindowControllerExtensions.swift */,
1679-
4E7F066529602E7B00BB3C12 /* CodeEditSplitViewController.swift */,
16801686
0FD96BCD2BEF42530025A697 /* CodeEditWindowController+Toolbar.swift */,
1687+
4E7F066529602E7B00BB3C12 /* CodeEditSplitViewController.swift */,
16811688
);
16821689
path = Controllers;
16831690
sourceTree = "<group>";
@@ -2707,6 +2714,40 @@
27072714
path = NSApplication;
27082715
sourceTree = "<group>";
27092716
};
2717+
6C96191C2C3F27E3009733CE /* ProjectNavigator */ = {
2718+
isa = PBXGroup;
2719+
children = (
2720+
6C96191B2C3F27E3009733CE /* ProjectNavigatorUITests.swift */,
2721+
);
2722+
path = ProjectNavigator;
2723+
sourceTree = "<group>";
2724+
};
2725+
6C96191D2C3F27E3009733CE /* NavigatorArea */ = {
2726+
isa = PBXGroup;
2727+
children = (
2728+
6C96191C2C3F27E3009733CE /* ProjectNavigator */,
2729+
);
2730+
path = NavigatorArea;
2731+
sourceTree = "<group>";
2732+
};
2733+
6C96191E2C3F27E3009733CE /* Features */ = {
2734+
isa = PBXGroup;
2735+
children = (
2736+
6C96191D2C3F27E3009733CE /* NavigatorArea */,
2737+
);
2738+
path = Features;
2739+
sourceTree = "<group>";
2740+
};
2741+
6C96191F2C3F27E3009733CE /* CodeEditUITests */ = {
2742+
isa = PBXGroup;
2743+
children = (
2744+
6C9619232C3F2809009733CE /* ProjectPath.swift */,
2745+
6C9619212C3F27F1009733CE /* Query.swift */,
2746+
6C96191E2C3F27E3009733CE /* Features */,
2747+
);
2748+
path = CodeEditUITests;
2749+
sourceTree = "<group>";
2750+
};
27102751
6CAAF68F29BCC6F900A1F48A /* WindowCommands */ = {
27112752
isa = PBXGroup;
27122753
children = (
@@ -2863,10 +2904,12 @@
28632904
children = (
28642905
B658FB2E27DA9E0F00EA4DBD /* CodeEdit */,
28652906
587B60F329340A8000D5CD8F /* CodeEditTests */,
2907+
6C96191F2C3F27E3009733CE /* CodeEditUITests */,
28662908
28052E0129730F2F00F4F90A /* Configs */,
28672909
B6FF04772B6C08AC002C2C78 /* DefaultThemes */,
28682910
58F2EACE292FB2B0004A9BDE /* Documentation.docc */,
28692911
2BE487ED28245162003F3F64 /* OpenWithCodeEdit */,
2912+
6C9619262C3F285C009733CE /* CodeEditTestPlan.xctestplan */,
28702913
284DC8502978BA2600BF2770 /* .all-contributorsrc */,
28712914
283BDCBC2972EEBD002AFF81 /* Package.resolved */,
28722915
B658FB2D27DA9E0F00EA4DBD /* Products */,
@@ -4059,6 +4102,9 @@
40594102
isa = PBXSourcesBuildPhase;
40604103
buildActionMask = 2147483647;
40614104
files = (
4105+
6C9619242C3F2809009733CE /* ProjectPath.swift in Sources */,
4106+
6C9619222C3F27F1009733CE /* Query.swift in Sources */,
4107+
6C9619202C3F27E3009733CE /* ProjectNavigatorUITests.swift in Sources */,
40624108
);
40634109
runOnlyForDeploymentPostprocessing = 0;
40644110
};
@@ -4234,6 +4280,7 @@
42344280
buildSettings = {
42354281
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
42364282
CLANG_ENABLE_MODULES = YES;
4283+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
42374284
CODE_SIGN_STYLE = Automatic;
42384285
COMBINE_HIDPI_IMAGES = YES;
42394286
CURRENT_PROJECT_VERSION = 38;
@@ -4250,7 +4297,6 @@
42504297
PRODUCT_NAME = "$(TARGET_NAME)";
42514298
PROVISIONING_PROFILE = "";
42524299
SWIFT_EMIT_LOC_STRINGS = NO;
4253-
SWIFT_OBJC_BRIDGING_HEADER = "CodeEditUITests/Features/CodeEditUI/CodeEditUITests-Bridging-Header.h";
42544300
SWIFT_VERSION = 5.0;
42554301
TEST_TARGET_NAME = CodeEdit;
42564302
};
@@ -4425,6 +4471,7 @@
44254471
buildSettings = {
44264472
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
44274473
CLANG_ENABLE_MODULES = YES;
4474+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
44284475
CODE_SIGN_STYLE = Automatic;
44294476
COMBINE_HIDPI_IMAGES = YES;
44304477
CURRENT_PROJECT_VERSION = 38;
@@ -4441,7 +4488,6 @@
44414488
PRODUCT_NAME = "$(TARGET_NAME)";
44424489
PROVISIONING_PROFILE = "";
44434490
SWIFT_EMIT_LOC_STRINGS = NO;
4444-
SWIFT_OBJC_BRIDGING_HEADER = "CodeEditUITests/Features/CodeEditUI/CodeEditUITests-Bridging-Header.h";
44454491
SWIFT_VERSION = 5.0;
44464492
TEST_TARGET_NAME = CodeEdit;
44474493
};
@@ -4684,6 +4730,7 @@
46844730
buildSettings = {
46854731
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
46864732
CLANG_ENABLE_MODULES = YES;
4733+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
46874734
CODE_SIGN_STYLE = Automatic;
46884735
COMBINE_HIDPI_IMAGES = YES;
46894736
CURRENT_PROJECT_VERSION = 38;
@@ -4700,7 +4747,6 @@
47004747
PRODUCT_NAME = "$(TARGET_NAME)";
47014748
PROVISIONING_PROFILE = "";
47024749
SWIFT_EMIT_LOC_STRINGS = NO;
4703-
SWIFT_OBJC_BRIDGING_HEADER = "CodeEditUITests/Features/CodeEditUI/CodeEditUITests-Bridging-Header.h";
47044750
SWIFT_VERSION = 5.0;
47054751
TEST_TARGET_NAME = CodeEdit;
47064752
};
@@ -5010,6 +5056,7 @@
50105056
buildSettings = {
50115057
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
50125058
CLANG_ENABLE_MODULES = YES;
5059+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
50135060
CODE_SIGN_STYLE = Automatic;
50145061
COMBINE_HIDPI_IMAGES = YES;
50155062
CURRENT_PROJECT_VERSION = 38;
@@ -5026,7 +5073,6 @@
50265073
PRODUCT_NAME = "$(TARGET_NAME)";
50275074
PROVISIONING_PROFILE = "";
50285075
SWIFT_EMIT_LOC_STRINGS = NO;
5029-
SWIFT_OBJC_BRIDGING_HEADER = "CodeEditUITests/Features/CodeEditUI/CodeEditUITests-Bridging-Header.h";
50305076
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
50315077
SWIFT_VERSION = 5.0;
50325078
TEST_TARGET_NAME = CodeEdit;
@@ -5039,6 +5085,7 @@
50395085
buildSettings = {
50405086
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
50415087
CLANG_ENABLE_MODULES = YES;
5088+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
50425089
CODE_SIGN_STYLE = Automatic;
50435090
COMBINE_HIDPI_IMAGES = YES;
50445091
CURRENT_PROJECT_VERSION = 38;
@@ -5055,7 +5102,6 @@
50555102
PRODUCT_NAME = "$(TARGET_NAME)";
50565103
PROVISIONING_PROFILE = "";
50575104
SWIFT_EMIT_LOC_STRINGS = NO;
5058-
SWIFT_OBJC_BRIDGING_HEADER = "CodeEditUITests/Features/CodeEditUI/CodeEditUITests-Bridging-Header.h";
50595105
SWIFT_VERSION = 5.0;
50605106
TEST_TARGET_NAME = CodeEdit;
50615107
};

CodeEdit.xcodeproj/xcshareddata/xcschemes/CodeEdit.xcscheme

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
33
LastUpgradeVersion = "1540"
4-
version = "1.3">
4+
version = "1.7">
55
<BuildAction
66
parallelizeBuildables = "YES"
77
buildImplicitDependencies = "YES">
@@ -27,6 +27,12 @@
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
2929
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<TestPlans>
31+
<TestPlanReference
32+
reference = "container:CodeEditTestPlan.xctestplan"
33+
default = "YES">
34+
</TestPlanReference>
35+
</TestPlans>
3036
<Testables>
3137
<TestableReference
3238
skipped = "NO">
@@ -100,6 +106,16 @@
100106
</Test>
101107
</SkippedTests>
102108
</TestableReference>
109+
<TestableReference
110+
skipped = "NO">
111+
<BuildableReference
112+
BuildableIdentifier = "primary"
113+
BlueprintIdentifier = "B658FB4627DA9E1000EA4DBD"
114+
BuildableName = "CodeEditUITests.xctest"
115+
BlueprintName = "CodeEditUITests"
116+
ReferencedContainer = "container:CodeEdit.xcodeproj">
117+
</BuildableReference>
118+
</TestableReference>
103119
</Testables>
104120
</TestAction>
105121
<LaunchAction

CodeEdit/Features/CodeEditUI/Views/AreaTabBar.swift

+9-9
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ protocol AreaTab: View, Identifiable, Hashable {
1313
}
1414

1515
struct AreaTabBar<Tab: AreaTab>: View {
16-
@Environment(\.controlActiveState)
17-
private var activeState
18-
1916
@Binding var items: [Tab]
2017
@Binding var selection: Tab?
2118

@@ -78,14 +75,14 @@ struct AreaTabBar<Tab: AreaTab>: View {
7875
? AnyLayout(HStackLayout(spacing: 0))
7976
: AnyLayout(VStackLayout(spacing: 0))
8077
layout {
81-
ForEach(items) { icon in
82-
makeIcon(tab: icon, size: size)
78+
ForEach(items) { tab in
79+
makeIcon(tab: tab, size: size)
8380
.offset(
84-
x: (position == .top) ? (tabOffsets[icon] ?? 0) : 0,
85-
y: (position == .side) ? (tabOffsets[icon] ?? 0) : 0
81+
x: (position == .top) ? (tabOffsets[tab] ?? 0) : 0,
82+
y: (position == .side) ? (tabOffsets[tab] ?? 0) : 0
8683
)
87-
.background(makeTabItemGeometryReader(tab: icon))
88-
.simultaneousGesture(makeAreaTabDragGesture(tab: icon))
84+
.background(makeTabItemGeometryReader(tab: tab))
85+
.simultaneousGesture(makeAreaTabDragGesture(tab: tab))
8986
}
9087
if position == .side {
9188
Spacer()
@@ -115,6 +112,9 @@ struct AreaTabBar<Tab: AreaTab>: View {
115112
)
116113
)
117114
)
115+
.focusable(false)
116+
.accessibilityIdentifier("TabAreaTab-\(tab.title)")
117+
.accessibilityLabel(tab.title)
118118
}
119119

120120
private func makeAreaTabDragGesture(tab: Tab) -> some Gesture {

CodeEdit/Features/Editor/TabBar/Tabs/Tab/EditorFileTabCloseButton.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ struct EditorFileTabCloseButton: View {
1616
var closeAction: () -> Void
1717
@Binding var closeButtonGestureActive: Bool
1818
var item: CEWorkspaceFile
19+
@Binding var isHoveringClose: Bool
1920

2021
@State private var isDocumentEdited: Bool = false
2122
@State private var id: Int = 0
@@ -27,7 +28,8 @@ struct EditorFileTabCloseButton: View {
2728
isDragging: isDragging,
2829
closeAction: closeAction,
2930
closeButtonGestureActive: $closeButtonGestureActive,
30-
isDocumentEdited: isDocumentEdited
31+
isDocumentEdited: isDocumentEdited,
32+
isHoveringClose: $isHoveringClose
3133
)
3234
.id(id)
3335
// Detects if file document changed, when this view created item.fileDocument is nil

CodeEdit/Features/Editor/TabBar/Tabs/Tab/EditorTabBackground.swift

+33-27
Original file line numberDiff line numberDiff line change
@@ -27,36 +27,42 @@ struct EditorTabBackground: View {
2727

2828
var body: some View {
2929
ZStack {
30-
// Content background (visible if active)
31-
EffectView(.contentBackground)
32-
.opacity(isActive ? 1 : 0)
30+
if isActive {
31+
// Content background (visible if active)
32+
EffectView(.contentBackground)
33+
.opacity(isActive ? 1 : 0)
3334

34-
// Accent color (visible if active)
35-
Color(.controlAccentColor)
36-
.hueRotation(.degrees(-5))
37-
.opacity(
38-
isActive
39-
? colorScheme == .dark
40-
? activeState == .inactive ? 0.22 : inHoldingState ? 0.33 : 0.26
41-
: activeState == .inactive ? 0.1 : inHoldingState ? 0.27 : 0.2
42-
: 0
43-
)
44-
.saturation(isActiveEditor ? 1.0 : 0.0)
35+
// Accent color (visible if active)
36+
Color(.controlAccentColor)
37+
.hueRotation(.degrees(-5))
38+
.opacity(
39+
colorScheme == .dark
40+
? activeState == .inactive ? 0.22 : inHoldingState ? 0.33 : 0.26
41+
: activeState == .inactive ? 0.1 : inHoldingState ? 0.27 : 0.2
42+
)
43+
.saturation(isActiveEditor ? 1.0 : 0.0)
44+
}
4545

46-
// Highlight (if in dark mode)
47-
Color(.white)
48-
.blendMode(.plusLighter)
49-
.opacity(
50-
colorScheme == .dark
51-
? isActive
52-
? activeState == .inactive ? 0.04 : inHoldingState ? 0.14 : 0.09
53-
: isPressing ? 0.05 : 0
54-
: 0
55-
)
46+
if colorScheme == .dark {
47+
// Highlight (if in dark mode)
48+
Color(.white)
49+
.blendMode(.plusLighter)
50+
.opacity(
51+
isActive
52+
? activeState == .inactive ? 0.04 : inHoldingState ? 0.14 : 0.09
53+
: isPressing ? 0.05 : 0
54+
)
55+
}
5656

57-
// Dragging color (if not active)
58-
Color(.unemphasizedSelectedTextBackgroundColor)
59-
.opacity(isDragging && !isActive ? 0.85 : 0)
57+
if isDragging && !isActive {
58+
// Dragging color (if not active)
59+
Color(.unemphasizedSelectedTextBackgroundColor)
60+
.opacity(0.85)
61+
}
62+
63+
if !isActive && isPressing {
64+
Color(.unemphasizedSelectedTextBackgroundColor)
65+
}
6066
}
6167
}
6268
}

0 commit comments

Comments
 (0)