Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lay Foundation For Automation Testing #1804

Merged
merged 5 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 54 additions & 8 deletions CodeEdit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,10 @@
61A53A812B4449F00093BF8A /* WorkspaceDocument+Index.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61A53A802B4449F00093BF8A /* WorkspaceDocument+Index.swift */; };
661EF7B82BEE215300C3E577 /* ImageFileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 661EF7B72BEE215300C3E577 /* ImageFileView.swift */; };
661EF7BD2BEE215300C3E577 /* LoadingFileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 661EF7BC2BEE215300C3E577 /* LoadingFileView.swift */; };
669A50512C380C1800304CD8 /* String+escapedWhiteSpaces.swift in Sources */ = {isa = PBXBuildFile; fileRef = 669A50502C380C1800304CD8 /* String+escapedWhiteSpaces.swift */; };
669A50532C380C8E00304CD8 /* Collection+subscript_safe.swift in Sources */ = {isa = PBXBuildFile; fileRef = 669A50522C380C8E00304CD8 /* Collection+subscript_safe.swift */; };
664935422C35A5BC00461C35 /* NSTableViewWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 664935412C35A5BC00461C35 /* NSTableViewWrapper.swift */; };
6653EE552C34817900B82DE2 /* QuickSearchResultLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6653EE542C34817900B82DE2 /* QuickSearchResultLabel.swift */; };
669A50512C380C1800304CD8 /* String+escapedWhiteSpaces.swift in Sources */ = {isa = PBXBuildFile; fileRef = 669A50502C380C1800304CD8 /* String+escapedWhiteSpaces.swift */; };
669A50532C380C8E00304CD8 /* Collection+subscript_safe.swift in Sources */ = {isa = PBXBuildFile; fileRef = 669A50522C380C8E00304CD8 /* Collection+subscript_safe.swift */; };
669BC4082BED306400D1197C /* AnyFileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 669BC4072BED306400D1197C /* AnyFileView.swift */; };
66AF6CE22BF17CC300D83C9D /* StatusBarViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66AF6CE12BF17CC300D83C9D /* StatusBarViewModel.swift */; };
66AF6CE42BF17F6800D83C9D /* StatusBarFileInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66AF6CE32BF17F6800D83C9D /* StatusBarFileInfoView.swift */; };
Expand Down Expand Up @@ -405,6 +405,9 @@
6C85BB412C21061A00EB5DEF /* GitHubComment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 587B9E3C29301D8F00AC7927 /* GitHubComment.swift */; };
6C85BB442C210EFD00EB5DEF /* SwiftUIIntrospect in Frameworks */ = {isa = PBXBuildFile; productRef = 6C85BB432C210EFD00EB5DEF /* SwiftUIIntrospect */; };
6C91D57229B176FF0059A90D /* EditorManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C91D57129B176FF0059A90D /* EditorManager.swift */; };
6C9619202C3F27E3009733CE /* ProjectNavigatorUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C96191B2C3F27E3009733CE /* ProjectNavigatorUITests.swift */; };
6C9619222C3F27F1009733CE /* Query.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C9619212C3F27F1009733CE /* Query.swift */; };
6C9619242C3F2809009733CE /* ProjectPath.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C9619232C3F2809009733CE /* ProjectPath.swift */; };
6C97EBCC2978760400302F95 /* AcknowledgementsWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C97EBCB2978760400302F95 /* AcknowledgementsWindowController.swift */; };
6CA1AE952B46950000378EAB /* EditorInstance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CA1AE942B46950000378EAB /* EditorInstance.swift */; };
6CAAF68A29BC9C2300A1F48A /* (null) in Sources */ = {isa = PBXBuildFile; };
Expand Down Expand Up @@ -1015,6 +1018,10 @@
6C82D6BB29C00CD900495C54 /* FirstResponderPropertyWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstResponderPropertyWrapper.swift; sourceTree = "<group>"; };
6C82D6C529C012AD00495C54 /* NSApp+openWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSApp+openWindow.swift"; sourceTree = "<group>"; };
6C91D57129B176FF0059A90D /* EditorManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditorManager.swift; sourceTree = "<group>"; };
6C96191B2C3F27E3009733CE /* ProjectNavigatorUITests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProjectNavigatorUITests.swift; sourceTree = "<group>"; };
6C9619212C3F27F1009733CE /* Query.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Query.swift; sourceTree = "<group>"; };
6C9619232C3F2809009733CE /* ProjectPath.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectPath.swift; sourceTree = "<group>"; };
6C9619262C3F285C009733CE /* CodeEditTestPlan.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = CodeEditTestPlan.xctestplan; sourceTree = "<group>"; };
6C97EBCB2978760400302F95 /* AcknowledgementsWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AcknowledgementsWindowController.swift; sourceTree = "<group>"; };
6CA1AE942B46950000378EAB /* EditorInstance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditorInstance.swift; sourceTree = "<group>"; };
6CABB1A029C5593800340467 /* SearchPanelView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchPanelView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1676,8 +1683,8 @@
043C321327E31FF6006AE443 /* CodeEditDocumentController.swift */,
04660F6927E51E5C00477777 /* CodeEditWindowController.swift */,
B6152B7F2ADAE421004C6012 /* CodeEditWindowControllerExtensions.swift */,
4E7F066529602E7B00BB3C12 /* CodeEditSplitViewController.swift */,
0FD96BCD2BEF42530025A697 /* CodeEditWindowController+Toolbar.swift */,
4E7F066529602E7B00BB3C12 /* CodeEditSplitViewController.swift */,
);
path = Controllers;
sourceTree = "<group>";
Expand Down Expand Up @@ -2707,6 +2714,40 @@
path = NSApplication;
sourceTree = "<group>";
};
6C96191C2C3F27E3009733CE /* ProjectNavigator */ = {
isa = PBXGroup;
children = (
6C96191B2C3F27E3009733CE /* ProjectNavigatorUITests.swift */,
);
path = ProjectNavigator;
sourceTree = "<group>";
};
6C96191D2C3F27E3009733CE /* NavigatorArea */ = {
isa = PBXGroup;
children = (
6C96191C2C3F27E3009733CE /* ProjectNavigator */,
);
path = NavigatorArea;
sourceTree = "<group>";
};
6C96191E2C3F27E3009733CE /* Features */ = {
isa = PBXGroup;
children = (
6C96191D2C3F27E3009733CE /* NavigatorArea */,
);
path = Features;
sourceTree = "<group>";
};
6C96191F2C3F27E3009733CE /* CodeEditUITests */ = {
isa = PBXGroup;
children = (
6C9619232C3F2809009733CE /* ProjectPath.swift */,
6C9619212C3F27F1009733CE /* Query.swift */,
6C96191E2C3F27E3009733CE /* Features */,
);
path = CodeEditUITests;
sourceTree = "<group>";
};
6CAAF68F29BCC6F900A1F48A /* WindowCommands */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -2863,10 +2904,12 @@
children = (
B658FB2E27DA9E0F00EA4DBD /* CodeEdit */,
587B60F329340A8000D5CD8F /* CodeEditTests */,
6C96191F2C3F27E3009733CE /* CodeEditUITests */,
28052E0129730F2F00F4F90A /* Configs */,
B6FF04772B6C08AC002C2C78 /* DefaultThemes */,
58F2EACE292FB2B0004A9BDE /* Documentation.docc */,
2BE487ED28245162003F3F64 /* OpenWithCodeEdit */,
6C9619262C3F285C009733CE /* CodeEditTestPlan.xctestplan */,
284DC8502978BA2600BF2770 /* .all-contributorsrc */,
283BDCBC2972EEBD002AFF81 /* Package.resolved */,
B658FB2D27DA9E0F00EA4DBD /* Products */,
Expand Down Expand Up @@ -4059,6 +4102,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6C9619242C3F2809009733CE /* ProjectPath.swift in Sources */,
6C9619222C3F27F1009733CE /* Query.swift in Sources */,
6C9619202C3F27E3009733CE /* ProjectNavigatorUITests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -4234,6 +4280,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 38;
Expand All @@ -4250,7 +4297,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OBJC_BRIDGING_HEADER = "CodeEditUITests/Features/CodeEditUI/CodeEditUITests-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = CodeEdit;
};
Expand Down Expand Up @@ -4425,6 +4471,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 38;
Expand All @@ -4441,7 +4488,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OBJC_BRIDGING_HEADER = "CodeEditUITests/Features/CodeEditUI/CodeEditUITests-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = CodeEdit;
};
Expand Down Expand Up @@ -4684,6 +4730,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 38;
Expand All @@ -4700,7 +4747,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OBJC_BRIDGING_HEADER = "CodeEditUITests/Features/CodeEditUI/CodeEditUITests-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = CodeEdit;
};
Expand Down Expand Up @@ -5010,6 +5056,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 38;
Expand All @@ -5026,7 +5073,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OBJC_BRIDGING_HEADER = "CodeEditUITests/Features/CodeEditUI/CodeEditUITests-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = CodeEdit;
Expand All @@ -5039,6 +5085,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 38;
Expand All @@ -5055,7 +5102,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OBJC_BRIDGING_HEADER = "CodeEditUITests/Features/CodeEditUI/CodeEditUITests-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = CodeEdit;
};
Expand Down
18 changes: 17 additions & 1 deletion CodeEdit.xcodeproj/xcshareddata/xcschemes/CodeEdit.xcscheme
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1540"
version = "1.3">
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
Expand All @@ -27,6 +27,12 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:CodeEditTestPlan.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
<Testables>
<TestableReference
skipped = "NO">
Expand Down Expand Up @@ -100,6 +106,16 @@
</Test>
</SkippedTests>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B658FB4627DA9E1000EA4DBD"
BuildableName = "CodeEditUITests.xctest"
BlueprintName = "CodeEditUITests"
ReferencedContainer = "container:CodeEdit.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
18 changes: 9 additions & 9 deletions CodeEdit/Features/CodeEditUI/Views/AreaTabBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ protocol AreaTab: View, Identifiable, Hashable {
}

struct AreaTabBar<Tab: AreaTab>: View {
@Environment(\.controlActiveState)
private var activeState

@Binding var items: [Tab]
@Binding var selection: Tab?

Expand Down Expand Up @@ -78,14 +75,14 @@ struct AreaTabBar<Tab: AreaTab>: View {
? AnyLayout(HStackLayout(spacing: 0))
: AnyLayout(VStackLayout(spacing: 0))
layout {
ForEach(items) { icon in
makeIcon(tab: icon, size: size)
ForEach(items) { tab in
makeIcon(tab: tab, size: size)
.offset(
x: (position == .top) ? (tabOffsets[icon] ?? 0) : 0,
y: (position == .side) ? (tabOffsets[icon] ?? 0) : 0
x: (position == .top) ? (tabOffsets[tab] ?? 0) : 0,
y: (position == .side) ? (tabOffsets[tab] ?? 0) : 0
)
.background(makeTabItemGeometryReader(tab: icon))
.simultaneousGesture(makeAreaTabDragGesture(tab: icon))
.background(makeTabItemGeometryReader(tab: tab))
.simultaneousGesture(makeAreaTabDragGesture(tab: tab))
}
if position == .side {
Spacer()
Expand Down Expand Up @@ -115,6 +112,9 @@ struct AreaTabBar<Tab: AreaTab>: View {
)
)
)
.focusable(false)
.accessibilityIdentifier("TabAreaTab-\(tab.title)")
.accessibilityLabel(tab.title)
}

private func makeAreaTabDragGesture(tab: Tab) -> some Gesture {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct EditorFileTabCloseButton: View {
var closeAction: () -> Void
@Binding var closeButtonGestureActive: Bool
var item: CEWorkspaceFile
@Binding var isHoveringClose: Bool

@State private var isDocumentEdited: Bool = false
@State private var id: Int = 0
Expand All @@ -27,7 +28,8 @@ struct EditorFileTabCloseButton: View {
isDragging: isDragging,
closeAction: closeAction,
closeButtonGestureActive: $closeButtonGestureActive,
isDocumentEdited: isDocumentEdited
isDocumentEdited: isDocumentEdited,
isHoveringClose: $isHoveringClose
)
.id(id)
// Detects if file document changed, when this view created item.fileDocument is nil
Expand Down
60 changes: 33 additions & 27 deletions CodeEdit/Features/Editor/TabBar/Tabs/Tab/EditorTabBackground.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,42 @@ struct EditorTabBackground: View {

var body: some View {
ZStack {
// Content background (visible if active)
EffectView(.contentBackground)
.opacity(isActive ? 1 : 0)
if isActive {
// Content background (visible if active)
EffectView(.contentBackground)
.opacity(isActive ? 1 : 0)

// Accent color (visible if active)
Color(.controlAccentColor)
.hueRotation(.degrees(-5))
.opacity(
isActive
? colorScheme == .dark
? activeState == .inactive ? 0.22 : inHoldingState ? 0.33 : 0.26
: activeState == .inactive ? 0.1 : inHoldingState ? 0.27 : 0.2
: 0
)
.saturation(isActiveEditor ? 1.0 : 0.0)
// Accent color (visible if active)
Color(.controlAccentColor)
.hueRotation(.degrees(-5))
.opacity(
colorScheme == .dark
? activeState == .inactive ? 0.22 : inHoldingState ? 0.33 : 0.26
: activeState == .inactive ? 0.1 : inHoldingState ? 0.27 : 0.2
)
.saturation(isActiveEditor ? 1.0 : 0.0)
}

// Highlight (if in dark mode)
Color(.white)
.blendMode(.plusLighter)
.opacity(
colorScheme == .dark
? isActive
? activeState == .inactive ? 0.04 : inHoldingState ? 0.14 : 0.09
: isPressing ? 0.05 : 0
: 0
)
if colorScheme == .dark {
// Highlight (if in dark mode)
Color(.white)
.blendMode(.plusLighter)
.opacity(
isActive
? activeState == .inactive ? 0.04 : inHoldingState ? 0.14 : 0.09
: isPressing ? 0.05 : 0
)
}

// Dragging color (if not active)
Color(.unemphasizedSelectedTextBackgroundColor)
.opacity(isDragging && !isActive ? 0.85 : 0)
if isDragging && !isActive {
// Dragging color (if not active)
Color(.unemphasizedSelectedTextBackgroundColor)
.opacity(0.85)
}

if !isActive && isPressing {
Color(.unemphasizedSelectedTextBackgroundColor)
}
}
}
}
Expand Down
Loading
Loading