mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
UI tests updated
This commit is contained in:
@@ -119,11 +119,14 @@ struct MessageText: UIViewRepresentable {
|
||||
let string = attributedText.string as NSString
|
||||
guard string.length > 0 else { return true }
|
||||
|
||||
// Isolate the last paragraph because its direction is what decides
|
||||
// which side the trailing attachment ends up on.
|
||||
let lastParagraphRange = string.paragraphRange(for: NSRange(location: string.length - 1, length: 0))
|
||||
let lastParagraph = string.substring(with: lastParagraphRange)
|
||||
|
||||
let textIsRTL = lastParagraph.firstStrongCharacterIsRTL
|
||||
return textIsRTL == (layoutDirection == .rightToLeft)
|
||||
let layoutIsRTL = layoutDirection == .rightToLeft
|
||||
return textIsRTL == layoutIsRTL
|
||||
}
|
||||
|
||||
func makeUIView(context: Context) -> MessageTextView {
|
||||
|
||||
@@ -127,7 +127,7 @@ struct TimelineItemStyler_Previews: PreviewProvider, TestablePreview {
|
||||
isEditable: false,
|
||||
canBeRepliedTo: true,
|
||||
sender: .test,
|
||||
content: .init(body: "house! -- !באמת -- house!"))
|
||||
content: .init(body: "house! -- באמת! -- house!"))
|
||||
|
||||
static let rtlStringThatContainsLtr = TextRoomTimelineItem(id: .randomEvent,
|
||||
timestamp: .mock,
|
||||
@@ -135,7 +135,7 @@ struct TimelineItemStyler_Previews: PreviewProvider, TestablePreview {
|
||||
isEditable: false,
|
||||
canBeRepliedTo: true,
|
||||
sender: .test,
|
||||
content: .init(body: "באמת! -- !house -- באמת!"))
|
||||
content: .init(body: "באמת! -- house! -- באמת!"))
|
||||
|
||||
static let ltrStringThatFinishesInRtl = TextRoomTimelineItem(id: .randomEvent,
|
||||
timestamp: .mock,
|
||||
@@ -143,7 +143,7 @@ struct TimelineItemStyler_Previews: PreviewProvider, TestablePreview {
|
||||
isEditable: false,
|
||||
canBeRepliedTo: true,
|
||||
sender: .test,
|
||||
content: .init(body: "house! -- !באמת"))
|
||||
content: .init(body: "house! -- באמת!"))
|
||||
|
||||
static let rtlStringThatFinishesInLtr = TextRoomTimelineItem(id: .randomEvent,
|
||||
timestamp: .mock,
|
||||
@@ -151,7 +151,7 @@ struct TimelineItemStyler_Previews: PreviewProvider, TestablePreview {
|
||||
isEditable: false,
|
||||
canBeRepliedTo: true,
|
||||
sender: .test,
|
||||
content: .init(body: "באמת! -- !house"))
|
||||
content: .init(body: "באמת! -- house!"))
|
||||
|
||||
static var testView: some View {
|
||||
VStack(spacing: 0) {
|
||||
|
||||
Reference in New Issue
Block a user