mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-11-29 08:29:22 +00:00
* Fix composer control overlap at large text sizes At accessibility XXXL, the composer icons outgrew their fixed 36-point frames, causing attachment/send accessibility-bounds overlap in the 280-point Matrix iOS simulator fixture. All six frames used by the attachment, send and microphone controls in ContentComposerView now use a .title2-relative @ScaledMetric with a 36-point default, so their allocations follow the icons' scaling. Automatic regression tests cover iOS composer interactions, selected-language layouts and photo-picker callbacks, plus macOS controls. * Preserve the 36-point minimum for composer controls Keep all six composer control frames at least 36 points while preserving growth at larger Dynamic Type sizes. * Test the composer minimum size and report UI test failures Add extra-small Dynamic Type coverage for 36-point control allocations in both themes using the existing test host. Print assertion errors and failed test cases from the saved runner log, and update the coverage documentation. * Simplify composer sizing regression tests Move the shared frame sizing into a modifier and test icon containment and the 36-point minimum in the existing iOS target. Remove the dedicated composer hosts, runners, model injection and associated package, project and CI changes.
72 lines
2.3 KiB
Swift
72 lines
2.3 KiB
Swift
#if os(iOS)
|
|
import XCTest
|
|
import SwiftUI
|
|
import UIKit
|
|
@testable import bitchat
|
|
|
|
@MainActor
|
|
final class ComposerActionFrameTests: XCTestCase {
|
|
private func measure<V: View>(_ view: V, at size: DynamicTypeSize) -> CGSize {
|
|
let host = UIHostingController(rootView: view.environment(\.dynamicTypeSize, size))
|
|
_ = host.view
|
|
host.view.setNeedsLayout()
|
|
host.view.layoutIfNeeded()
|
|
return host.sizeThatFits(in: CGSize(width: 500, height: 500))
|
|
}
|
|
|
|
func testSizingAcrossDynamicType() {
|
|
for size in DynamicTypeSize.allCases {
|
|
let frame = measure(
|
|
Color.clear.modifier(ComposerActionFrame()),
|
|
at: size
|
|
)
|
|
|
|
XCTAssertGreaterThanOrEqual(frame.width, 36)
|
|
XCTAssertGreaterThanOrEqual(frame.height, 36)
|
|
|
|
if size <= .large {
|
|
XCTAssertEqual(frame.width, 36, accuracy: 0.5)
|
|
XCTAssertEqual(frame.height, 36, accuracy: 0.5)
|
|
}
|
|
|
|
for symbol in [
|
|
"camera.circle.fill",
|
|
"mic.circle.fill",
|
|
"arrow.up.circle.fill"
|
|
] {
|
|
let icon = Image(systemName: symbol)
|
|
.font(.bitchatSystem(size: 24))
|
|
let natural = measure(icon.fixedSize(), at: size)
|
|
let allocation = measure(
|
|
icon.modifier(ComposerActionFrame()),
|
|
at: size
|
|
)
|
|
let context = "\(symbol) at \(size)"
|
|
|
|
XCTAssertGreaterThanOrEqual(
|
|
allocation.width + 0.5,
|
|
natural.width,
|
|
"Frame must contain \(context)"
|
|
)
|
|
XCTAssertGreaterThanOrEqual(
|
|
allocation.height + 0.5,
|
|
natural.height,
|
|
"Frame must contain \(context)"
|
|
)
|
|
|
|
if size == .accessibility5 {
|
|
XCTAssertGreaterThan(
|
|
natural.width, 36,
|
|
"Fixture must exercise an enlarged icon"
|
|
)
|
|
XCTAssertGreaterThan(
|
|
natural.height, 36,
|
|
"Fixture must exercise an enlarged icon"
|
|
)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endif
|