mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
remove code related to the previous bidi usage implementation of whitespaces for the timestamp label
This commit is contained in:
@@ -55,29 +55,6 @@ struct StringTests {
|
||||
#expect("1️⃣2️⃣3️⃣".asciified() == "123", "The emoji should be converted to ASCII.")
|
||||
}
|
||||
|
||||
@Test
|
||||
func generateBreakableWhitespaceEnd() {
|
||||
var count = 5
|
||||
var result = "\u{2066}" + String(repeating: "\u{2004}", count: count) + "\u{2800}"
|
||||
#expect(String.generateBreakableWhitespaceEnd(whitespaceCount: count, layoutDirection: .leftToRight) == result)
|
||||
|
||||
count = 3
|
||||
result = "\u{2066}" + String(repeating: "\u{2004}", count: count) + "\u{2800}"
|
||||
#expect(String.generateBreakableWhitespaceEnd(whitespaceCount: count, layoutDirection: .leftToRight) == result)
|
||||
|
||||
count = 0
|
||||
result = ""
|
||||
#expect(String.generateBreakableWhitespaceEnd(whitespaceCount: count, layoutDirection: .leftToRight) == result)
|
||||
|
||||
count = 4
|
||||
result = "\u{2067}" + String(repeating: "\u{2004}", count: count) + "\u{2800}"
|
||||
#expect(String.generateBreakableWhitespaceEnd(whitespaceCount: count, layoutDirection: .rightToLeft) == result)
|
||||
|
||||
count = 0
|
||||
result = ""
|
||||
#expect(String.generateBreakableWhitespaceEnd(whitespaceCount: count, layoutDirection: .rightToLeft) == result)
|
||||
}
|
||||
|
||||
@Test
|
||||
func ellipsizeWorks() {
|
||||
#expect("ellipsize".ellipsize(length: 5) == "ellip…")
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
//
|
||||
// Copyright 2025 Element Creations Ltd.
|
||||
// Copyright 2023-2025 New Vector Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
@testable import ElementX
|
||||
import Foundation
|
||||
import Testing
|
||||
|
||||
struct TextBasedRoomTimelineTests {
|
||||
@Test
|
||||
func textRoomTimelineItemWhitespaceEnd() {
|
||||
let timestamp = Calendar.current.startOfDay(for: .now).addingTimeInterval(60 * 60) // 1:00 am
|
||||
let timelineItem = TextRoomTimelineItem(id: .randomEvent,
|
||||
timestamp: timestamp,
|
||||
isOutgoing: true,
|
||||
isEditable: true,
|
||||
canBeRepliedTo: true,
|
||||
sender: .init(id: UUID().uuidString),
|
||||
content: .init(body: "Test"))
|
||||
#expect(timelineItem.additionalWhitespaces() == timestamp.formattedTime().count + 1)
|
||||
}
|
||||
|
||||
@Test
|
||||
func textRoomTimelineItemWhitespaceEndLonger() {
|
||||
let timestamp = Calendar.current.startOfDay(for: .now).addingTimeInterval(-60) // 11:59 pm
|
||||
let timelineItem = TextRoomTimelineItem(id: .randomEvent,
|
||||
timestamp: timestamp,
|
||||
isOutgoing: true,
|
||||
isEditable: true,
|
||||
canBeRepliedTo: true,
|
||||
sender: .init(id: UUID().uuidString),
|
||||
content: .init(body: "Test"))
|
||||
#expect(timelineItem.additionalWhitespaces() == timestamp.formattedTime().count + 1)
|
||||
}
|
||||
|
||||
@Test
|
||||
func textRoomTimelineItemWhitespaceEndWithEdit() {
|
||||
let timestamp = Date.mock
|
||||
var timelineItem = TextRoomTimelineItem(id: .randomEvent,
|
||||
timestamp: timestamp,
|
||||
isOutgoing: true,
|
||||
isEditable: true,
|
||||
canBeRepliedTo: true,
|
||||
sender: .init(id: UUID().uuidString),
|
||||
content: .init(body: "Test"))
|
||||
timelineItem.properties.isEdited = true
|
||||
let editedCount = L10n.commonEditedSuffix.count
|
||||
#expect(timelineItem.additionalWhitespaces() == timestamp.formattedTime().count + editedCount + 2)
|
||||
}
|
||||
|
||||
@Test
|
||||
func textRoomTimelineItemWhitespaceEndWithEditAndAlert() {
|
||||
let timestamp = Date.mock
|
||||
var timelineItem = TextRoomTimelineItem(id: .randomEvent,
|
||||
timestamp: timestamp,
|
||||
isOutgoing: true,
|
||||
isEditable: true,
|
||||
canBeRepliedTo: true,
|
||||
sender: .init(id: UUID().uuidString),
|
||||
content: .init(body: "Test"))
|
||||
timelineItem.properties.isEdited = true
|
||||
timelineItem.properties.deliveryStatus = .sendingFailed(.unknown)
|
||||
let editedCount = L10n.commonEditedSuffix.count
|
||||
#expect(timelineItem.additionalWhitespaces() == timestamp.formattedTime().count + editedCount + 5)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user