Added convenience overloads to Rect and also, Collection conformance in the Playdate bindings target.
This commit is contained in:
@@ -186,6 +186,12 @@ enum Mock {
|
||||
Mock.record("getTableBitmap(\(index))")
|
||||
return index == 0 ? Mock.fakePointer() : nil
|
||||
}
|
||||
gfxAPI.pointee.getBitmapTableInfo = { _, count, cellsWide in
|
||||
Mock.record("getBitmapTableInfo")
|
||||
// One bitmap, matching getTableBitmap vending index 0 only.
|
||||
count?.pointee = 1
|
||||
cellsWide?.pointee = 1
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Sprite
|
||||
|
||||
@@ -89,6 +89,16 @@ struct WrapperTests {
|
||||
#expect(Mock.eventCount("freeBitmapTable") == 1)
|
||||
}
|
||||
|
||||
@Test func bitmapTableIsACollection() {
|
||||
let table = Graphics.BitmapTable(count: 4, width: 8, height: 8)
|
||||
#expect(table.count == 1) // the mock reports a single bitmap
|
||||
#expect(table.first != nil)
|
||||
|
||||
var visited = 0
|
||||
for _ in table { visited += 1 }
|
||||
#expect(visited == 1)
|
||||
}
|
||||
|
||||
// MARK: Sprite
|
||||
|
||||
@Test func spriteUserdataRecoversWrapperInCallbacks() {
|
||||
|
||||
Reference in New Issue
Block a user