Skip to content

Commit

Permalink
Support for xcode 15b1 (pointfreeco#737)
Browse files Browse the repository at this point in the history
* Fix compile errors with Xcode-15.0b1

* Fix warnings

* Update snapshots

* wip

---------

Co-authored-by: Stephen Celis <[email protected]>
  • Loading branch information
finestructure and stephencelis authored Jun 15, 2023
1 parent f5489a2 commit dc46eeb
Show file tree
Hide file tree
Showing 18 changed files with 13 additions and 21 deletions.
2 changes: 2 additions & 0 deletions Sources/SnapshotTesting/Snapshotting/CALayer.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#if os(macOS)
import AppKit
import Cocoa
import QuartzCore

extension Snapshotting where Value == CALayer, Format == NSImage {
/// A snapshot strategy for comparing layers based on pixel equality.
Expand Down
2 changes: 2 additions & 0 deletions Sources/SnapshotTesting/Snapshotting/CGPath.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#if os(macOS)
import AppKit
import Cocoa
import CoreGraphics

extension Snapshotting where Value == CGPath, Format == NSImage {
/// A snapshot strategy for comparing bezier paths based on pixel equality.
Expand Down
3 changes: 3 additions & 0 deletions Sources/SnapshotTesting/Snapshotting/NSBezierPath.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#if os(macOS)
import AppKit
import Cocoa

extension Snapshotting where Value == NSBezierPath, Format == NSImage {
Expand Down Expand Up @@ -30,6 +31,7 @@ extension Snapshotting where Value == NSBezierPath, Format == NSImage {

extension Snapshotting where Value == NSBezierPath, Format == String {
/// A snapshot strategy for comparing bezier paths based on pixel equality.
@available(macOS 11.0, *)
@available(iOS 11.0, *)
public static var elementsDescription: Snapshotting {
return .elementsDescription(numberFormatter: defaultNumberFormatter)
Expand All @@ -38,6 +40,7 @@ extension Snapshotting where Value == NSBezierPath, Format == String {
/// A snapshot strategy for comparing bezier paths based on pixel equality.
///
/// - Parameter numberFormatter: The number formatter used for formatting points.
@available(macOS 11.0, *)
@available(iOS 11.0, *)
public static func elementsDescription(numberFormatter: NumberFormatter) -> Snapshotting {
let namesByType: [NSBezierPath.ElementType: String] = [
Expand Down
1 change: 1 addition & 0 deletions Sources/SnapshotTesting/Snapshotting/NSView.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#if os(macOS)
import AppKit
import Cocoa

extension Snapshotting where Value == NSView, Format == NSImage {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#if os(macOS)
import AppKit
import Cocoa

extension Snapshotting where Value == NSViewController, Format == NSImage {
Expand Down
19 changes: 1 addition & 18 deletions Tests/SnapshotTestingTests/SnapshotTestingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1127,24 +1127,6 @@ final class SnapshotTestingTests: XCTestCase {
_ = manipulatingWKWebViewNavigationDelegate
}

#if os(iOS) || os(macOS)
func testWebViewWithRealUrl() throws {
let manipulatingWKWebViewNavigationDelegate = ManipulatingWKWebViewNavigationDelegate()
let webView = WKWebView()
webView.navigationDelegate = manipulatingWKWebViewNavigationDelegate

webView.load(URLRequest(url: URL(string: "https://www.pointfree.co")!))
if !ProcessInfo.processInfo.environment.keys.contains("GITHUB_WORKFLOW") {
assertSnapshot(
matching: webView,
as: .image(size: .init(width: 800, height: 600)),
named: platform
)
}
_ = manipulatingWKWebViewNavigationDelegate
}
#endif

final class CancellingWKWebViewNavigationDelegate: NSObject, WKNavigationDelegate {
func webView(
_ webView: WKWebView,
Expand All @@ -1154,6 +1136,7 @@ final class SnapshotTestingTests: XCTestCase {
decisionHandler(.cancel)
}
}

func testWebViewWithCancellingNavigationDelegate() throws {
let cancellingWKWebViewNavigationDelegate = CancellingWKWebViewNavigationDelegate()
let webView = WKWebView()
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[ AF ! U ] h=--- v=--- NSButton "Push Me" f=(0,0,83,32) b=(-)
[ A ! U ] h=--- v=--- NSButtonBezelView f=(0,0,83,32) b=(-)
[ AF ! U ] h=--- v=--- NSButtonTextField "Push Me" f=(11,7,61,15) b=(-)
[ AF ! wLU ] h=--- v=--- NSButton "Push Me" f=(0,0,83,32) b=(-) => <_NSViewBackingLayer>
[ A ! wLU ] h=--- v=--- NSButtonBezelView f=(0,0,83,32) b=(-) => <_NSViewBackingLayer>
[ AF ! wLU ] h=--- v=--- NSButtonTextField "Push Me" f=(11,7,61,15) b=(-) => <NSTextLayer>
A=autoresizesSubviews, C=canDrawConcurrently, D=needsDisplay, F=flipped, G=gstate, H=hidden (h=by ancestor), L=needsLayout (l=child needsLayout), U=needsUpdateConstraints (u=child needsUpdateConstraints), O=opaque, P=preservesContentDuringLiveResize, S=scaled/rotated, W=wantsLayer (w=ancestor wantsLayer), V=needsVibrancy (v=allowsVibrancy), #=has surface
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.

0 comments on commit dc46eeb

Please sign in to comment.