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: 1 addition & 1 deletion Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Sources/OpenRenderBox/Render/ORBDisplayList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public final class ORBDisplayList: NSObject, ORBDisplayListContents {

// MARK: - Contents

public func moveContents() -> (any ORBDisplayListContents)? {
public func moveContents() -> any ORBDisplayListContents {
_openRenderBoxUnimplementedFailure()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ ORB_ASSUME_NONNULL_BEGIN
- (void)drawDisplayList:(id<ORBDisplayListContents>)list alpha:(float)alpha;
- (void)drawInRect:(CGRect)rect alpha:(float)alpha blendMode:(int)mode flags:(unsigned int)flags operation:(id /* block */)operation;
- (void)renderInContext:(CGContextRef)context options:(nullable id)options;
- (nullable id<ORBDisplayListContents>)moveContents;
- (id<ORBDisplayListContents>)moveContents;
- (void)setIdentifier:(unsigned int)identifier namespace:(nullable NSUUID *)ns;
- (void)beginRecordingXML;
- (void)addAffineTransformStyle:(CGAffineTransform)style;
Expand Down
19 changes: 15 additions & 4 deletions Tests/OpenRenderBoxCompatibilityTests/DisplayListTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,20 @@ struct DisplayListTests {
context.fill([CGRect(x: 0, y: 0, width: 10, height: 10)])
displayList.endCGContext()

let contents = displayList.moveContents()
#expect(contents != nil)
let contents: any ORBDisplayListContents = displayList.moveContents()
#expect(!contents.isEmpty())
#expect(displayList.isEmpty())

let emptyContents: any ORBDisplayListContents = displayList.moveContents()
#expect(emptyContents.isEmpty())
#expect(displayList.isEmpty())
}

@Test
func testMoveEmptyContents() {
let displayList = ORBDisplayList()
let contents: any ORBDisplayListContents = displayList.moveContents()
#expect(contents.isEmpty())
#expect(displayList.isEmpty())
}

Expand Down Expand Up @@ -94,8 +106,7 @@ struct DisplayListTests {
displayList.endCGContext()

let contents = displayList.moveContents()
#expect(contents != nil)
#expect(contents!.isEmpty() == false)
#expect(!contents.isEmpty())
}
#endif
}
Expand Down
Loading