Skip to content

Commit

Permalink
Remove test that relies on deprecated APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
NickEntin committed Aug 29, 2024
1 parent 780f35e commit c3d8e1d
Showing 1 changed file with 0 additions and 47 deletions.
47 changes: 0 additions & 47 deletions ParalayoutTests/PixelRoundingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,6 @@ import XCTest

final class PixelRoundingTests: XCTestCase {

// MARK: - Private Types

@MainActor
private enum Samples {
static let window = UIWindow(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
static let view = UIView()
}

// MARK: - XCTest

override func setUp() async throws {
try await super.setUp()

await Task { @MainActor in
Samples.window.addSubview(Samples.view)
}.value
}

// MARK: - Tests - Pixel Rounding

@MainActor
Expand Down Expand Up @@ -112,33 +94,4 @@ final class PixelRoundingTests: XCTestCase {
)
}

// MARK: - Tests - Scale Factor

@MainActor
func testViewScaleFactor() {
// A view should inherit the scale factor of its parent screen.
for screen in screensToTest() {
Samples.window.screen = screen
XCTAssertEqual(Samples.view.pixelsPerPoint, screen.pixelsPerPoint)
}

// With no superview, the main screen's scale should be used.
Samples.view.removeFromSuperview()
XCTAssert(Samples.view.pixelsPerPoint == UIScreen.main.pixelsPerPoint)
}

// MARK: - Private Methods

@MainActor
private func screensToTest() -> [UIScreen] {
if #available(iOS 13, *) {
// In iOS 13 and later, there is a bug around setting `UIWindow.screen` that prevents us from testing
// multiple screens (FB8674601).
return [.main]

} else {
return TestScreen.all
}
}

}

0 comments on commit c3d8e1d

Please sign in to comment.