Skip to content

Commit

Permalink
🧪 labs: Rework random rectangle generation (#462)
Browse files Browse the repository at this point in the history
Rework random rectangle generation to avoid rounding differences on Mac and
Linux. This is not going to the bottom of the problem, just making the build
pass again on mac for now.

Additionally a vulnerability has been found by govulncheck in the crypto stdlib.
An upgrade with `hermit upgrade go` from 1.23.5 to 1.23.6 fixes the build.

This merges the following commits:
* e2e: Add slight pixel tolerance to no-diagonal test
* tools: Upgrade go
* labs: Rework random rectangle generation

     bin/{.go-1.23.5.pkg => .go-1.23.6.pkg}    |   0
     bin/go                                    |   2 +-
     bin/gofmt                                 |   2 +-
     e2e/play/test.js                          |   2 +-
     frontend/lab/samples/ifs/img/randrect.evy |  16 +-
     frontend/lab/samples/ifs/img/randrect.svg | 420 ++++------------------
     6 files changed, 75 insertions(+), 367 deletions(-)

Pull-request: #462
  • Loading branch information
juliaogris committed Feb 8, 2025
2 parents a087a81 + 6f2a675 commit 2fda484
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 367 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion bin/go
2 changes: 1 addition & 1 deletion bin/gofmt
2 changes: 1 addition & 1 deletion e2e/play/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ end
test("dialogs", async ({ page, baseURL }, testInfo) => {
await page.goto(baseURL)
await page.waitForLoadState("networkidle")
await expect(page).toHaveScreenshot("no-dialog.png")
await expect(page).toHaveScreenshot("no-dialog.png", { maxDiffPixelRatio: 0.01 })

// show sidebar
if (testInfo.project.name != "ios") {
Expand Down
16 changes: 12 additions & 4 deletions frontend/lab/samples/ifs/img/randrect.evy
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
fill (hsl 270 100 50 10)
width 0.2
for range 60
x := (rand1) * 100
y := (rand1) * 100
s1 := (rand1) * 25 + 2
s2 := (rand1) * 25 + 2
x := roundedRand1 * 100
y := roundedRand1 * 100
s1 := roundedRand1 * 25 + 2
s2 := roundedRand1 * 25 + 2

move x-s1*0.5 y-s2*0.5
rect s1 s2
end

// roundedRand1 is a rounding rand1 function, to avoid rounding differences on
// Mac and Linux.
func roundedRand1:num
r := rand1 * 1024
r = round r
return r / 1024
end
Loading

0 comments on commit 2fda484

Please sign in to comment.