mirror of
https://github.com/shadowsocks/ShadowsocksX-NG.git
synced 2026-11-26 15:53:48 +00:00
Bound source metadata and conversion reports to a scrolling region so expansion does not compete with the native table for window constraints. Replace the nested split with a fixed source list and flexible table to keep the rules page inside the main window. Defer native binding writes until after the current view update, merge filter edits into the latest query, and suppress unchanged query and selection publications. Validated with 744 hostless tests, an unsigned Debug build, and isolated native window checks at 920x738 and 920x580, including real source selection and disclosure clicks.
29 lines
1006 B
Swift
29 lines
1006 B
Swift
import XCTest
|
|
|
|
@testable import ShadowsocksX_NG2
|
|
|
|
@MainActor
|
|
final class RulesWorkflowPublicationTests: XCTestCase {
|
|
func testNativeControlsWritingTheSameQueryDoNotRepublishThePage() async {
|
|
let workflow = RulesWorkflow(loadCustom: { [] }, loadBuiltin: { rulesFixture($0) })
|
|
await workflow.refresh()
|
|
workflow.query(RulesQuery(source: .gfwlist))
|
|
var changes = 0
|
|
let observation = workflow.$snapshot.dropFirst().sink { _ in changes += 1 }
|
|
workflow.query(workflow.snapshot.query)
|
|
observation.cancel()
|
|
XCTAssertEqual(changes, 0)
|
|
}
|
|
|
|
func testNativeControlsWritingTheSameVisibleSelectionDoNotRepublishThePage() async {
|
|
let workflow = RulesWorkflow(loadCustom: { [] }, loadBuiltin: { rulesFixture($0) })
|
|
await workflow.refresh()
|
|
workflow.select([.noDotHostname])
|
|
var changes = 0
|
|
let observation = workflow.$snapshot.dropFirst().sink { _ in changes += 1 }
|
|
workflow.select([.noDotHostname])
|
|
observation.cancel()
|
|
XCTAssertEqual(changes, 0)
|
|
}
|
|
}
|