-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SwiftWin32: add
Label.textAlignment
property
Add the missing `textAlignment` property for the partial cases which are trivial to map. This allows for better control over the rendering of the text.
- Loading branch information
Showing
5 changed files
with
70 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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 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 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,16 @@ | ||
// Copyright © 2023 Saleem Abdulrasool <[email protected]> | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
/// Constants that specify text alignment. | ||
public enum TextAlignment: Int { | ||
/// Text uses the default alignment for the current localization of the app. | ||
case natural | ||
/// Text is left-aligned. | ||
case left | ||
/// Text is right-aligned. | ||
case right | ||
/// Text is center-aligned. | ||
case center | ||
/// Text is justified. | ||
case justified | ||
} |
This file contains 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 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,22 @@ | ||
// Copyright © 2023 Saleem Abdulrasool <[email protected]> | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
import XCTest | ||
@testable import SwiftWin32 | ||
|
||
final class LabelTests: XCTestCase { | ||
func testAlignment() { | ||
let label: Label = Label(frame: .zero) | ||
|
||
// FIXME(compnerd) this should be `natural` | ||
XCTAssertEqual(label.textAlignment, .left) | ||
|
||
label.textAlignment = .right | ||
XCTAssertEqual(label.textAlignment, .right) | ||
} | ||
|
||
static var allTests = [ | ||
("testAlignment", testAlignment), | ||
] | ||
} | ||
|