@onekeyfe/react-native-native-list 6.8.0-4 → 6.8.0-6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -135,11 +135,17 @@ final class NativeListLifecycleTests: XCTestCase {
|
|
|
135
135
|
window.rootViewController = controller
|
|
136
136
|
controller.view.addSubview(view)
|
|
137
137
|
window.isHidden = false
|
|
138
|
-
defer { window.isHidden = true }
|
|
139
138
|
window.layoutIfNeeded()
|
|
140
139
|
view.layoutIfNeeded()
|
|
141
140
|
drainMainQueue()
|
|
142
141
|
let list = try XCTUnwrap(view.subviews.compactMap { $0 as? UICollectionView }.first)
|
|
142
|
+
defer {
|
|
143
|
+
list.setContentOffset(list.contentOffset, animated: false)
|
|
144
|
+
view.dispose()
|
|
145
|
+
view.removeFromSuperview()
|
|
146
|
+
window.isHidden = true
|
|
147
|
+
window.rootViewController = nil
|
|
148
|
+
}
|
|
143
149
|
XCTAssertNotNil(view.window)
|
|
144
150
|
XCTAssertGreaterThan(list.contentSize.height - list.bounds.height +
|
|
145
151
|
list.adjustedContentInset.top + list.adjustedContentInset.bottom, 800)
|
|
@@ -1620,7 +1626,7 @@ final class NativeListLifecycleTests: XCTestCase {
|
|
|
1620
1626
|
view.layoutIfNeeded()
|
|
1621
1627
|
list.layoutIfNeeded()
|
|
1622
1628
|
} completion: { _ in finished.fulfill() }
|
|
1623
|
-
wait(for: [finished], timeout:
|
|
1629
|
+
wait(for: [finished], timeout: 5)
|
|
1624
1630
|
try check(phase, count: count, width: 700)
|
|
1625
1631
|
waitForStructuralFrames(0.1)
|
|
1626
1632
|
try check("\(phase) stable", count: count, width: 700)
|
|
@@ -1677,9 +1683,12 @@ final class NativeListLifecycleTests: XCTestCase {
|
|
|
1677
1683
|
XCTAssertEqual(list.contentOffset.y, testCase.offset, accuracy: 1, testCase.name)
|
|
1678
1684
|
|
|
1679
1685
|
view.applySnapshotJson(try structuralRowsSnapshot(count: 25, transitionID: testCase.name))
|
|
1680
|
-
let
|
|
1681
|
-
|
|
1682
|
-
|
|
1686
|
+
let settleDeadline = Date().addingTimeInterval(5)
|
|
1687
|
+
while Mirror(reflecting: view).descendant("structuralDisplayLink") as? CADisplayLink != nil,
|
|
1688
|
+
Date() < settleDeadline {
|
|
1689
|
+
RunLoop.main.run(until: Date().addingTimeInterval(0.01))
|
|
1690
|
+
}
|
|
1691
|
+
waitForStructuralFrames(0.05)
|
|
1683
1692
|
list.layoutIfNeeded()
|
|
1684
1693
|
XCTAssertEqual(list.adjustedContentInset, explicitInset, testCase.name)
|
|
1685
1694
|
XCTAssertEqual(list.contentSize.height, testCase.height, accuracy: 1, testCase.name)
|
|
@@ -1801,17 +1810,20 @@ final class NativeListLifecycleTests: XCTestCase {
|
|
|
1801
1810
|
list.contentOffset.y = 900
|
|
1802
1811
|
list.layoutIfNeeded()
|
|
1803
1812
|
|
|
1813
|
+
let flow = try XCTUnwrap(list.collectionViewLayout as? NativeListFlowLayout)
|
|
1804
1814
|
view.applySnapshotJson(try structuralRowsSnapshot(count: 30, generation: 2,
|
|
1805
|
-
transitionID: "expand-first", durationMs:
|
|
1806
|
-
|
|
1815
|
+
transitionID: "expand-first", durationMs: 1200))
|
|
1816
|
+
let expandDeadline = Date().addingTimeInterval(3)
|
|
1817
|
+
while (flow.tailClip?.endY ?? 0) <= 1505 && Date() < expandDeadline {
|
|
1818
|
+
RunLoop.main.run(until: Date().addingTimeInterval(0.01))
|
|
1819
|
+
}
|
|
1807
1820
|
list.contentOffset.y = 1100
|
|
1808
1821
|
list.layoutIfNeeded()
|
|
1809
1822
|
view.applySnapshotJson(try structuralRowsSnapshot(count: 25, generation: 3,
|
|
1810
|
-
transitionID: "collapse-middle", durationMs:
|
|
1823
|
+
transitionID: "collapse-middle", durationMs: 2400))
|
|
1811
1824
|
waitForStructuralFrames(0.08)
|
|
1812
1825
|
list.layoutIfNeeded()
|
|
1813
1826
|
let source = try XCTUnwrap(list.dataSource as? UICollectionViewDiffableDataSource<Int, String>)
|
|
1814
|
-
let flow = try XCTUnwrap(list.collectionViewLayout as? NativeListFlowLayout)
|
|
1815
1827
|
let clip = try XCTUnwrap(flow.tailClip)
|
|
1816
1828
|
let retiring = try XCTUnwrap(list.cellForItem(at: IndexPath(item: 25, section: 0)) as? NativeListRowHost)
|
|
1817
1829
|
XCTAssertGreaterThan(clip.endY, 1500)
|
|
@@ -2129,7 +2141,7 @@ final class NativeListLifecycleTests: XCTestCase {
|
|
|
2129
2141
|
view.applySnapshotJson(try structuralRowsSnapshot(count: 6, generation: 5,
|
|
2130
2142
|
transitionID: "collapse-latest", durationMs: 400,
|
|
2131
2143
|
disclosureExpanded: false))
|
|
2132
|
-
wait(for: [latestSettled], timeout:
|
|
2144
|
+
wait(for: [latestSettled], timeout: 5)
|
|
2133
2145
|
XCTAssertEqual(settlements.map(\.0), ["same-rows", "collapse-latest"])
|
|
2134
2146
|
XCTAssertEqual(settlements.last?.1, "completed")
|
|
2135
2147
|
XCTAssertEqual(settlements.last?.2, false)
|
|
@@ -2321,13 +2333,13 @@ final class NativeListLifecycleTests: XCTestCase {
|
|
|
2321
2333
|
defer { growthProbe.invalidate() }
|
|
2322
2334
|
view.applySnapshotJson(try structuralRowsSnapshot(count: 50, generation: 2,
|
|
2323
2335
|
transitionID: "grow", durationMs: 800, disclosureExpanded: true))
|
|
2324
|
-
wait(for: [growthPhase], timeout:
|
|
2336
|
+
wait(for: [growthPhase], timeout: 5)
|
|
2325
2337
|
guard growthObserved else {
|
|
2326
2338
|
XCTFail("No partial disclosure growth frame observed: \(growthLast)")
|
|
2327
2339
|
return
|
|
2328
2340
|
}
|
|
2329
2341
|
growthProbe.invalidate()
|
|
2330
|
-
wait(for: [growSettled], timeout:
|
|
2342
|
+
wait(for: [growSettled], timeout: 5)
|
|
2331
2343
|
XCTAssertEqual(contentHost.bounds.height, 140, accuracy: 1)
|
|
2332
2344
|
XCTAssertNil(contentHost.layer.mask)
|
|
2333
2345
|
XCTAssertTrue(contentHost.isUserInteractionEnabled)
|
|
@@ -2366,7 +2378,7 @@ final class NativeListLifecycleTests: XCTestCase {
|
|
|
2366
2378
|
defer { collapseProbe.invalidate() }
|
|
2367
2379
|
view.applySnapshotJson(try structuralRowsSnapshot(count: 6, generation: 3,
|
|
2368
2380
|
transitionID: "drag", durationMs: 800, disclosureExpanded: false))
|
|
2369
|
-
wait(for: [collapsePhase], timeout:
|
|
2381
|
+
wait(for: [collapsePhase], timeout: 5)
|
|
2370
2382
|
guard collapseObserved else {
|
|
2371
2383
|
XCTFail("No partial disclosure collapse frame observed: \(collapseLast)")
|
|
2372
2384
|
return
|
|
@@ -2875,8 +2887,8 @@ final class NativeListLifecycleTests: XCTestCase {
|
|
|
2875
2887
|
drainMainQueue()
|
|
2876
2888
|
list.contentOffset.y = 300
|
|
2877
2889
|
list.layoutIfNeeded()
|
|
2878
|
-
view.applySnapshotJson(try structuralRowsSnapshot(count:
|
|
2879
|
-
transitionID: "interrupt-boundary", durationMs:
|
|
2890
|
+
view.applySnapshotJson(try structuralRowsSnapshot(count: 15, generation: 2,
|
|
2891
|
+
transitionID: "interrupt-boundary", durationMs: 2400))
|
|
2880
2892
|
let footerBottomBeforeResize = footer.convert(.zero, to: list).y + 60
|
|
2881
2893
|
view.setContainerSlotHeightsJson("[0,0,80,2200]")
|
|
2882
2894
|
XCTAssertEqual(footer.convert(.zero, to: list).y + 80,
|
|
@@ -2890,7 +2902,7 @@ final class NativeListLifecycleTests: XCTestCase {
|
|
|
2890
2902
|
XCTAssertFalse(footerHost.point(inside: CGPoint(x: 10, y: hiddenTop / 2), with: nil))
|
|
2891
2903
|
XCTAssertTrue(footerHost.point(inside: CGPoint(x: 10, y: hiddenTop + 1), with: nil))
|
|
2892
2904
|
var boundaryCell: NativeListRowHost?
|
|
2893
|
-
let deadline = Date().addingTimeInterval(
|
|
2905
|
+
let deadline = Date().addingTimeInterval(3)
|
|
2894
2906
|
while boundaryCell == nil && Date() < deadline {
|
|
2895
2907
|
if let clip = flow.tailClip {
|
|
2896
2908
|
for case let cell as NativeListRowHost in list.visibleCells {
|
|
@@ -3172,9 +3184,13 @@ final class NativeListLifecycleTests: XCTestCase {
|
|
|
3172
3184
|
}
|
|
3173
3185
|
|
|
3174
3186
|
private func waitForStructuralFrames(_ seconds: TimeInterval) {
|
|
3175
|
-
let
|
|
3176
|
-
|
|
3177
|
-
|
|
3187
|
+
let deadline = Date().addingTimeInterval(seconds)
|
|
3188
|
+
while Date() < deadline {
|
|
3189
|
+
RunLoop.main.run(until: Date().addingTimeInterval(0.01))
|
|
3190
|
+
}
|
|
3191
|
+
for _ in 0..<4 {
|
|
3192
|
+
RunLoop.main.run(until: Date().addingTimeInterval(0.02))
|
|
3193
|
+
}
|
|
3178
3194
|
}
|
|
3179
3195
|
|
|
3180
3196
|
private func labels(in view: UIView) -> [UILabel] {
|
|
@@ -3343,9 +3359,12 @@ final class NativeListLifecycleTests: XCTestCase {
|
|
|
3343
3359
|
}
|
|
3344
3360
|
|
|
3345
3361
|
private func drainMainQueue() {
|
|
3346
|
-
|
|
3347
|
-
DispatchQueue.main.async {
|
|
3348
|
-
|
|
3362
|
+
var drained = false
|
|
3363
|
+
DispatchQueue.main.async { drained = true }
|
|
3364
|
+
let deadline = Date().addingTimeInterval(5)
|
|
3365
|
+
while !drained && Date() < deadline {
|
|
3366
|
+
RunLoop.main.run(until: Date().addingTimeInterval(0.01))
|
|
3367
|
+
}
|
|
3349
3368
|
}
|
|
3350
3369
|
|
|
3351
3370
|
private func footerCell(in view: NativeListView) -> NativeListRowHost? {
|
package/package.json
CHANGED