-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Erik Corry
committed
Nov 17, 2023
1 parent
1dfbe7a
commit 31a5674
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright (C) 2023 Toitware ApS. | ||
// Use of this source code is governed by a Zero-Clause BSD license that can | ||
// be found in the TESTS_LICENSE file. | ||
// Tests for Label that the change box is smaller when we only | ||
// change part of the text. | ||
import bitmap show * | ||
import expect show * | ||
import font | ||
|
||
import host.file | ||
import pixel_display show * | ||
import pixel_display.element show * | ||
import pixel_display.two_color show WHITE BLACK | ||
import .png_visualizer | ||
|
||
SANS := font.Font.get "sans10" | ||
|
||
main args: | ||
if args.size != 1: | ||
print "Usage: script.toit png-basename" | ||
exit 1 | ||
|
||
basename := args[0] | ||
|
||
driver := TwoColorPngVisualizer 440 240 basename --outline=BLACK | ||
display := TwoColorPixelDisplay driver | ||
display.background = WHITE | ||
|
||
heater-red := file.read_content "tests/third_party/pictogrammers/heater-red.png" | ||
heater-red-uncompressed := file.read_content "tests/third_party/pictogrammers/heater-red-uncompressed.png" | ||
heater-2-bit := file.read_content "tests/third_party/pictogrammers/heater-2-bit.png" | ||
heater-2-bit-uncompressed := file.read_content "tests/third_party/pictogrammers/heater-2-bit-uncompressed.png" | ||
heater-bw := file.read_content "tests/third_party/pictogrammers/heater-bw.png" | ||
heater-bw-uncompressed := file.read_content "tests/third_party/pictogrammers/heater-bw-uncompressed.png" | ||
heater-white-bg := file.read_content "tests/third_party/pictogrammers/heater-white-bg.png" | ||
heater-white-bg-uncompressed := file.read_content "tests/third_party/pictogrammers/heater-white-bg-uncompressed.png" | ||
|
||
display.add (PngElement --x=100 --y=32 heater-red) | ||
display.add (PngElement --x=184 --y=32 heater-2-bit) | ||
display.add (PngElement --x=268 --y=32 heater-bw) | ||
display.add (PngElement --x=352 --y=32 heater-white-bg) | ||
|
||
display.add (PngElement --x=100 --y=120 heater-red-uncompressed) | ||
display.add (PngElement --x=184 --y=120 heater-2-bit-uncompressed) | ||
display.add (PngElement --x=268 --y=120 heater-bw-uncompressed) | ||
display.add (PngElement --x=352 --y=120 heater-white-bg-uncompressed) | ||
|
||
display.draw | ||
|
||
driver.write_png |