UI tests updated

This commit is contained in:
Mauro Romito
2026-05-11 19:30:59 +02:00
committed by Mauro
parent 8318198601
commit d60f5d6efb
41 changed files with 86 additions and 83 deletions
@@ -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) {