-
Notifications
You must be signed in to change notification settings - Fork 81
Backlog fixes: menu warnings, OKLCH formatting, Xcode settings, context menu shortcuts #186
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 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e2a8b2e
Fix menu warnings, OKLCH precision, Xcode settings, and context menu …
superhighfives 1539eff
Refactor OKLCH/LAB formatting, add CGFloat utility, and expand contex…
superhighfives a81b72c
Fix menu warnings and add keyboard shortcuts to in-app gear menu
superhighfives 541d11c
Revert menu warning fix and in-app keyboard shortcuts
superhighfives e2323d8
Fix PR review suggestions: Foundation import, Substring conversion, O…
superhighfives 1eb67f8
Use red/green/blue names in toOpenGLString to match file style
superhighfives 57265e2
Fix large tuple violations and clean up swiftlint comments
superhighfives 65e7cfe
Fix all remaining swiftlint violations
superhighfives 0c1d98a
Make HSBComponents and HSLComponents public to match public method re…
superhighfives 157119d
Fix multiline string interpolation compile error in ContentView
superhighfives eab1c36
Add spaces to lab unformatted output and fix closing paren formatting
superhighfives 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 |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import CoreGraphics | ||
|
|
||
| extension CGFloat { | ||
| /// Formats the value with up to `maxDecimalPlaces` decimal places, stripping trailing zeros. | ||
| /// e.g. 0.5000 → "0.5", 0.0000 → "0", 56.78 → "56.78" | ||
| func strippedDecimalString(maxDecimalPlaces: Int) -> String { | ||
| let formatted = String(format: "%.\(maxDecimalPlaces)f", self) | ||
| guard formatted.contains(".") else { return formatted } | ||
| var result = formatted | ||
| while result.hasSuffix("0") { result.removeLast() } | ||
| if result.hasSuffix(".") { result.removeLast() } | ||
| return result | ||
| } | ||
| } | ||
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 |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| @testable import Pika | ||
| import XCTest | ||
|
|
||
| final class CGFloatFormatTests: XCTestCase { | ||
| func test_strippedDecimalString_trailingZerosRemoved() { | ||
| XCTAssertEqual(CGFloat(0.5000).strippedDecimalString(maxDecimalPlaces: 4), "0.5") | ||
| XCTAssertEqual(CGFloat(0.1000).strippedDecimalString(maxDecimalPlaces: 4), "0.1") | ||
| XCTAssertEqual(CGFloat(1.2300).strippedDecimalString(maxDecimalPlaces: 4), "1.23") | ||
| } | ||
|
|
||
| func test_strippedDecimalString_allZerosAfterDecimalRemoved() { | ||
| XCTAssertEqual(CGFloat(0.0000).strippedDecimalString(maxDecimalPlaces: 4), "0") | ||
| XCTAssertEqual(CGFloat(1.0000).strippedDecimalString(maxDecimalPlaces: 4), "1") | ||
| XCTAssertEqual(CGFloat(50.00).strippedDecimalString(maxDecimalPlaces: 2), "50") | ||
| } | ||
|
|
||
| func test_strippedDecimalString_significantDecimalsPreserved() { | ||
| XCTAssertEqual(CGFloat(0.1234).strippedDecimalString(maxDecimalPlaces: 4), "0.1234") | ||
| XCTAssertEqual(CGFloat(56.78).strippedDecimalString(maxDecimalPlaces: 2), "56.78") | ||
| } | ||
|
|
||
| func test_strippedDecimalString_respectsMaxDecimalPlaces() { | ||
| // Should not show more than maxDecimalPlaces significant digits | ||
| XCTAssertEqual(CGFloat(0.12345).strippedDecimalString(maxDecimalPlaces: 3), "0.123") | ||
| } | ||
|
|
||
| func test_strippedDecimalString_negativeValues() { | ||
| XCTAssertEqual(CGFloat(-1.5000).strippedDecimalString(maxDecimalPlaces: 4), "-1.5") | ||
| XCTAssertEqual(CGFloat(-12.3400).strippedDecimalString(maxDecimalPlaces: 4), "-12.34") | ||
| } | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.