From 324f9fa4fde08b6c29d8c7e13672638e8357fe73 Mon Sep 17 00:00:00 2001 From: Kyle Date: Tue, 10 Mar 2026 23:25:22 +0800 Subject: [PATCH 1/5] Add doc comments for RenderBoxVendor --- Sources/OpenRenderBoxShims/Export.swift | 21 ------------ Sources/OpenRenderBoxShims/Shims.swift | 44 +++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 21 deletions(-) delete mode 100644 Sources/OpenRenderBoxShims/Export.swift create mode 100644 Sources/OpenRenderBoxShims/Shims.swift diff --git a/Sources/OpenRenderBoxShims/Export.swift b/Sources/OpenRenderBoxShims/Export.swift deleted file mode 100644 index 92872ac..0000000 --- a/Sources/OpenRenderBoxShims/Export.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// Export.swift -// OpenRenderBoxShims - -#if OPENRENDERBOX_RENDERBOX -@_exported public import RenderBox -public typealias ORBColor = RBColor -public typealias ORBDevice = RBDevice -public typealias ORBLayer = RBLayer -public typealias ORBLayerDelegate = RBLayerDelegate -public typealias ORBDisplayList = RBDisplayList -public typealias ORBPath = RBPath -public typealias ORBUUID = RBUUID -public typealias ORBAnimation = RBAnimation -public typealias ORBSymbolAnimator = RBSymbolAnimator -public typealias ORBSymbolAnimatorObserver = RBSymbolAnimatorObserver -public let renderBoxEnabled = true -#else -@_exported import OpenRenderBox -public let renderBoxEnabled = false -#endif diff --git a/Sources/OpenRenderBoxShims/Shims.swift b/Sources/OpenRenderBoxShims/Shims.swift new file mode 100644 index 0000000..3225f46 --- /dev/null +++ b/Sources/OpenRenderBoxShims/Shims.swift @@ -0,0 +1,44 @@ +// +// Shims.swift +// OpenRenderBoxShims + +/// A type that identifies the underlying RenderBox implementation vendor. +/// +/// Use ``renderBoxVendor`` to check which vendor is active at runtime. +public struct RenderBoxVendor: RawRepresentable, Hashable, CaseIterable { + public let rawValue: String + + public init(rawValue: String) { + self.rawValue = rawValue + } + + /// OpenRenderBox — the open source implementation by OpenSwiftUIProject. + public static let orb = RenderBoxVendor(rawValue: "org.OpenSwiftUIProject.OpenRenderBox") + + /// Apple's private RenderBox framework. + public static let rb = RenderBoxVendor(rawValue: "com.apple.RenderBox") + + public static var allCases: [RenderBoxVendor] { [.orb, .rb] } +} + +#if OPENRENDERBOX_RENDERBOX +@_exported public import RenderBox + +public let renderBoxVendor = RenderBoxVendor.rb +#else +@_exported import OpenRenderBox + +public typealias RBColor = ORBColor +public typealias RBDevice = ORBDevice +public typealias RBLayer = ORBLayer +public typealias RBLayerDelegate = ORBLayerDelegate +public typealias RBDisplayList = ORBDisplayList +public typealias RBPath = ORBPath +public typealias RBPathApplyCallback = ORBPathApplyCallback +public typealias RBUUID = ORBUUID +public typealias RBAnimation = ORBAnimation +public typealias RBSymbolAnimator = ORBSymbolAnimator +public typealias RBSymbolAnimatorObserver = ORBSymbolAnimatorObserver + +public let renderBoxVendor = RenderBoxVendor.orb +#endif From ab89fea0862a46e2ea1cdef49b2f60cc2a30b1e4 Mon Sep 17 00:00:00 2001 From: Kyle Date: Tue, 10 Mar 2026 23:35:43 +0800 Subject: [PATCH 2/5] Add platform guards for RB typealiases and use RB prefix in compatibility tests --- Sources/OpenRenderBoxShims/Shims.swift | 18 +- .../AnimationTests.swift | 18 +- .../ColorTests.swift | 168 +++++++++--------- .../DeviceTests.swift | 12 +- .../LayerTests.swift | 4 +- .../PathCallbacksTests.swift | 2 +- .../PathStorageTests.swift | 16 +- .../PathTests.swift | 26 +-- .../Shims.swift | 21 ++- .../SymbolAnimatorTests.swift | 10 +- .../UUIDTests.swift | 4 +- 11 files changed, 155 insertions(+), 144 deletions(-) diff --git a/Sources/OpenRenderBoxShims/Shims.swift b/Sources/OpenRenderBoxShims/Shims.swift index 3225f46..72843aa 100644 --- a/Sources/OpenRenderBoxShims/Shims.swift +++ b/Sources/OpenRenderBoxShims/Shims.swift @@ -5,7 +5,7 @@ /// A type that identifies the underlying RenderBox implementation vendor. /// /// Use ``renderBoxVendor`` to check which vendor is active at runtime. -public struct RenderBoxVendor: RawRepresentable, Hashable, CaseIterable { +public struct RenderBoxVendor: RawRepresentable, CaseIterable { public let rawValue: String public init(rawValue: String) { @@ -29,16 +29,22 @@ public let renderBoxVendor = RenderBoxVendor.rb @_exported import OpenRenderBox public typealias RBColor = ORBColor +public typealias RBUUID = ORBUUID +public typealias RBDisplayList = ORBDisplayList +public typealias RBAnimation = ORBAnimation +public typealias RBSymbolAnimator = ORBSymbolAnimator +public typealias RBSymbolAnimatorObserver = ORBSymbolAnimatorObserver + +#if canImport(ObjectiveC) public typealias RBDevice = ORBDevice public typealias RBLayer = ORBLayer public typealias RBLayerDelegate = ORBLayerDelegate -public typealias RBDisplayList = ORBDisplayList +#endif + +#if !OPENRENDERBOX_CF_CGTYPES public typealias RBPath = ORBPath public typealias RBPathApplyCallback = ORBPathApplyCallback -public typealias RBUUID = ORBUUID -public typealias RBAnimation = ORBAnimation -public typealias RBSymbolAnimator = ORBSymbolAnimator -public typealias RBSymbolAnimatorObserver = ORBSymbolAnimatorObserver +#endif public let renderBoxVendor = RenderBoxVendor.orb #endif diff --git a/Tests/OpenRenderBoxCompatibilityTests/AnimationTests.swift b/Tests/OpenRenderBoxCompatibilityTests/AnimationTests.swift index d822f64..3b7ed31 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/AnimationTests.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/AnimationTests.swift @@ -11,7 +11,7 @@ import CoreGraphics struct AnimationTests { @Test func basicAnimation() { - let animation = ORBAnimation() + let animation = RBAnimation() // activeDuration should be 0 for empty animation #expect(animation.activeDuration == 0) @@ -26,21 +26,21 @@ struct AnimationTests { @Test func addBezier() { - let animation = ORBAnimation() + let animation = RBAnimation() animation.addBezierDuration(0.3, controlPoint1: CGPoint(x: 0.42, y: 0), controlPoint2: CGPoint(x: 0.58, y: 1)) #expect(animation.activeDuration > 0) } @Test func addDelay() { - let animation = ORBAnimation() + let animation = RBAnimation() animation.addDelay(0.5) #expect(animation.activeDuration == 0.5) } @Test func addSpeed() { - let animation = ORBAnimation() + let animation = RBAnimation() animation.addBezierDuration(1.0, controlPoint1: .zero, controlPoint2: CGPoint(x: 1, y: 1)) let baseDuration = animation.activeDuration animation.addSpeed(2.0) @@ -49,14 +49,14 @@ struct AnimationTests { @Test func addSpring() { - let animation = ORBAnimation() + let animation = RBAnimation() animation.addSpringDuration(0.5, mass: 1.0, stiffness: 100, damping: 10, initialVelocity: 0) #expect(animation.activeDuration > 0) } @Test func addRepeat() { - let animation = ORBAnimation() + let animation = RBAnimation() animation.addBezierDuration(0.3, controlPoint1: .zero, controlPoint2: CGPoint(x: 1, y: 1)) animation.addRepeatCount(3, autoreverses: true) #expect(animation.activeDuration > 0) @@ -64,16 +64,16 @@ struct AnimationTests { @Test func addPreset() { - let animation = ORBAnimation() + let animation = RBAnimation() animation.addPreset(0, duration: 0.5) #expect(animation.activeDuration > 0) } @Test func copyAndEqual() { - let animation = ORBAnimation() + let animation = RBAnimation() animation.addDelay(0.5) - let copy = animation.copy() as! ORBAnimation + let copy = animation.copy() as! RBAnimation #expect(animation.isEqual(copy)) #expect(copy.activeDuration == animation.activeDuration) } diff --git a/Tests/OpenRenderBoxCompatibilityTests/ColorTests.swift b/Tests/OpenRenderBoxCompatibilityTests/ColorTests.swift index 815308f..5919270 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/ColorTests.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/ColorTests.swift @@ -10,44 +10,44 @@ import CoreGraphics @Suite struct ColorTests { - // MARK: - ORBColorMake + // MARK: - RBColorMake - @Test("ORBColorMake", arguments: [ - (Float(0.0), Float(0.0), Float(0.0), Float(1.0), ORBColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0)), - (Float(1.0), Float(1.0), Float(1.0), Float(1.0), ORBColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)), - (Float(0.5), Float(0.25), Float(0.75), Float(0.8), ORBColor(red: 0.5, green: 0.25, blue: 0.75, alpha: 0.8)), - (Float(0.2), Float(0.4), Float(0.6), Float(0.0), ORBColor(red: 0.2, green: 0.4, blue: 0.6, alpha: 0.0)), + @Test("RBColorMake", arguments: [ + (Float(0.0), Float(0.0), Float(0.0), Float(1.0), RBColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0)), + (Float(1.0), Float(1.0), Float(1.0), Float(1.0), RBColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)), + (Float(0.5), Float(0.25), Float(0.75), Float(0.8), RBColor(red: 0.5, green: 0.25, blue: 0.75, alpha: 0.8)), + (Float(0.2), Float(0.4), Float(0.6), Float(0.0), RBColor(red: 0.2, green: 0.4, blue: 0.6, alpha: 0.0)), ]) - func colorMake(red: Float, green: Float, blue: Float, alpha: Float, expectColor: ORBColor) { - let color = ORBColor(red: red, green: green, blue: blue, alpha: alpha) + func colorMake(red: Float, green: Float, blue: Float, alpha: Float, expectColor: RBColor) { + let color = RBColor(red: red, green: green, blue: blue, alpha: alpha) #expect(color.red == expectColor.red) #expect(color.green == expectColor.green) #expect(color.blue == expectColor.blue) #expect(color.alpha == expectColor.alpha) } - // MARK: - ORBColorMakeLinear + // MARK: - RBColorMakeLinear - @Test("ORBColorMakeLinear", arguments: [ - (Float(0.5), Float(0.25), Float(0.75), Float(1.0), ORBColor(linearRed: 0.5, green: 0.25, blue: 0.75, alpha: 1.0)), - (Float(0.2), Float(0.4), Float(0.6), Float(0.5), ORBColor(linearRed: 0.2, green: 0.4, blue: 0.6, alpha: 0.5)), + @Test("RBColorMakeLinear", arguments: [ + (Float(0.5), Float(0.25), Float(0.75), Float(1.0), RBColor(linearRed: 0.5, green: 0.25, blue: 0.75, alpha: 1.0)), + (Float(0.2), Float(0.4), Float(0.6), Float(0.5), RBColor(linearRed: 0.2, green: 0.4, blue: 0.6, alpha: 0.5)), ]) - func colorMakeLinear(red: Float, green: Float, blue: Float, alpha: Float, expectColor: ORBColor) { - let color = ORBColor(linearRed: red, green: green, blue: blue, alpha: alpha) + func colorMakeLinear(red: Float, green: Float, blue: Float, alpha: Float, expectColor: RBColor) { + let color = RBColor(linearRed: red, green: green, blue: blue, alpha: alpha) #expect(color.red == expectColor.red) #expect(color.green == expectColor.green) #expect(color.blue == expectColor.blue) #expect(color.alpha == expectColor.alpha) } - // MARK: - ORBColorToLinear + // MARK: - RBColorToLinear - @Test("ORBColorToLinear", arguments: [ + @Test("RBColorToLinear", arguments: [ (Float(0.5), Float(0.25), Float(0.75), Float(0.8)), (Float(0.3), Float(0.6), Float(0.9), Float(1.0)), ]) func colorToLinear(red: Float, green: Float, blue: Float, alpha: Float) { - let srgbColor = ORBColor(red: red, green: green, blue: blue, alpha: alpha) + let srgbColor = RBColor(red: red, green: green, blue: blue, alpha: alpha) let linearColor = srgbColor.linear #expect(linearColor.alpha == srgbColor.alpha) #expect(!linearColor.red.isApproximatelyEqual(to: srgbColor.red)) @@ -55,14 +55,14 @@ struct ColorTests { #expect(!linearColor.blue.isApproximatelyEqual(to: srgbColor.blue)) } - // MARK: - ORBColorFromLinear + // MARK: - RBColorFromLinear - @Test("ORBColorFromLinear", arguments: [ + @Test("RBColorFromLinear", arguments: [ (Float(0.2), Float(0.1), Float(0.5), Float(0.9)), (Float(0.05), Float(0.15), Float(0.25), Float(1.0)), ]) func colorFromLinear(red: Float, green: Float, blue: Float, alpha: Float) { - let linearColor = ORBColor(red: red, green: green, blue: blue, alpha: alpha) + let linearColor = RBColor(red: red, green: green, blue: blue, alpha: alpha) let srgbColor = linearColor.fromLinear() #expect(srgbColor.alpha == linearColor.alpha) #expect(!srgbColor.red.isApproximatelyEqual(to: linearColor.red)) @@ -72,14 +72,14 @@ struct ColorTests { // MARK: - Round Trip (toLinear -> fromLinear) - @Test("ORBColor Round Trip", arguments: [ + @Test("RBColor Round Trip", arguments: [ (Float(0.5), Float(0.25), Float(0.75), Float(1.0)), (Float(0.0), Float(0.0), Float(0.0), Float(1.0)), (Float(1.0), Float(1.0), Float(1.0), Float(0.5)), (Float(0.3), Float(0.6), Float(0.9), Float(0.8)), ]) func colorRoundTrip(red: Float, green: Float, blue: Float, alpha: Float) { - let originalColor = ORBColor(red: red, green: green, blue: blue, alpha: alpha) + let originalColor = RBColor(red: red, green: green, blue: blue, alpha: alpha) let linearColor = originalColor.linear let roundTripColor = linearColor.fromLinear() @@ -89,58 +89,58 @@ struct ColorTests { #expect(roundTripColor.alpha == originalColor.alpha) } - // MARK: - ORBColorEqualToColor + // MARK: - RBColorEqualToColor - @Test("ORBColorEqualToColor - equal") + @Test("RBColorEqualToColor - equal") func colorEqualToColor_equal() { - let color1 = ORBColor(red: 0.5, green: 0.25, blue: 0.75, alpha: 1.0) - let color2 = ORBColor(red: 0.5, green: 0.25, blue: 0.75, alpha: 1.0) + let color1 = RBColor(red: 0.5, green: 0.25, blue: 0.75, alpha: 1.0) + let color2 = RBColor(red: 0.5, green: 0.25, blue: 0.75, alpha: 1.0) #expect(color1.isEqual(to: color2)) } - @Test("ORBColorEqualToColor - not equal", arguments: [ + @Test("RBColorEqualToColor - not equal", arguments: [ (Float(0.6), Float(0.25), Float(0.75), Float(1.0)), (Float(0.5), Float(0.35), Float(0.75), Float(1.0)), (Float(0.5), Float(0.25), Float(0.85), Float(1.0)), (Float(0.5), Float(0.25), Float(0.75), Float(0.5)), ]) func colorEqualToColor_notEqual(r2: Float, g2: Float, b2: Float, a2: Float) { - let color1 = ORBColor(red: 0.5, green: 0.25, blue: 0.75, alpha: 1.0) - let color2 = ORBColor(red: r2, green: g2, blue: b2, alpha: a2) + let color1 = RBColor(red: 0.5, green: 0.25, blue: 0.75, alpha: 1.0) + let color2 = RBColor(red: r2, green: g2, blue: b2, alpha: a2) #expect(!color1.isEqual(to: color2)) } // MARK: - Color Constants - @Test("ORBColor Constant", arguments: [ - (ORBColor.clear, Float(0.0), Float(0.0), Float(0.0), Float(0.0)), - (ORBColor.black, Float(0.0), Float(0.0), Float(0.0), Float(1.0)), - (ORBColor.white, Float(1.0), Float(1.0), Float(1.0), Float(1.0)), - (ORBColor.null, Float(-32768.0), Float(-32768.0), Float(-32768.0), Float(-32768.0)), + @Test("RBColor Constant", arguments: [ + (RBColor.clear, Float(0.0), Float(0.0), Float(0.0), Float(0.0)), + (RBColor.black, Float(0.0), Float(0.0), Float(0.0), Float(1.0)), + (RBColor.white, Float(1.0), Float(1.0), Float(1.0), Float(1.0)), + (RBColor.null, Float(-32768.0), Float(-32768.0), Float(-32768.0), Float(-32768.0)), ]) - func constant(_ color: ORBColor, expectedRed: Float, expectedGreen: Float, expectedBlue: Float, expectedAlpha: Float) { + func constant(_ color: RBColor, expectedRed: Float, expectedGreen: Float, expectedBlue: Float, expectedAlpha: Float) { #expect(color.red.isApproximatelyEqual(to: expectedRed)) #expect(color.green.isApproximatelyEqual(to: expectedGreen)) #expect(color.blue.isApproximatelyEqual(to: expectedBlue)) #expect(color.alpha.isApproximatelyEqual(to: expectedAlpha)) } - @Test("ORBColorInvalidComponent") + @Test("RBColorInvalidComponent") func colorInvalidComponent() { - let value = ORBColor.invalidComponent + let value = RBColor.invalidComponent #expect(value.isApproximatelyEqual(to: -32768.0)) } - // MARK: - ORBColorCopyCGColor + // MARK: - RBColorCopyCGColor #if canImport(CoreGraphics) - @Test("ORBColorCopyCGColor", arguments: [ - (ORBColor(red: 1.0, green: 0.0, blue: 0.0, alpha: 1.0), ORBColor.ColorSpace.SRGB), - (ORBColor(red: 0.0, green: 1.0, blue: 0.0, alpha: 1.0), ORBColor.ColorSpace.linearSRGB), - (ORBColor(red: 0.0, green: 0.0, blue: 1.0, alpha: 0.5), ORBColor.ColorSpace.displayP3), - (ORBColor(red: 0.5, green: 0.5, blue: 0.5, alpha: 1.0), ORBColor.ColorSpace.linearDisplayP3), + @Test("RBColorCopyCGColor", arguments: [ + (RBColor(red: 1.0, green: 0.0, blue: 0.0, alpha: 1.0), RBColor.ColorSpace.SRGB), + (RBColor(red: 0.0, green: 1.0, blue: 0.0, alpha: 1.0), RBColor.ColorSpace.linearSRGB), + (RBColor(red: 0.0, green: 0.0, blue: 1.0, alpha: 0.5), RBColor.ColorSpace.displayP3), + (RBColor(red: 0.5, green: 0.5, blue: 0.5, alpha: 1.0), RBColor.ColorSpace.linearDisplayP3), ]) - func colorCopyCGColor(color: ORBColor, colorSpace: ORBColor.ColorSpace) throws { + func colorCopyCGColor(color: RBColor, colorSpace: RBColor.ColorSpace) throws { let cgColor = try #require(color.cgColor(colorSpace: colorSpace)) #expect(cgColor.numberOfComponents == 4) let components = cgColor.components! @@ -154,51 +154,51 @@ struct ColorTests { #if compiler(>=6.2) // old Xcode version swift-testing bug @Suite struct ColorModeTests { - // MARK: - ORBColorModeWorkingColorSpace - - @Test("ORBColorModeWorkingColorSpace", arguments: [ - (ORBColor.Mode.mode0, ORBColor.ColorSpace.SRGB), - (ORBColor.Mode.mode1, ORBColor.ColorSpace.linearSRGB), - (ORBColor.Mode.mode2, ORBColor.ColorSpace.linearSRGB), - (ORBColor.Mode.mode3, ORBColor.ColorSpace.SRGB), - (ORBColor.Mode.mode4, ORBColor.ColorSpace.SRGB), - (ORBColor.Mode.mode5, ORBColor.ColorSpace.SRGB), - (ORBColor.Mode.mode6, ORBColor.ColorSpace.linearSRGB), - (ORBColor.Mode.mode7, ORBColor.ColorSpace.linearSRGB), - (ORBColor.Mode.mode8, ORBColor.ColorSpace.linearSRGB), - (ORBColor.Mode.mode9, ORBColor.ColorSpace.SRGB), - (ORBColor.Mode.mode10, ORBColor.ColorSpace.linearSRGB), - (ORBColor.Mode.mode11, ORBColor.ColorSpace.SRGB), - (ORBColor.Mode.mode12, ORBColor.ColorSpace.SRGB), - (ORBColor.Mode.mode13, ORBColor.ColorSpace.linearSRGB), - (ORBColor.Mode.mode14, ORBColor.ColorSpace.SRGB), - (ORBColor.Mode.mode15, ORBColor.ColorSpace.linearSRGB), + // MARK: - RBColorModeWorkingColorSpace + + @Test("RBColorModeWorkingColorSpace", arguments: [ + (RBColor.Mode.mode0, RBColor.ColorSpace.SRGB), + (RBColor.Mode.mode1, RBColor.ColorSpace.linearSRGB), + (RBColor.Mode.mode2, RBColor.ColorSpace.linearSRGB), + (RBColor.Mode.mode3, RBColor.ColorSpace.SRGB), + (RBColor.Mode.mode4, RBColor.ColorSpace.SRGB), + (RBColor.Mode.mode5, RBColor.ColorSpace.SRGB), + (RBColor.Mode.mode6, RBColor.ColorSpace.linearSRGB), + (RBColor.Mode.mode7, RBColor.ColorSpace.linearSRGB), + (RBColor.Mode.mode8, RBColor.ColorSpace.linearSRGB), + (RBColor.Mode.mode9, RBColor.ColorSpace.SRGB), + (RBColor.Mode.mode10, RBColor.ColorSpace.linearSRGB), + (RBColor.Mode.mode11, RBColor.ColorSpace.SRGB), + (RBColor.Mode.mode12, RBColor.ColorSpace.SRGB), + (RBColor.Mode.mode13, RBColor.ColorSpace.linearSRGB), + (RBColor.Mode.mode14, RBColor.ColorSpace.SRGB), + (RBColor.Mode.mode15, RBColor.ColorSpace.linearSRGB), ]) - func colorModeWorkingColorSpace(mode: ORBColor.Mode, expectedColorSpace: ORBColor.ColorSpace) { + func colorModeWorkingColorSpace(mode: RBColor.Mode, expectedColorSpace: RBColor.ColorSpace) { #expect(mode.workingColorSpace == expectedColorSpace) } - // MARK: - ORBColorModeHasExtendedRange - - @Test("ORBColorModeHasExtendedRange", arguments: [ - (ORBColor.Mode.mode0, false), - (ORBColor.Mode.mode1, false), - (ORBColor.Mode.mode2, true), - (ORBColor.Mode.mode3, false), - (ORBColor.Mode.mode4, false), - (ORBColor.Mode.mode5, false), - (ORBColor.Mode.mode6, false), - (ORBColor.Mode.mode7, false), - (ORBColor.Mode.mode8, false), - (ORBColor.Mode.mode9, false), - (ORBColor.Mode.mode10, false), - (ORBColor.Mode.mode11, true), - (ORBColor.Mode.mode12, true), - (ORBColor.Mode.mode13, true), - (ORBColor.Mode.mode14, false), - (ORBColor.Mode.mode15, false), + // MARK: - RBColorModeHasExtendedRange + + @Test("RBColorModeHasExtendedRange", arguments: [ + (RBColor.Mode.mode0, false), + (RBColor.Mode.mode1, false), + (RBColor.Mode.mode2, true), + (RBColor.Mode.mode3, false), + (RBColor.Mode.mode4, false), + (RBColor.Mode.mode5, false), + (RBColor.Mode.mode6, false), + (RBColor.Mode.mode7, false), + (RBColor.Mode.mode8, false), + (RBColor.Mode.mode9, false), + (RBColor.Mode.mode10, false), + (RBColor.Mode.mode11, true), + (RBColor.Mode.mode12, true), + (RBColor.Mode.mode13, true), + (RBColor.Mode.mode14, false), + (RBColor.Mode.mode15, false), ]) - func colorModeHasExtendedRange(mode: ORBColor.Mode, expectedResult: Bool) { + func colorModeHasExtendedRange(mode: RBColor.Mode, expectedResult: Bool) { #expect(mode.hasExtendedRange == expectedResult) } } diff --git a/Tests/OpenRenderBoxCompatibilityTests/DeviceTests.swift b/Tests/OpenRenderBoxCompatibilityTests/DeviceTests.swift index a45a9c6..d7f443b 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/DeviceTests.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/DeviceTests.swift @@ -11,22 +11,22 @@ import Testing struct DeviceTests { @Test func classMethods() { - let device = ORBDevice.sharedDefault() + let device = RBDevice.sharedDefault() #expect(device != nil) - let devices = ORBDevice.allDevices() + let devices = RBDevice.allDevices() #expect(!devices.isEmpty) - let supported = ORBDevice.isSupported() + let supported = RBDevice.isSupported() #expect(supported == true) - let priority = ORBDevice.defaultGPUPriority() + let priority = RBDevice.defaultGPUPriority() #expect(priority >= 0) - let backgroundPriority = ORBDevice.defaultBackgroundGPUPriority() + let backgroundPriority = RBDevice.defaultBackgroundGPUPriority() #expect(backgroundPriority >= 0) - let _ = ORBDevice.allowsRenderingInBackground() + let _ = RBDevice.allowsRenderingInBackground() } } diff --git a/Tests/OpenRenderBoxCompatibilityTests/LayerTests.swift b/Tests/OpenRenderBoxCompatibilityTests/LayerTests.swift index 39bd072..8d5dd45 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/LayerTests.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/LayerTests.swift @@ -12,10 +12,10 @@ import QuartzCore struct LayerTests { @Test func testLayerProperties() { - let layer = ORBLayer() + let layer = RBLayer() // device - layer.device = ORBDevice.sharedDefault() + layer.device = RBDevice.sharedDefault() #expect(layer.device != nil) // rendersAsynchronously diff --git a/Tests/OpenRenderBoxCompatibilityTests/PathCallbacksTests.swift b/Tests/OpenRenderBoxCompatibilityTests/PathCallbacksTests.swift index 31bc75f..da7ca0d 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/PathCallbacksTests.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/PathCallbacksTests.swift @@ -11,7 +11,7 @@ import CoreGraphics struct PathCallbacksTests { @Test func cgPathCallbacks() { - let callbacks = ORBPath.Callbacks.cgPath + let callbacks = RBPath.Callbacks.cgPath #expect(callbacks.flags.isExtended == false) #expect(callbacks.retain != nil) #expect(callbacks.release != nil) diff --git a/Tests/OpenRenderBoxCompatibilityTests/PathStorageTests.swift b/Tests/OpenRenderBoxCompatibilityTests/PathStorageTests.swift index 4883f1b..e5089e7 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/PathStorageTests.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/PathStorageTests.swift @@ -11,7 +11,7 @@ import CoreGraphics struct PathStorageTests { @Test func storageIsEmpty() { - let path = ORBPath(rect: CGRect(x: 0, y: 0, width: 100, height: 100), transform: nil) + let path = RBPath(rect: CGRect(x: 0, y: 0, width: 100, height: 100), transform: nil) let storage = path.storage storage.initialize(capacity: 96, source: nil) #expect(storage.isEmpty == true) @@ -23,7 +23,7 @@ struct PathStorageTests { @Test func storageIsSingleElement() { - let path = ORBPath(rect: CGRect(x: 0, y: 0, width: 100, height: 100), transform: nil) + let path = RBPath(rect: CGRect(x: 0, y: 0, width: 100, height: 100), transform: nil) let storage = path.storage storage.initialize(capacity: 96, source: nil) #expect(storage.isSingleElement == false) @@ -35,7 +35,7 @@ struct PathStorageTests { @Test func storageBezierOrder() { - let path = ORBPath(rect: CGRect(x: 0, y: 0, width: 100, height: 100), transform: nil) + let path = RBPath(rect: CGRect(x: 0, y: 0, width: 100, height: 100), transform: nil) let order = path.storage.bezierOrder #expect(order == 1) path.release() @@ -44,7 +44,7 @@ struct PathStorageTests { @Test func storageBoundingRect() { let rect = CGRect(x: 10, y: 20, width: 100, height: 50) - let path = ORBPath(rect: rect, transform: nil) + let path = RBPath(rect: rect, transform: nil) let storage = path.storage storage.initialize(capacity: 96, source: nil) storage.append(path: path) @@ -63,8 +63,8 @@ struct PathStorageTests { (CGRect(x: 10, y: 20, width: 50, height: 50), CGRect(x: 10, y: 20, width: 50, height: 50), true), ]) func storageEquality(rect1: CGRect, rect2: CGRect, expectedEqual: Bool) { - let path1 = ORBPath(rect: rect1, transform: nil) - let path2 = ORBPath(rect: rect2, transform: nil) + let path1 = RBPath(rect: rect1, transform: nil) + let path2 = RBPath(rect: rect2, transform: nil) let storage1 = path1.storage let storage2 = path2.storage storage1.initialize(capacity: 96, source: nil) @@ -78,10 +78,10 @@ struct PathStorageTests { path2.release() } - @Test("Verify no crash or memleak of ORBPathStorageGetCGPath call", arguments: 1...20) + @Test("Verify no crash or memleak of RBPathStorageGetCGPath call", arguments: 1...20) func storageGetCGPath(iteration: Int) { let rect = CGRect(x: 0, y: 0, width: 100, height: 100) - let path = ORBPath(rect: rect, transform: nil) + let path = RBPath(rect: rect, transform: nil) let storage = path.storage storage.initialize(capacity: 64, source: nil) storage.append(path: path) diff --git a/Tests/OpenRenderBoxCompatibilityTests/PathTests.swift b/Tests/OpenRenderBoxCompatibilityTests/PathTests.swift index 2718190..b1c029a 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/PathTests.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/PathTests.swift @@ -12,35 +12,35 @@ struct PathTests { @Test func createRectPath() { let rect = CGRect(x: 0, y: 0, width: 100, height: 100) - let path = ORBPath(rect: rect, transform: nil) + let path = RBPath(rect: rect, transform: nil) path.release() } @Test func createEllipsePath() { let rect = CGRect(x: 0, y: 0, width: 100, height: 50) - let path = ORBPath(ellipseIn: rect, transform: nil) + let path = RBPath(ellipseIn: rect, transform: nil) path.release() } @Test func createRoundedRectPath() { let rect = CGRect(x: 0, y: 0, width: 100, height: 100) - let path = ORBPath(roundedRect: rect, cornerWidth: 10, cornerHeight: 10, style: .circular, transform: nil) + let path = RBPath(roundedRect: rect, cornerWidth: 10, cornerHeight: 10, style: .circular, transform: nil) path.release() } @Test func createUnevenRoundedRectPath() { let rect = CGRect(x: 0, y: 0, width: 100, height: 100) - let path = ORBPath(roundedRect: rect, topLeftRadius: 5, bottomLeftRadius: 10, bottomRightRadius: 15, topRightRadius: 20, style: .continuous, transform: nil) + let path = RBPath(roundedRect: rect, topLeftRadius: 5, bottomLeftRadius: 10, bottomRightRadius: 15, topRightRadius: 20, style: .continuous, transform: nil) path.release() } @Test func pathRetainRelease() { let rect = CGRect(x: 0, y: 0, width: 100, height: 100) - let path = ORBPath(rect: rect, transform: nil) + let path = RBPath(rect: rect, transform: nil) path.retain() path.release() path.release() @@ -55,18 +55,18 @@ struct PathTests { ]) func pathContainsPoint(point: CGPoint, expected: Bool) { let rect = CGRect(x: 0, y: 0, width: 100, height: 100) - let path = ORBPath(rect: rect, transform: nil) + let path = RBPath(rect: rect, transform: nil) #expect(path.contains(point: point, eoFill: false) == expected) path.release() } @Test func pathIsEmpty() { - let emptyPath = ORBPath.null + let emptyPath = RBPath.null #expect(emptyPath.isEmpty == true) let rect = CGRect(x: 0, y: 0, width: 100, height: 100) - let path = ORBPath(rect: rect, transform: nil) + let path = RBPath(rect: rect, transform: nil) #expect(path.isEmpty == false) path.release() } @@ -75,7 +75,7 @@ struct PathTests { func pathApplyElements() { let rect = CGRect(x: 0, y: 0, width: 10, height: 10) let cgPath = CGPath(rect: rect, transform: nil) - let path = ORBPath(cgPath: cgPath) + let path = RBPath(cgPath: cgPath) var elementCount: Int32 = 0 path.apply(info: &elementCount) { info, element, points, userInfo in let countPtr = info.assumingMemoryBound(to: Int32.self) @@ -89,15 +89,15 @@ struct PathTests { @Test func pathEqualToPath() { let rect = CGRect(x: 0, y: 0, width: 100, height: 100) - let path1 = ORBPath(rect: rect, transform: nil) - let path2 = ORBPath(rect: rect, transform: nil) + let path1 = RBPath(rect: rect, transform: nil) + let path2 = RBPath(rect: rect, transform: nil) #expect(path1.isEqual(to: path2) == true) path1.release() path2.release() let differentRect = CGRect(x: 0, y: 0, width: 200, height: 200) - let path3 = ORBPath(rect: rect, transform: nil) - let path4 = ORBPath(rect: differentRect, transform: nil) + let path3 = RBPath(rect: rect, transform: nil) + let path4 = RBPath(rect: differentRect, transform: nil) #expect(path3.isEqual(to: path4) == false) path3.release() path4.release() diff --git a/Tests/OpenRenderBoxCompatibilityTests/Shims.swift b/Tests/OpenRenderBoxCompatibilityTests/Shims.swift index 3ef5e40..90a4fe2 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/Shims.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/Shims.swift @@ -4,17 +4,22 @@ #if OPENRENDERBOX_COMPATIBILITY_TEST @_exported public import RenderBox -public typealias ORBColor = RBColor -public typealias ORBDevice = RBDevice -public typealias ORBLayer = RBLayer -public typealias ORBPath = RBPath -public typealias ORBUUID = RBUUID -public typealias ORBAnimation = RBAnimation -public typealias ORBSymbolAnimator = RBSymbolAnimator -public typealias ORBSymbolAnimatorObserver = RBSymbolAnimatorObserver public let compatibilityTestEnabled = true #else @_exported import OpenRenderBox @_exported import OpenRenderBoxCxx + +public typealias RBColor = ORBColor +public typealias RBUUID = ORBUUID +public typealias RBPath = ORBPath +public typealias RBAnimation = ORBAnimation +public typealias RBSymbolAnimator = ORBSymbolAnimator +public typealias RBSymbolAnimatorObserver = ORBSymbolAnimatorObserver + +#if canImport(Darwin) +public typealias RBDevice = ORBDevice +public typealias RBLayer = ORBLayer +#endif + public let compatibilityTestEnabled = false #endif diff --git a/Tests/OpenRenderBoxCompatibilityTests/SymbolAnimatorTests.swift b/Tests/OpenRenderBoxCompatibilityTests/SymbolAnimatorTests.swift index d25bf2a..c57e42b 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/SymbolAnimatorTests.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/SymbolAnimatorTests.swift @@ -11,7 +11,7 @@ import CoreGraphics struct SymbolAnimatorTests { @Test func basicProperties() { - let animator = ORBSymbolAnimator() + let animator = RBSymbolAnimator() // Default state #expect(animator.isAnimating == false) @@ -33,7 +33,7 @@ struct SymbolAnimatorTests { @Test func renderingProperties() { - let animator = ORBSymbolAnimator() + let animator = RBSymbolAnimator() animator.renderingMode = 1 #expect(animator.renderingMode == 1) @@ -53,7 +53,7 @@ struct SymbolAnimatorTests { @Test func animationManagement() { - let animator = ORBSymbolAnimator() + let animator = RBSymbolAnimator() // removeAllAnimations on empty animator should not crash animator.removeAllAnimations() @@ -64,7 +64,7 @@ struct SymbolAnimatorTests { @Test func timeAndVelocity() { - let animator = ORBSymbolAnimator() + let animator = RBSymbolAnimator() animator.currentTime = 1.5 #expect(animator.currentTime == 1.5) @@ -75,7 +75,7 @@ struct SymbolAnimatorTests { @Test func rectProperties() { - let animator = ORBSymbolAnimator() + let animator = RBSymbolAnimator() _ = animator.alignmentRect _ = animator.unroundedAlignmentRect _ = animator.boundingRect diff --git a/Tests/OpenRenderBoxCompatibilityTests/UUIDTests.swift b/Tests/OpenRenderBoxCompatibilityTests/UUIDTests.swift index 93ae7ee..6ef5923 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/UUIDTests.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/UUIDTests.swift @@ -28,7 +28,7 @@ struct UUIDTests { ]) func foundationUUID(uuid: UUID, expectedBytes: [UInt8]) { #if canImport(Darwin) - let id = ORBUUID(uuid: uuid) + let id = RBUUID(uuid: uuid) let bytes = id.bytes #expect(bytes.0 == expectedBytes[0]) #expect(bytes.1 == expectedBytes[1]) @@ -83,7 +83,7 @@ struct UUIDTests { ), ]) func strongHashUUID(words: (UInt32, UInt32, UInt32, UInt32, UInt32), expectedBytes: [UInt8]) { - let id: ORBUUID = ORBUUID(UInt64(words.0) | UInt64(words.1) &<< 32, UInt64(words.2) | UInt64(words.3) &<< 32, words.4) + let id: RBUUID = RBUUID(UInt64(words.0) | UInt64(words.1) &<< 32, UInt64(words.2) | UInt64(words.3) &<< 32, words.4) let bytes = id.bytes #expect(bytes.0 == expectedBytes[0]) #expect(bytes.1 == expectedBytes[1]) From d14b9ac585a572cd5f0ee582fe17651935fa7d23 Mon Sep 17 00:00:00 2001 From: Kyle Date: Tue, 10 Mar 2026 23:41:41 +0800 Subject: [PATCH 3/5] Update shims import --- Sources/OpenRenderBoxShims/Shims.swift | 6 ------ Tests/OpenRenderBoxCompatibilityTests/Shims.swift | 8 ++++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/Sources/OpenRenderBoxShims/Shims.swift b/Sources/OpenRenderBoxShims/Shims.swift index 72843aa..54d658e 100644 --- a/Sources/OpenRenderBoxShims/Shims.swift +++ b/Sources/OpenRenderBoxShims/Shims.swift @@ -34,17 +34,11 @@ public typealias RBDisplayList = ORBDisplayList public typealias RBAnimation = ORBAnimation public typealias RBSymbolAnimator = ORBSymbolAnimator public typealias RBSymbolAnimatorObserver = ORBSymbolAnimatorObserver - -#if canImport(ObjectiveC) public typealias RBDevice = ORBDevice public typealias RBLayer = ORBLayer public typealias RBLayerDelegate = ORBLayerDelegate -#endif - -#if !OPENRENDERBOX_CF_CGTYPES public typealias RBPath = ORBPath public typealias RBPathApplyCallback = ORBPathApplyCallback -#endif public let renderBoxVendor = RenderBoxVendor.orb #endif diff --git a/Tests/OpenRenderBoxCompatibilityTests/Shims.swift b/Tests/OpenRenderBoxCompatibilityTests/Shims.swift index 90a4fe2..768e1f2 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/Shims.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/Shims.swift @@ -11,15 +11,15 @@ public let compatibilityTestEnabled = true public typealias RBColor = ORBColor public typealias RBUUID = ORBUUID -public typealias RBPath = ORBPath +public typealias RBDisplayList = ORBDisplayList public typealias RBAnimation = ORBAnimation public typealias RBSymbolAnimator = ORBSymbolAnimator public typealias RBSymbolAnimatorObserver = ORBSymbolAnimatorObserver - -#if canImport(Darwin) public typealias RBDevice = ORBDevice public typealias RBLayer = ORBLayer -#endif +public typealias RBLayerDelegate = ORBLayerDelegate +public typealias RBPath = ORBPath +public typealias RBPathApplyCallback = ORBPathApplyCallback public let compatibilityTestEnabled = false #endif From bc42e7bdd6e52bdf70cb1ea8b03022e51899525f Mon Sep 17 00:00:00 2001 From: Kyle Date: Tue, 10 Mar 2026 23:52:05 +0800 Subject: [PATCH 4/5] Update Shims --- .../{Shims.swift => ORBShims.swift} | 26 +++++++++---------- .../ORBShims.swift | 26 +++++++++++++++++++ .../Shims.swift | 25 ------------------ 3 files changed, 39 insertions(+), 38 deletions(-) rename Sources/OpenRenderBoxShims/{Shims.swift => ORBShims.swift} (64%) create mode 100644 Tests/OpenRenderBoxCompatibilityTests/ORBShims.swift delete mode 100644 Tests/OpenRenderBoxCompatibilityTests/Shims.swift diff --git a/Sources/OpenRenderBoxShims/Shims.swift b/Sources/OpenRenderBoxShims/ORBShims.swift similarity index 64% rename from Sources/OpenRenderBoxShims/Shims.swift rename to Sources/OpenRenderBoxShims/ORBShims.swift index 54d658e..e443ca8 100644 --- a/Sources/OpenRenderBoxShims/Shims.swift +++ b/Sources/OpenRenderBoxShims/ORBShims.swift @@ -1,5 +1,5 @@ // -// Shims.swift +// ORBShims.swift // OpenRenderBoxShims /// A type that identifies the underlying RenderBox implementation vendor. @@ -24,21 +24,21 @@ public struct RenderBoxVendor: RawRepresentable, CaseIterable { #if OPENRENDERBOX_RENDERBOX @_exported public import RenderBox +public typealias ORBAnimation = RBAnimation +public typealias ORBColor = RBColor +public typealias ORBDevice = RBDevice +public typealias ORBDisplayList = RBDisplayList +public typealias ORBLayer = RBLayer +public typealias ORBLayerDelegate = RBLayerDelegate +public typealias ORBPath = RBPath +public typealias ORBPathApplyCallback = RBPathApplyCallback +public typealias ORBUUID = RBUUID +public typealias ORBSymbolAnimator = RBSymbolAnimator +public typealias ORBSymbolAnimatorObserver = RBSymbolAnimatorObserver + public let renderBoxVendor = RenderBoxVendor.rb #else @_exported import OpenRenderBox -public typealias RBColor = ORBColor -public typealias RBUUID = ORBUUID -public typealias RBDisplayList = ORBDisplayList -public typealias RBAnimation = ORBAnimation -public typealias RBSymbolAnimator = ORBSymbolAnimator -public typealias RBSymbolAnimatorObserver = ORBSymbolAnimatorObserver -public typealias RBDevice = ORBDevice -public typealias RBLayer = ORBLayer -public typealias RBLayerDelegate = ORBLayerDelegate -public typealias RBPath = ORBPath -public typealias RBPathApplyCallback = ORBPathApplyCallback - public let renderBoxVendor = RenderBoxVendor.orb #endif diff --git a/Tests/OpenRenderBoxCompatibilityTests/ORBShims.swift b/Tests/OpenRenderBoxCompatibilityTests/ORBShims.swift new file mode 100644 index 0000000..43847f8 --- /dev/null +++ b/Tests/OpenRenderBoxCompatibilityTests/ORBShims.swift @@ -0,0 +1,26 @@ +// +// ORBShims.swift +// OpenRenderBoxShims + +#if OPENRENDERBOX_COMPATIBILITY_TEST +@_exported public import RenderBox + +public typealias ORBAnimation = RBAnimation +public typealias ORBColor = RBColor +public typealias ORBDevice = RBDevice +public typealias ORBDisplayList = RBDisplayList +public typealias ORBLayer = RBLayer +public typealias ORBLayerDelegate = RBLayerDelegate +public typealias ORBPath = RBPath +public typealias ORBPathApplyCallback = RBPathApplyCallback +public typealias ORBUUID = RBUUID +public typealias ORBSymbolAnimator = RBSymbolAnimator +public typealias ORBSymbolAnimatorObserver = RBSymbolAnimatorObserver + +public let compatibilityTestEnabled = true +#else +@_exported import OpenRenderBox +@_exported import OpenRenderBoxCxx + +public let compatibilityTestEnabled = false +#endif diff --git a/Tests/OpenRenderBoxCompatibilityTests/Shims.swift b/Tests/OpenRenderBoxCompatibilityTests/Shims.swift deleted file mode 100644 index 768e1f2..0000000 --- a/Tests/OpenRenderBoxCompatibilityTests/Shims.swift +++ /dev/null @@ -1,25 +0,0 @@ -// -// Shims.swift -// OpenRenderBoxShims - -#if OPENRENDERBOX_COMPATIBILITY_TEST -@_exported public import RenderBox -public let compatibilityTestEnabled = true -#else -@_exported import OpenRenderBox -@_exported import OpenRenderBoxCxx - -public typealias RBColor = ORBColor -public typealias RBUUID = ORBUUID -public typealias RBDisplayList = ORBDisplayList -public typealias RBAnimation = ORBAnimation -public typealias RBSymbolAnimator = ORBSymbolAnimator -public typealias RBSymbolAnimatorObserver = ORBSymbolAnimatorObserver -public typealias RBDevice = ORBDevice -public typealias RBLayer = ORBLayer -public typealias RBLayerDelegate = ORBLayerDelegate -public typealias RBPath = ORBPath -public typealias RBPathApplyCallback = ORBPathApplyCallback - -public let compatibilityTestEnabled = false -#endif From 3f7ed683affc63b1a893f3d8c10f75832b43ea3a Mon Sep 17 00:00:00 2001 From: Kyle Date: Tue, 10 Mar 2026 23:53:06 +0800 Subject: [PATCH 5/5] Update test case --- .../AnimationTests.swift | 18 +- .../ColorTests.swift | 168 +++++++++--------- .../DeviceTests.swift | 12 +- .../LayerTests.swift | 4 +- .../PathCallbacksTests.swift | 2 +- .../PathStorageTests.swift | 16 +- .../PathTests.swift | 26 +-- .../SymbolAnimatorTests.swift | 10 +- .../UUIDTests.swift | 4 +- 9 files changed, 130 insertions(+), 130 deletions(-) diff --git a/Tests/OpenRenderBoxCompatibilityTests/AnimationTests.swift b/Tests/OpenRenderBoxCompatibilityTests/AnimationTests.swift index 3b7ed31..d822f64 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/AnimationTests.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/AnimationTests.swift @@ -11,7 +11,7 @@ import CoreGraphics struct AnimationTests { @Test func basicAnimation() { - let animation = RBAnimation() + let animation = ORBAnimation() // activeDuration should be 0 for empty animation #expect(animation.activeDuration == 0) @@ -26,21 +26,21 @@ struct AnimationTests { @Test func addBezier() { - let animation = RBAnimation() + let animation = ORBAnimation() animation.addBezierDuration(0.3, controlPoint1: CGPoint(x: 0.42, y: 0), controlPoint2: CGPoint(x: 0.58, y: 1)) #expect(animation.activeDuration > 0) } @Test func addDelay() { - let animation = RBAnimation() + let animation = ORBAnimation() animation.addDelay(0.5) #expect(animation.activeDuration == 0.5) } @Test func addSpeed() { - let animation = RBAnimation() + let animation = ORBAnimation() animation.addBezierDuration(1.0, controlPoint1: .zero, controlPoint2: CGPoint(x: 1, y: 1)) let baseDuration = animation.activeDuration animation.addSpeed(2.0) @@ -49,14 +49,14 @@ struct AnimationTests { @Test func addSpring() { - let animation = RBAnimation() + let animation = ORBAnimation() animation.addSpringDuration(0.5, mass: 1.0, stiffness: 100, damping: 10, initialVelocity: 0) #expect(animation.activeDuration > 0) } @Test func addRepeat() { - let animation = RBAnimation() + let animation = ORBAnimation() animation.addBezierDuration(0.3, controlPoint1: .zero, controlPoint2: CGPoint(x: 1, y: 1)) animation.addRepeatCount(3, autoreverses: true) #expect(animation.activeDuration > 0) @@ -64,16 +64,16 @@ struct AnimationTests { @Test func addPreset() { - let animation = RBAnimation() + let animation = ORBAnimation() animation.addPreset(0, duration: 0.5) #expect(animation.activeDuration > 0) } @Test func copyAndEqual() { - let animation = RBAnimation() + let animation = ORBAnimation() animation.addDelay(0.5) - let copy = animation.copy() as! RBAnimation + let copy = animation.copy() as! ORBAnimation #expect(animation.isEqual(copy)) #expect(copy.activeDuration == animation.activeDuration) } diff --git a/Tests/OpenRenderBoxCompatibilityTests/ColorTests.swift b/Tests/OpenRenderBoxCompatibilityTests/ColorTests.swift index 5919270..815308f 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/ColorTests.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/ColorTests.swift @@ -10,44 +10,44 @@ import CoreGraphics @Suite struct ColorTests { - // MARK: - RBColorMake + // MARK: - ORBColorMake - @Test("RBColorMake", arguments: [ - (Float(0.0), Float(0.0), Float(0.0), Float(1.0), RBColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0)), - (Float(1.0), Float(1.0), Float(1.0), Float(1.0), RBColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)), - (Float(0.5), Float(0.25), Float(0.75), Float(0.8), RBColor(red: 0.5, green: 0.25, blue: 0.75, alpha: 0.8)), - (Float(0.2), Float(0.4), Float(0.6), Float(0.0), RBColor(red: 0.2, green: 0.4, blue: 0.6, alpha: 0.0)), + @Test("ORBColorMake", arguments: [ + (Float(0.0), Float(0.0), Float(0.0), Float(1.0), ORBColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0)), + (Float(1.0), Float(1.0), Float(1.0), Float(1.0), ORBColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)), + (Float(0.5), Float(0.25), Float(0.75), Float(0.8), ORBColor(red: 0.5, green: 0.25, blue: 0.75, alpha: 0.8)), + (Float(0.2), Float(0.4), Float(0.6), Float(0.0), ORBColor(red: 0.2, green: 0.4, blue: 0.6, alpha: 0.0)), ]) - func colorMake(red: Float, green: Float, blue: Float, alpha: Float, expectColor: RBColor) { - let color = RBColor(red: red, green: green, blue: blue, alpha: alpha) + func colorMake(red: Float, green: Float, blue: Float, alpha: Float, expectColor: ORBColor) { + let color = ORBColor(red: red, green: green, blue: blue, alpha: alpha) #expect(color.red == expectColor.red) #expect(color.green == expectColor.green) #expect(color.blue == expectColor.blue) #expect(color.alpha == expectColor.alpha) } - // MARK: - RBColorMakeLinear + // MARK: - ORBColorMakeLinear - @Test("RBColorMakeLinear", arguments: [ - (Float(0.5), Float(0.25), Float(0.75), Float(1.0), RBColor(linearRed: 0.5, green: 0.25, blue: 0.75, alpha: 1.0)), - (Float(0.2), Float(0.4), Float(0.6), Float(0.5), RBColor(linearRed: 0.2, green: 0.4, blue: 0.6, alpha: 0.5)), + @Test("ORBColorMakeLinear", arguments: [ + (Float(0.5), Float(0.25), Float(0.75), Float(1.0), ORBColor(linearRed: 0.5, green: 0.25, blue: 0.75, alpha: 1.0)), + (Float(0.2), Float(0.4), Float(0.6), Float(0.5), ORBColor(linearRed: 0.2, green: 0.4, blue: 0.6, alpha: 0.5)), ]) - func colorMakeLinear(red: Float, green: Float, blue: Float, alpha: Float, expectColor: RBColor) { - let color = RBColor(linearRed: red, green: green, blue: blue, alpha: alpha) + func colorMakeLinear(red: Float, green: Float, blue: Float, alpha: Float, expectColor: ORBColor) { + let color = ORBColor(linearRed: red, green: green, blue: blue, alpha: alpha) #expect(color.red == expectColor.red) #expect(color.green == expectColor.green) #expect(color.blue == expectColor.blue) #expect(color.alpha == expectColor.alpha) } - // MARK: - RBColorToLinear + // MARK: - ORBColorToLinear - @Test("RBColorToLinear", arguments: [ + @Test("ORBColorToLinear", arguments: [ (Float(0.5), Float(0.25), Float(0.75), Float(0.8)), (Float(0.3), Float(0.6), Float(0.9), Float(1.0)), ]) func colorToLinear(red: Float, green: Float, blue: Float, alpha: Float) { - let srgbColor = RBColor(red: red, green: green, blue: blue, alpha: alpha) + let srgbColor = ORBColor(red: red, green: green, blue: blue, alpha: alpha) let linearColor = srgbColor.linear #expect(linearColor.alpha == srgbColor.alpha) #expect(!linearColor.red.isApproximatelyEqual(to: srgbColor.red)) @@ -55,14 +55,14 @@ struct ColorTests { #expect(!linearColor.blue.isApproximatelyEqual(to: srgbColor.blue)) } - // MARK: - RBColorFromLinear + // MARK: - ORBColorFromLinear - @Test("RBColorFromLinear", arguments: [ + @Test("ORBColorFromLinear", arguments: [ (Float(0.2), Float(0.1), Float(0.5), Float(0.9)), (Float(0.05), Float(0.15), Float(0.25), Float(1.0)), ]) func colorFromLinear(red: Float, green: Float, blue: Float, alpha: Float) { - let linearColor = RBColor(red: red, green: green, blue: blue, alpha: alpha) + let linearColor = ORBColor(red: red, green: green, blue: blue, alpha: alpha) let srgbColor = linearColor.fromLinear() #expect(srgbColor.alpha == linearColor.alpha) #expect(!srgbColor.red.isApproximatelyEqual(to: linearColor.red)) @@ -72,14 +72,14 @@ struct ColorTests { // MARK: - Round Trip (toLinear -> fromLinear) - @Test("RBColor Round Trip", arguments: [ + @Test("ORBColor Round Trip", arguments: [ (Float(0.5), Float(0.25), Float(0.75), Float(1.0)), (Float(0.0), Float(0.0), Float(0.0), Float(1.0)), (Float(1.0), Float(1.0), Float(1.0), Float(0.5)), (Float(0.3), Float(0.6), Float(0.9), Float(0.8)), ]) func colorRoundTrip(red: Float, green: Float, blue: Float, alpha: Float) { - let originalColor = RBColor(red: red, green: green, blue: blue, alpha: alpha) + let originalColor = ORBColor(red: red, green: green, blue: blue, alpha: alpha) let linearColor = originalColor.linear let roundTripColor = linearColor.fromLinear() @@ -89,58 +89,58 @@ struct ColorTests { #expect(roundTripColor.alpha == originalColor.alpha) } - // MARK: - RBColorEqualToColor + // MARK: - ORBColorEqualToColor - @Test("RBColorEqualToColor - equal") + @Test("ORBColorEqualToColor - equal") func colorEqualToColor_equal() { - let color1 = RBColor(red: 0.5, green: 0.25, blue: 0.75, alpha: 1.0) - let color2 = RBColor(red: 0.5, green: 0.25, blue: 0.75, alpha: 1.0) + let color1 = ORBColor(red: 0.5, green: 0.25, blue: 0.75, alpha: 1.0) + let color2 = ORBColor(red: 0.5, green: 0.25, blue: 0.75, alpha: 1.0) #expect(color1.isEqual(to: color2)) } - @Test("RBColorEqualToColor - not equal", arguments: [ + @Test("ORBColorEqualToColor - not equal", arguments: [ (Float(0.6), Float(0.25), Float(0.75), Float(1.0)), (Float(0.5), Float(0.35), Float(0.75), Float(1.0)), (Float(0.5), Float(0.25), Float(0.85), Float(1.0)), (Float(0.5), Float(0.25), Float(0.75), Float(0.5)), ]) func colorEqualToColor_notEqual(r2: Float, g2: Float, b2: Float, a2: Float) { - let color1 = RBColor(red: 0.5, green: 0.25, blue: 0.75, alpha: 1.0) - let color2 = RBColor(red: r2, green: g2, blue: b2, alpha: a2) + let color1 = ORBColor(red: 0.5, green: 0.25, blue: 0.75, alpha: 1.0) + let color2 = ORBColor(red: r2, green: g2, blue: b2, alpha: a2) #expect(!color1.isEqual(to: color2)) } // MARK: - Color Constants - @Test("RBColor Constant", arguments: [ - (RBColor.clear, Float(0.0), Float(0.0), Float(0.0), Float(0.0)), - (RBColor.black, Float(0.0), Float(0.0), Float(0.0), Float(1.0)), - (RBColor.white, Float(1.0), Float(1.0), Float(1.0), Float(1.0)), - (RBColor.null, Float(-32768.0), Float(-32768.0), Float(-32768.0), Float(-32768.0)), + @Test("ORBColor Constant", arguments: [ + (ORBColor.clear, Float(0.0), Float(0.0), Float(0.0), Float(0.0)), + (ORBColor.black, Float(0.0), Float(0.0), Float(0.0), Float(1.0)), + (ORBColor.white, Float(1.0), Float(1.0), Float(1.0), Float(1.0)), + (ORBColor.null, Float(-32768.0), Float(-32768.0), Float(-32768.0), Float(-32768.0)), ]) - func constant(_ color: RBColor, expectedRed: Float, expectedGreen: Float, expectedBlue: Float, expectedAlpha: Float) { + func constant(_ color: ORBColor, expectedRed: Float, expectedGreen: Float, expectedBlue: Float, expectedAlpha: Float) { #expect(color.red.isApproximatelyEqual(to: expectedRed)) #expect(color.green.isApproximatelyEqual(to: expectedGreen)) #expect(color.blue.isApproximatelyEqual(to: expectedBlue)) #expect(color.alpha.isApproximatelyEqual(to: expectedAlpha)) } - @Test("RBColorInvalidComponent") + @Test("ORBColorInvalidComponent") func colorInvalidComponent() { - let value = RBColor.invalidComponent + let value = ORBColor.invalidComponent #expect(value.isApproximatelyEqual(to: -32768.0)) } - // MARK: - RBColorCopyCGColor + // MARK: - ORBColorCopyCGColor #if canImport(CoreGraphics) - @Test("RBColorCopyCGColor", arguments: [ - (RBColor(red: 1.0, green: 0.0, blue: 0.0, alpha: 1.0), RBColor.ColorSpace.SRGB), - (RBColor(red: 0.0, green: 1.0, blue: 0.0, alpha: 1.0), RBColor.ColorSpace.linearSRGB), - (RBColor(red: 0.0, green: 0.0, blue: 1.0, alpha: 0.5), RBColor.ColorSpace.displayP3), - (RBColor(red: 0.5, green: 0.5, blue: 0.5, alpha: 1.0), RBColor.ColorSpace.linearDisplayP3), + @Test("ORBColorCopyCGColor", arguments: [ + (ORBColor(red: 1.0, green: 0.0, blue: 0.0, alpha: 1.0), ORBColor.ColorSpace.SRGB), + (ORBColor(red: 0.0, green: 1.0, blue: 0.0, alpha: 1.0), ORBColor.ColorSpace.linearSRGB), + (ORBColor(red: 0.0, green: 0.0, blue: 1.0, alpha: 0.5), ORBColor.ColorSpace.displayP3), + (ORBColor(red: 0.5, green: 0.5, blue: 0.5, alpha: 1.0), ORBColor.ColorSpace.linearDisplayP3), ]) - func colorCopyCGColor(color: RBColor, colorSpace: RBColor.ColorSpace) throws { + func colorCopyCGColor(color: ORBColor, colorSpace: ORBColor.ColorSpace) throws { let cgColor = try #require(color.cgColor(colorSpace: colorSpace)) #expect(cgColor.numberOfComponents == 4) let components = cgColor.components! @@ -154,51 +154,51 @@ struct ColorTests { #if compiler(>=6.2) // old Xcode version swift-testing bug @Suite struct ColorModeTests { - // MARK: - RBColorModeWorkingColorSpace - - @Test("RBColorModeWorkingColorSpace", arguments: [ - (RBColor.Mode.mode0, RBColor.ColorSpace.SRGB), - (RBColor.Mode.mode1, RBColor.ColorSpace.linearSRGB), - (RBColor.Mode.mode2, RBColor.ColorSpace.linearSRGB), - (RBColor.Mode.mode3, RBColor.ColorSpace.SRGB), - (RBColor.Mode.mode4, RBColor.ColorSpace.SRGB), - (RBColor.Mode.mode5, RBColor.ColorSpace.SRGB), - (RBColor.Mode.mode6, RBColor.ColorSpace.linearSRGB), - (RBColor.Mode.mode7, RBColor.ColorSpace.linearSRGB), - (RBColor.Mode.mode8, RBColor.ColorSpace.linearSRGB), - (RBColor.Mode.mode9, RBColor.ColorSpace.SRGB), - (RBColor.Mode.mode10, RBColor.ColorSpace.linearSRGB), - (RBColor.Mode.mode11, RBColor.ColorSpace.SRGB), - (RBColor.Mode.mode12, RBColor.ColorSpace.SRGB), - (RBColor.Mode.mode13, RBColor.ColorSpace.linearSRGB), - (RBColor.Mode.mode14, RBColor.ColorSpace.SRGB), - (RBColor.Mode.mode15, RBColor.ColorSpace.linearSRGB), + // MARK: - ORBColorModeWorkingColorSpace + + @Test("ORBColorModeWorkingColorSpace", arguments: [ + (ORBColor.Mode.mode0, ORBColor.ColorSpace.SRGB), + (ORBColor.Mode.mode1, ORBColor.ColorSpace.linearSRGB), + (ORBColor.Mode.mode2, ORBColor.ColorSpace.linearSRGB), + (ORBColor.Mode.mode3, ORBColor.ColorSpace.SRGB), + (ORBColor.Mode.mode4, ORBColor.ColorSpace.SRGB), + (ORBColor.Mode.mode5, ORBColor.ColorSpace.SRGB), + (ORBColor.Mode.mode6, ORBColor.ColorSpace.linearSRGB), + (ORBColor.Mode.mode7, ORBColor.ColorSpace.linearSRGB), + (ORBColor.Mode.mode8, ORBColor.ColorSpace.linearSRGB), + (ORBColor.Mode.mode9, ORBColor.ColorSpace.SRGB), + (ORBColor.Mode.mode10, ORBColor.ColorSpace.linearSRGB), + (ORBColor.Mode.mode11, ORBColor.ColorSpace.SRGB), + (ORBColor.Mode.mode12, ORBColor.ColorSpace.SRGB), + (ORBColor.Mode.mode13, ORBColor.ColorSpace.linearSRGB), + (ORBColor.Mode.mode14, ORBColor.ColorSpace.SRGB), + (ORBColor.Mode.mode15, ORBColor.ColorSpace.linearSRGB), ]) - func colorModeWorkingColorSpace(mode: RBColor.Mode, expectedColorSpace: RBColor.ColorSpace) { + func colorModeWorkingColorSpace(mode: ORBColor.Mode, expectedColorSpace: ORBColor.ColorSpace) { #expect(mode.workingColorSpace == expectedColorSpace) } - // MARK: - RBColorModeHasExtendedRange - - @Test("RBColorModeHasExtendedRange", arguments: [ - (RBColor.Mode.mode0, false), - (RBColor.Mode.mode1, false), - (RBColor.Mode.mode2, true), - (RBColor.Mode.mode3, false), - (RBColor.Mode.mode4, false), - (RBColor.Mode.mode5, false), - (RBColor.Mode.mode6, false), - (RBColor.Mode.mode7, false), - (RBColor.Mode.mode8, false), - (RBColor.Mode.mode9, false), - (RBColor.Mode.mode10, false), - (RBColor.Mode.mode11, true), - (RBColor.Mode.mode12, true), - (RBColor.Mode.mode13, true), - (RBColor.Mode.mode14, false), - (RBColor.Mode.mode15, false), + // MARK: - ORBColorModeHasExtendedRange + + @Test("ORBColorModeHasExtendedRange", arguments: [ + (ORBColor.Mode.mode0, false), + (ORBColor.Mode.mode1, false), + (ORBColor.Mode.mode2, true), + (ORBColor.Mode.mode3, false), + (ORBColor.Mode.mode4, false), + (ORBColor.Mode.mode5, false), + (ORBColor.Mode.mode6, false), + (ORBColor.Mode.mode7, false), + (ORBColor.Mode.mode8, false), + (ORBColor.Mode.mode9, false), + (ORBColor.Mode.mode10, false), + (ORBColor.Mode.mode11, true), + (ORBColor.Mode.mode12, true), + (ORBColor.Mode.mode13, true), + (ORBColor.Mode.mode14, false), + (ORBColor.Mode.mode15, false), ]) - func colorModeHasExtendedRange(mode: RBColor.Mode, expectedResult: Bool) { + func colorModeHasExtendedRange(mode: ORBColor.Mode, expectedResult: Bool) { #expect(mode.hasExtendedRange == expectedResult) } } diff --git a/Tests/OpenRenderBoxCompatibilityTests/DeviceTests.swift b/Tests/OpenRenderBoxCompatibilityTests/DeviceTests.swift index d7f443b..a45a9c6 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/DeviceTests.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/DeviceTests.swift @@ -11,22 +11,22 @@ import Testing struct DeviceTests { @Test func classMethods() { - let device = RBDevice.sharedDefault() + let device = ORBDevice.sharedDefault() #expect(device != nil) - let devices = RBDevice.allDevices() + let devices = ORBDevice.allDevices() #expect(!devices.isEmpty) - let supported = RBDevice.isSupported() + let supported = ORBDevice.isSupported() #expect(supported == true) - let priority = RBDevice.defaultGPUPriority() + let priority = ORBDevice.defaultGPUPriority() #expect(priority >= 0) - let backgroundPriority = RBDevice.defaultBackgroundGPUPriority() + let backgroundPriority = ORBDevice.defaultBackgroundGPUPriority() #expect(backgroundPriority >= 0) - let _ = RBDevice.allowsRenderingInBackground() + let _ = ORBDevice.allowsRenderingInBackground() } } diff --git a/Tests/OpenRenderBoxCompatibilityTests/LayerTests.swift b/Tests/OpenRenderBoxCompatibilityTests/LayerTests.swift index 8d5dd45..39bd072 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/LayerTests.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/LayerTests.swift @@ -12,10 +12,10 @@ import QuartzCore struct LayerTests { @Test func testLayerProperties() { - let layer = RBLayer() + let layer = ORBLayer() // device - layer.device = RBDevice.sharedDefault() + layer.device = ORBDevice.sharedDefault() #expect(layer.device != nil) // rendersAsynchronously diff --git a/Tests/OpenRenderBoxCompatibilityTests/PathCallbacksTests.swift b/Tests/OpenRenderBoxCompatibilityTests/PathCallbacksTests.swift index da7ca0d..31bc75f 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/PathCallbacksTests.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/PathCallbacksTests.swift @@ -11,7 +11,7 @@ import CoreGraphics struct PathCallbacksTests { @Test func cgPathCallbacks() { - let callbacks = RBPath.Callbacks.cgPath + let callbacks = ORBPath.Callbacks.cgPath #expect(callbacks.flags.isExtended == false) #expect(callbacks.retain != nil) #expect(callbacks.release != nil) diff --git a/Tests/OpenRenderBoxCompatibilityTests/PathStorageTests.swift b/Tests/OpenRenderBoxCompatibilityTests/PathStorageTests.swift index e5089e7..4883f1b 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/PathStorageTests.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/PathStorageTests.swift @@ -11,7 +11,7 @@ import CoreGraphics struct PathStorageTests { @Test func storageIsEmpty() { - let path = RBPath(rect: CGRect(x: 0, y: 0, width: 100, height: 100), transform: nil) + let path = ORBPath(rect: CGRect(x: 0, y: 0, width: 100, height: 100), transform: nil) let storage = path.storage storage.initialize(capacity: 96, source: nil) #expect(storage.isEmpty == true) @@ -23,7 +23,7 @@ struct PathStorageTests { @Test func storageIsSingleElement() { - let path = RBPath(rect: CGRect(x: 0, y: 0, width: 100, height: 100), transform: nil) + let path = ORBPath(rect: CGRect(x: 0, y: 0, width: 100, height: 100), transform: nil) let storage = path.storage storage.initialize(capacity: 96, source: nil) #expect(storage.isSingleElement == false) @@ -35,7 +35,7 @@ struct PathStorageTests { @Test func storageBezierOrder() { - let path = RBPath(rect: CGRect(x: 0, y: 0, width: 100, height: 100), transform: nil) + let path = ORBPath(rect: CGRect(x: 0, y: 0, width: 100, height: 100), transform: nil) let order = path.storage.bezierOrder #expect(order == 1) path.release() @@ -44,7 +44,7 @@ struct PathStorageTests { @Test func storageBoundingRect() { let rect = CGRect(x: 10, y: 20, width: 100, height: 50) - let path = RBPath(rect: rect, transform: nil) + let path = ORBPath(rect: rect, transform: nil) let storage = path.storage storage.initialize(capacity: 96, source: nil) storage.append(path: path) @@ -63,8 +63,8 @@ struct PathStorageTests { (CGRect(x: 10, y: 20, width: 50, height: 50), CGRect(x: 10, y: 20, width: 50, height: 50), true), ]) func storageEquality(rect1: CGRect, rect2: CGRect, expectedEqual: Bool) { - let path1 = RBPath(rect: rect1, transform: nil) - let path2 = RBPath(rect: rect2, transform: nil) + let path1 = ORBPath(rect: rect1, transform: nil) + let path2 = ORBPath(rect: rect2, transform: nil) let storage1 = path1.storage let storage2 = path2.storage storage1.initialize(capacity: 96, source: nil) @@ -78,10 +78,10 @@ struct PathStorageTests { path2.release() } - @Test("Verify no crash or memleak of RBPathStorageGetCGPath call", arguments: 1...20) + @Test("Verify no crash or memleak of ORBPathStorageGetCGPath call", arguments: 1...20) func storageGetCGPath(iteration: Int) { let rect = CGRect(x: 0, y: 0, width: 100, height: 100) - let path = RBPath(rect: rect, transform: nil) + let path = ORBPath(rect: rect, transform: nil) let storage = path.storage storage.initialize(capacity: 64, source: nil) storage.append(path: path) diff --git a/Tests/OpenRenderBoxCompatibilityTests/PathTests.swift b/Tests/OpenRenderBoxCompatibilityTests/PathTests.swift index b1c029a..2718190 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/PathTests.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/PathTests.swift @@ -12,35 +12,35 @@ struct PathTests { @Test func createRectPath() { let rect = CGRect(x: 0, y: 0, width: 100, height: 100) - let path = RBPath(rect: rect, transform: nil) + let path = ORBPath(rect: rect, transform: nil) path.release() } @Test func createEllipsePath() { let rect = CGRect(x: 0, y: 0, width: 100, height: 50) - let path = RBPath(ellipseIn: rect, transform: nil) + let path = ORBPath(ellipseIn: rect, transform: nil) path.release() } @Test func createRoundedRectPath() { let rect = CGRect(x: 0, y: 0, width: 100, height: 100) - let path = RBPath(roundedRect: rect, cornerWidth: 10, cornerHeight: 10, style: .circular, transform: nil) + let path = ORBPath(roundedRect: rect, cornerWidth: 10, cornerHeight: 10, style: .circular, transform: nil) path.release() } @Test func createUnevenRoundedRectPath() { let rect = CGRect(x: 0, y: 0, width: 100, height: 100) - let path = RBPath(roundedRect: rect, topLeftRadius: 5, bottomLeftRadius: 10, bottomRightRadius: 15, topRightRadius: 20, style: .continuous, transform: nil) + let path = ORBPath(roundedRect: rect, topLeftRadius: 5, bottomLeftRadius: 10, bottomRightRadius: 15, topRightRadius: 20, style: .continuous, transform: nil) path.release() } @Test func pathRetainRelease() { let rect = CGRect(x: 0, y: 0, width: 100, height: 100) - let path = RBPath(rect: rect, transform: nil) + let path = ORBPath(rect: rect, transform: nil) path.retain() path.release() path.release() @@ -55,18 +55,18 @@ struct PathTests { ]) func pathContainsPoint(point: CGPoint, expected: Bool) { let rect = CGRect(x: 0, y: 0, width: 100, height: 100) - let path = RBPath(rect: rect, transform: nil) + let path = ORBPath(rect: rect, transform: nil) #expect(path.contains(point: point, eoFill: false) == expected) path.release() } @Test func pathIsEmpty() { - let emptyPath = RBPath.null + let emptyPath = ORBPath.null #expect(emptyPath.isEmpty == true) let rect = CGRect(x: 0, y: 0, width: 100, height: 100) - let path = RBPath(rect: rect, transform: nil) + let path = ORBPath(rect: rect, transform: nil) #expect(path.isEmpty == false) path.release() } @@ -75,7 +75,7 @@ struct PathTests { func pathApplyElements() { let rect = CGRect(x: 0, y: 0, width: 10, height: 10) let cgPath = CGPath(rect: rect, transform: nil) - let path = RBPath(cgPath: cgPath) + let path = ORBPath(cgPath: cgPath) var elementCount: Int32 = 0 path.apply(info: &elementCount) { info, element, points, userInfo in let countPtr = info.assumingMemoryBound(to: Int32.self) @@ -89,15 +89,15 @@ struct PathTests { @Test func pathEqualToPath() { let rect = CGRect(x: 0, y: 0, width: 100, height: 100) - let path1 = RBPath(rect: rect, transform: nil) - let path2 = RBPath(rect: rect, transform: nil) + let path1 = ORBPath(rect: rect, transform: nil) + let path2 = ORBPath(rect: rect, transform: nil) #expect(path1.isEqual(to: path2) == true) path1.release() path2.release() let differentRect = CGRect(x: 0, y: 0, width: 200, height: 200) - let path3 = RBPath(rect: rect, transform: nil) - let path4 = RBPath(rect: differentRect, transform: nil) + let path3 = ORBPath(rect: rect, transform: nil) + let path4 = ORBPath(rect: differentRect, transform: nil) #expect(path3.isEqual(to: path4) == false) path3.release() path4.release() diff --git a/Tests/OpenRenderBoxCompatibilityTests/SymbolAnimatorTests.swift b/Tests/OpenRenderBoxCompatibilityTests/SymbolAnimatorTests.swift index c57e42b..d25bf2a 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/SymbolAnimatorTests.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/SymbolAnimatorTests.swift @@ -11,7 +11,7 @@ import CoreGraphics struct SymbolAnimatorTests { @Test func basicProperties() { - let animator = RBSymbolAnimator() + let animator = ORBSymbolAnimator() // Default state #expect(animator.isAnimating == false) @@ -33,7 +33,7 @@ struct SymbolAnimatorTests { @Test func renderingProperties() { - let animator = RBSymbolAnimator() + let animator = ORBSymbolAnimator() animator.renderingMode = 1 #expect(animator.renderingMode == 1) @@ -53,7 +53,7 @@ struct SymbolAnimatorTests { @Test func animationManagement() { - let animator = RBSymbolAnimator() + let animator = ORBSymbolAnimator() // removeAllAnimations on empty animator should not crash animator.removeAllAnimations() @@ -64,7 +64,7 @@ struct SymbolAnimatorTests { @Test func timeAndVelocity() { - let animator = RBSymbolAnimator() + let animator = ORBSymbolAnimator() animator.currentTime = 1.5 #expect(animator.currentTime == 1.5) @@ -75,7 +75,7 @@ struct SymbolAnimatorTests { @Test func rectProperties() { - let animator = RBSymbolAnimator() + let animator = ORBSymbolAnimator() _ = animator.alignmentRect _ = animator.unroundedAlignmentRect _ = animator.boundingRect diff --git a/Tests/OpenRenderBoxCompatibilityTests/UUIDTests.swift b/Tests/OpenRenderBoxCompatibilityTests/UUIDTests.swift index 6ef5923..93ae7ee 100644 --- a/Tests/OpenRenderBoxCompatibilityTests/UUIDTests.swift +++ b/Tests/OpenRenderBoxCompatibilityTests/UUIDTests.swift @@ -28,7 +28,7 @@ struct UUIDTests { ]) func foundationUUID(uuid: UUID, expectedBytes: [UInt8]) { #if canImport(Darwin) - let id = RBUUID(uuid: uuid) + let id = ORBUUID(uuid: uuid) let bytes = id.bytes #expect(bytes.0 == expectedBytes[0]) #expect(bytes.1 == expectedBytes[1]) @@ -83,7 +83,7 @@ struct UUIDTests { ), ]) func strongHashUUID(words: (UInt32, UInt32, UInt32, UInt32, UInt32), expectedBytes: [UInt8]) { - let id: RBUUID = RBUUID(UInt64(words.0) | UInt64(words.1) &<< 32, UInt64(words.2) | UInt64(words.3) &<< 32, words.4) + let id: ORBUUID = ORBUUID(UInt64(words.0) | UInt64(words.1) &<< 32, UInt64(words.2) | UInt64(words.3) &<< 32, words.4) let bytes = id.bytes #expect(bytes.0 == expectedBytes[0]) #expect(bytes.1 == expectedBytes[1])