集成 MJRefresh 并重构主 TabBar 为系统 TabView 样式。
新增 SwiftUI 桥接层与单元测试,更新 Tab 图标资源命名和多倍图,同步调整 UI Test 的 Tab/扫码定位逻辑。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
38
suixinkanTests/MJRefreshSupportTests.swift
Normal file
38
suixinkanTests/MJRefreshSupportTests.swift
Normal file
@ -0,0 +1,38 @@
|
||||
//
|
||||
// MJRefreshSupportTests.swift
|
||||
// suixinkanTests
|
||||
//
|
||||
// Created by Codex on 2026/6/26.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import suixinkan
|
||||
|
||||
/// MJRefresh SwiftUI 桥接测试,覆盖滚动视图查找辅助逻辑。
|
||||
final class MJRefreshSupportTests: XCTestCase {
|
||||
/// 测试锚点视图能向上找到最近的 UIScrollView。
|
||||
func testEnclosingScrollViewFindsParentScrollView() {
|
||||
let scrollView = UIScrollView(frame: CGRect(x: 0, y: 0, width: 320, height: 480))
|
||||
let container = UIView(frame: scrollView.bounds)
|
||||
let anchor = UIView(frame: .zero)
|
||||
scrollView.addSubview(container)
|
||||
container.addSubview(anchor)
|
||||
|
||||
XCTAssertIdentical(anchor.enclosingScrollView, scrollView)
|
||||
}
|
||||
|
||||
/// 测试没有父级 ScrollView 时返回 nil。
|
||||
func testEnclosingScrollViewReturnsNilWithoutScrollView() {
|
||||
let view = UIView(frame: .zero)
|
||||
XCTAssertNil(view.enclosingScrollView)
|
||||
}
|
||||
}
|
||||
|
||||
extension MJRefreshSupportTests {
|
||||
/// 断言两个对象引用相同。
|
||||
fileprivate func XCTAssertIdentical(_ expression1: AnyObject?, _ expression2: AnyObject?, file: StaticString = #filePath, line: UInt = #line) {
|
||||
if expression1 !== expression2 {
|
||||
XCTFail("Expected identical objects", file: file, line: line)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user