ios: smooth Agent entrances and refresh app icon
TestFlight / Build and upload (push) Successful in 1m49s
TestFlight / Build and upload (push) Successful in 1m49s
Grow row height and spacing with the existing entrance animation, remove the Latest overlay while retaining scroll/read/send behavior, and reuse the current PWA icon artwork. Cover occupied-height interpolation and scroll-to-latest navigation in focused checks.
This commit is contained in:
@@ -7,6 +7,51 @@ import SwiftUI
|
||||
/// not GPU presentation, touch latency, or physical-device frame rate.
|
||||
@MainActor
|
||||
final class AgentPerformanceTests: XCTestCase {
|
||||
func testEntranceGrowsOccupiedHeight() async throws {
|
||||
XCTAssertFalse(UIAccessibility.isReduceMotionEnabled, "This check must exercise the entrance animation")
|
||||
let room = SybilAgentRoom()
|
||||
let rows = (1...3).map { index in
|
||||
Message(id: "entrance-\(index)", createdAt: Date(timeIntervalSince1970: 1_700_000_000),
|
||||
role: .assistant, content: "Existing neighbor \(index)")
|
||||
}
|
||||
try room.receive(.messages(AgentPage(conversationId: "entrance", messages: rows,
|
||||
cursor: "3", beforeCursor: nil, hasMore: false)), replay: true)
|
||||
room.flush()
|
||||
let host = UIHostingController(rootView: SybilAgentView(room: room))
|
||||
let scene = try XCTUnwrap(UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first)
|
||||
let window = UIWindow(windowScene: scene)
|
||||
window.rootViewController = host
|
||||
window.makeKeyAndVisible()
|
||||
defer { window.isHidden = true; window.rootViewController = nil; room.stop() }
|
||||
host.view.frame = window.bounds
|
||||
host.view.layoutIfNeeded()
|
||||
try await Task.sleep(for: .milliseconds(500))
|
||||
func transcript(in view: UIView) -> UIScrollView? {
|
||||
if let scroll = view as? UIScrollView, scroll.contentSize.height > 100 { return scroll }
|
||||
return view.subviews.lazy.compactMap { transcript(in: $0) }.first
|
||||
}
|
||||
let scroll = try XCTUnwrap(transcript(in: host.view))
|
||||
let before = scroll.contentSize.height
|
||||
let reply = Message(id: "entrance-4", createdAt: rows[0].createdAt, role: .assistant,
|
||||
content: "Incoming reply\n\nIts occupied space should grow with the bubble.")
|
||||
try room.receive(.messages(AgentPage(conversationId: "entrance", messages: [reply],
|
||||
cursor: "4", beforeCursor: nil, hasMore: false)))
|
||||
room.flush()
|
||||
var heights: [CGFloat] = []
|
||||
for _ in 0..<32 {
|
||||
try await Task.sleep(for: .milliseconds(16))
|
||||
heights.append(scroll.contentSize.height)
|
||||
}
|
||||
let after = try XCTUnwrap(heights.last)
|
||||
// All four short rows fit onscreen, so these are measured heights, not
|
||||
// estimates for unmaterialized lazy history. No frame-rate claim.
|
||||
XCTAssertLessThan(after, scroll.bounds.height)
|
||||
XCTAssertGreaterThan(after - before, 50)
|
||||
let intermediate = Set(heights.filter { $0 > before + 2 && $0 < after - 2 }.map { Int($0.rounded()) })
|
||||
XCTAssertGreaterThanOrEqual(intermediate.count, 3, "Neighbors must get intermediate layout heights, not a full-height insertion")
|
||||
print("AGENT_ENTRANCE_HEIGHT before=\(before) samples=\(heights)")
|
||||
}
|
||||
|
||||
func testThinkingScrollResponsiveness() async throws {
|
||||
let room = SybilAgentRoom()
|
||||
var rows: [Message] = []
|
||||
|
||||
Reference in New Issue
Block a user