Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are warnings only with Xcode 15. Bit odd that they show up given that Cocoa is there. Perhaps a b1 issue only?


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, *)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two availability attributes are the only ones truly required to fix the build with Xcode 15.

@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.