Native screenshot command helpers for Windows, Linux, and macOS.
Dependencies
test {
let area = @screenshots.clamp_area({ x: -4, y: 8, width: 0, height: 120 })
inspect(area, content="{ x: 0, y: 8, width: 1, height: 120 }")
}test {
let target = @screenshots.Area({ x: 10, y: 20, width: 300, height: 200 })
inspect(@screenshots.target_label(target), content="area-10-20-300x200")
}test {
let area = @screenshots.clamp_area({ x: -8, y: 4, width: 0, height: 12 })
inspect(area, content="{ x: 0, y: 4, width: 1, height: 12 }")
}impl Show for CaptureAreapub(all) enum CaptureTarget {
AllDisplays
Display(Int)
Window(UInt64)
Area(CaptureArea)
} derive(Eq, Debug)test {
let target = @screenshots.Area({ x: 10, y: 20, width: 300, height: 200 })
inspect(@screenshots.target_label(target), content="area-10-20-300x200")
}impl Show for CaptureTargettest {
let area = @screenshots.clamp_area({ x: -10, y: 5, width: 0, height: -3 })
inspect(area, content="{ x: 0, y: 5, width: 1, height: 1 }")
}test {
debug_inspect(
@screenshots.intersect({ x: 0, y: 0, width: 10, height: 10 }, {
x: 4,
y: 3,
width: 10,
height: 2,
}),
content="Some({ x: 4, y: 3, width: 6, height: 2 })",
)
}fn output_name(prefix : String, index : Int) -> Stringtest {
inspect(@screenshots.output_name("capture", 3), content="capture-3.png")
inspect(@screenshots.output_name("capture", -1), content="capture-0.png")
}test {
inspect(
@screenshots.pixel_count({ x: 0, y: 0, width: 4, height: 3 }),
content="12",
)
inspect(
@screenshots.pixel_count({ x: 0, y: 0, width: 0, height: 3 }),
content="3",
)
}test {
inspect(
@screenshots.target_label(Area({ x: -1, y: 5, width: 0, height: 4 })),
content="area-0-5-1x4",
)
}Native screenshot command helpers for Windows, Linux, and macOS.
Dependencies