-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/system-cursor
- Loading branch information
Showing
10 changed files
with
187 additions
and
18 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
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
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,15 @@ | ||
// | ||
// CGContextHidden.m | ||
// CodeEditTextViewObjC | ||
// | ||
// Created by Khan Winter on 2/12/24. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
#import "CGContextHidden.h" | ||
|
||
extern void CGContextSetFontSmoothingStyle(CGContextRef, int); | ||
|
||
void ContextSetHiddenSmoothingStyle(CGContextRef context, int style) { | ||
CGContextSetFontSmoothingStyle(context, style); | ||
} |
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,15 @@ | ||
// | ||
// CGContextHidden.h | ||
// CodeEditTextViewObjC | ||
// | ||
// Created by Khan Winter on 2/12/24. | ||
// | ||
|
||
#ifndef CGContextHidden_h | ||
#define CGContextHidden_h | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
void ContextSetHiddenSmoothingStyle(CGContextRef context, int style); | ||
|
||
#endif /* CGContextHidden_h */ |
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,3 @@ | ||
module CodeEditTextViewObjC { | ||
header "CGContextHidden.h" | ||
} |
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,74 @@ | ||
import XCTest | ||
@testable import CodeEditTextView | ||
|
||
// swiftlint:disable all | ||
|
||
class TypesetterTests: XCTestCase { | ||
let limitedLineWidthDisplayData = TextLine.DisplayData(maxWidth: 150, lineHeightMultiplier: 1.0, estimatedLineHeight: 20.0) | ||
let unlimitedLineWidthDisplayData = TextLine.DisplayData(maxWidth: .infinity, lineHeightMultiplier: 1.0, estimatedLineHeight: 20.0) | ||
|
||
func test_LineFeedBreak() { | ||
let typesetter = Typesetter() | ||
typesetter.typeset( | ||
NSAttributedString(string: "testline\n"), | ||
displayData: unlimitedLineWidthDisplayData, | ||
breakStrategy: .word, | ||
markedRanges: nil | ||
) | ||
|
||
XCTAssertEqual(typesetter.lineFragments.count, 1, "Typesetter typeset incorrect number of lines.") | ||
|
||
typesetter.typeset( | ||
NSAttributedString(string: "testline\n"), | ||
displayData: unlimitedLineWidthDisplayData, | ||
breakStrategy: .character, | ||
markedRanges: nil | ||
) | ||
|
||
XCTAssertEqual(typesetter.lineFragments.count, 1, "Typesetter typeset incorrect number of lines.") | ||
} | ||
|
||
func test_carriageReturnBreak() { | ||
let typesetter = Typesetter() | ||
typesetter.typeset( | ||
NSAttributedString(string: "testline\r"), | ||
displayData: unlimitedLineWidthDisplayData, | ||
breakStrategy: .word, | ||
markedRanges: nil | ||
) | ||
|
||
XCTAssertEqual(typesetter.lineFragments.count, 1, "Typesetter typeset incorrect number of lines.") | ||
|
||
typesetter.typeset( | ||
NSAttributedString(string: "testline\r"), | ||
displayData: unlimitedLineWidthDisplayData, | ||
breakStrategy: .character, | ||
markedRanges: nil | ||
) | ||
|
||
XCTAssertEqual(typesetter.lineFragments.count, 1, "Typesetter typeset incorrect number of lines.") | ||
} | ||
|
||
func test_carriageReturnLineFeedBreak() { | ||
let typesetter = Typesetter() | ||
typesetter.typeset( | ||
NSAttributedString(string: "testline\r\n"), | ||
displayData: unlimitedLineWidthDisplayData, | ||
breakStrategy: .word, | ||
markedRanges: nil | ||
) | ||
|
||
XCTAssertEqual(typesetter.lineFragments.count, 1, "Typesetter typeset incorrect number of lines.") | ||
|
||
typesetter.typeset( | ||
NSAttributedString(string: "testline\r\n"), | ||
displayData: unlimitedLineWidthDisplayData, | ||
breakStrategy: .character, | ||
markedRanges: nil | ||
) | ||
|
||
XCTAssertEqual(typesetter.lineFragments.count, 1, "Typesetter typeset incorrect number of lines.") | ||
} | ||
} | ||
|
||
// swiftlint:enable all |