mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
RTL and LTR mixed languages fix for optimal timestamp support (#1055)
* fix * fixed RTL and LTR timestamp for all the cases! also improved the testing * changelog * better and less convoluted solution * Update ElementX/Sources/Screens/RoomScreen/View/Timeline/FormattedBodyText.swift Co-authored-by: Alfonso Grillo <alfogrillo@gmail.com> * pr suggestion and removed prefix in reality it creates more issues than improvements, and is not really needed --------- Co-authored-by: Alfonso Grillo <alfogrillo@gmail.com>
This commit is contained in:
@@ -61,23 +61,23 @@ class StringTests: XCTestCase {
|
||||
|
||||
func testGenerateBreakableWhitespaceEnd() {
|
||||
var count = 5
|
||||
var result = String(repeating: "\u{2004}", count: count) + "\u{2800}"
|
||||
XCTAssertEqual(String.generateBreakableWhitespaceEnd(whitespaceCount: count, isRTL: false), result)
|
||||
var result = "\u{2066}" + String(repeating: "\u{2004}", count: count) + "\u{2800}"
|
||||
XCTAssertEqual(String.generateBreakableWhitespaceEnd(whitespaceCount: count, layoutDirection: .leftToRight), result)
|
||||
|
||||
count = 3
|
||||
result = String(repeating: "\u{2004}", count: count) + "\u{2800}"
|
||||
XCTAssertEqual(String.generateBreakableWhitespaceEnd(whitespaceCount: count, isRTL: false), result)
|
||||
result = "\u{2066}" + String(repeating: "\u{2004}", count: count) + "\u{2800}"
|
||||
XCTAssertEqual(String.generateBreakableWhitespaceEnd(whitespaceCount: count, layoutDirection: .leftToRight), result)
|
||||
|
||||
count = 0
|
||||
result = ""
|
||||
XCTAssertEqual(String.generateBreakableWhitespaceEnd(whitespaceCount: count, isRTL: false), result)
|
||||
XCTAssertEqual(String.generateBreakableWhitespaceEnd(whitespaceCount: count, layoutDirection: .leftToRight), result)
|
||||
|
||||
count = 4
|
||||
result = "\u{202e}" + String(repeating: "\u{2004}", count: count) + "\u{2800}"
|
||||
XCTAssertEqual(String.generateBreakableWhitespaceEnd(whitespaceCount: count, isRTL: true), result)
|
||||
result = "\u{2067}" + String(repeating: "\u{2004}", count: count) + "\u{2800}"
|
||||
XCTAssertEqual(String.generateBreakableWhitespaceEnd(whitespaceCount: count, layoutDirection: .rightToLeft), result)
|
||||
|
||||
count = 0
|
||||
result = ""
|
||||
XCTAssertEqual(String.generateBreakableWhitespaceEnd(whitespaceCount: count, isRTL: true), result)
|
||||
XCTAssertEqual(String.generateBreakableWhitespaceEnd(whitespaceCount: count, layoutDirection: .rightToLeft), result)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user