-
Notifications
You must be signed in to change notification settings - Fork 15
FeatureFormView - UI tests for adding UNA associations, warning resolutions, logging improvements, small bug fix
#1309
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5ba134c
Starter impl. for UNA add test cases
dfeinzimer 8f91b8e
Fix layer for test 13.3
dfeinzimer 04d5a1c
Resolve warnings (consume and log add association result)
dfeinzimer 29f0ffe
Also log eval errors (matches Kotlin)
dfeinzimer 940622e
Match latest test spec revisions
dfeinzimer 16fff19
Improve add association error handling
dfeinzimer e2f9bd5
Call correct addAssociation overload for one terminal
dfeinzimer e30c2ee
Resolve warning
dfeinzimer 7a85bf1
Fix Apollo 1469
dfeinzimer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -15,6 +15,8 @@ | |
| import ArcGIS | ||
| import SwiftUI | ||
|
|
||
| private import os | ||
|
|
||
| extension FeatureFormView { | ||
| /// A view to configure and add a utility network association. | ||
| struct UtilityAssociationCreationView: View { | ||
|
|
@@ -30,7 +32,7 @@ extension FeatureFormView { | |
| /// See also: `includeContentVisibility`. | ||
| @State private var contentIsVisible: Bool = false | ||
| /// How far along an edge the association is located. | ||
| @State private var fractionAlongEdge: Double = 0.5 | ||
| @State private var fractionAlongEdge: Double = 0 | ||
| /// The options for a utility network feature when creating an association. | ||
| @State private var options: UtilityAssociationFeatureOptions? = nil | ||
| /// A Boolean value which indicates when the configured association is being added. | ||
|
|
@@ -82,17 +84,18 @@ extension FeatureFormView { | |
| func addAssociation() async { | ||
| guard let options else { return } | ||
| do { | ||
| let result: UtilityAssociationResult | ||
| if includeContentVisibility { | ||
| try await element.addAssociation(feature: candidate.feature, filter: filter, isContainmentVisible: contentIsVisible) | ||
| result = try await element.addAssociation(feature: candidate.feature, filter: filter, isContainmentVisible: contentIsVisible) | ||
| } else { | ||
| switch (options.isFractionAlongEdgeValid, terminalForFromSide, terminalForToSide) { | ||
| result = switch (options.isFractionAlongEdgeValid, terminalForFromSide, terminalForToSide) { | ||
| case let (true, .some(terminal), .none): | ||
| try await element.addAssociation(feature: candidate.feature, filter: filter, fractionAlongEdge: fractionAlongEdge, terminal: terminal) | ||
| case let (true, .none, .some(terminal)): | ||
| try await element.addAssociation(feature: candidate.feature, filter: filter, fractionAlongEdge: fractionAlongEdge, terminal: terminal) | ||
| case (true, .none, .none): | ||
| try await element.addAssociation(feature: candidate.feature, filter: filter, fractionAlongEdge: fractionAlongEdge) | ||
| case (false, .some, .some): | ||
| case (false, _, _): | ||
| try await element.addAssociation( | ||
| feature: candidate.feature, | ||
| featureTerminal: candidateIsToElement | ||
|
|
@@ -107,6 +110,7 @@ extension FeatureFormView { | |
| try await element.addAssociation(feature: candidate.feature, filter: filter) | ||
| } | ||
| } | ||
| Logger.featureFormView.info("Association added to \(result.title)") | ||
| // After the association is created, remove the creation | ||
| // workflow views from the navigation path. This includes: | ||
| // 1. UtilityAssociationCreationView | ||
|
|
@@ -120,6 +124,9 @@ extension FeatureFormView { | |
| // views to avoid errors here. (FB20395585) | ||
| // https://developer.apple.com/forums/thread/802221#802221021 | ||
| navigationPath?.wrappedValue.removeLast(4) | ||
| } catch let error as ArcGIS.InvalidArgumentError { | ||
| addAssociationError = .other(error.details) | ||
| alertIsPresented = true | ||
| } catch { | ||
| addAssociationError = .anyError(error) | ||
| alertIsPresented = true | ||
|
|
@@ -243,8 +250,8 @@ extension FeatureFormView { | |
| } label: { | ||
| Text(LocalizedStringResource.fractionAlongEdge) | ||
| } | ||
| Slider(value: $fractionAlongEdge, in: 0...1) { _ in | ||
| LocalizedStringResource.fractionAlongEdge | ||
| Slider(value: $fractionAlongEdge, in: 0...1) { | ||
| Text(LocalizedStringResource.fractionAlongEdge) | ||
|
Comment on lines
+253
to
+254
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolves warning |
||
| } | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix for Apollo 1461.