Skip to content

Commit

Permalink
[update] use new curve element (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mc-Zen authored Feb 20, 2025
1 parent f6a4581 commit 036044f
Show file tree
Hide file tree
Showing 17 changed files with 35 additions and 15 deletions.
28 changes: 17 additions & 11 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- src/**
- tests/**
- examples/**
- .github/**
pull_request:
branches: [ main ]

Expand All @@ -22,17 +23,22 @@ jobs:
packages: cargo
version: 1.0

- name: Install typst-test from github
uses: baptiste0928/cargo-install@v2.2.0
- name: Install tytanic from crates.io
uses: baptiste0928/cargo-install@v3.0.0
with:
crate: typst-test
git: https://github.com/tingerrr/typst-test.git
tag: ci-semi-stable

- name: Setup typst
uses: typst-community/setup-typst@v3
with:
typst-version: 'v0.13.0'
crate: tytanic
version: '0.2.0'

- name: Run test suite
run: typst-test run
run: tt run

- name: Archive artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: artifacts
path: |
tests/**/diff/*.png
tests/**/out/*.png
tests/**/ref/*.png
retention-days: 5
2 changes: 1 addition & 1 deletion src/arrow.typ
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
let w = width/2
let v1 = (arrow-start.at(0) - w*normal.at(0), arrow-start.at(1) - w*normal.at(1))
let v2 = (arrow-start.at(0) + w*normal.at(0), arrow-start.at(1) + w*normal.at(1))
path(arrow-end, v1, v2, closed: true, fill: arrow-color)
polygon(arrow-end, v1, v2, fill: arrow-color)
}

#let test-arrow() = {
Expand Down
20 changes: 17 additions & 3 deletions src/draw-functions.typ
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,13 @@
width: width, height: height, inset: 0pt,
{
let center-x = width / 2
place(path((0%, 110%), ((50%, 40%), (-40%, 0pt)), (100%, 110%), stroke: stroke))
// place(path((0%, 110%), ((50%, 40%), (-40%, 0pt)), (100%, 110%), stroke: stroke))
place(curve(
curve.move((0%, 110%)),
curve.quad((13%, 40%), (50%, 40%)),
curve.quad(auto, (100%, 110%)),
stroke: stroke
))
set align(left)
arrow.draw-arrow((center-x, height * 1.2), (width * .9, height*.3), length: 3.8pt, width: 2.8pt, stroke: stroke, arrow-color: draw-params.color)
})
Expand Down Expand Up @@ -187,9 +193,17 @@
let y-from = draw-params.center-y-coords.at(from + gate.qubit) - y0
let y-to = draw-params.center-y-coords.at(to + gate.qubit) - y0
if separation != none {
place(path(((0pt,y-from), (-bend, 0pt)), ((width, y-to), (-bend, 0pt)), stroke: separation))
place(curve(
curve.move((0pt, y-from)),
curve.cubic((bend, y-from), (width - bend, y-to), (width, y-to)),
stroke: separation
))
}
place(path(((-.1pt,y-from), (-bend, 0pt)), ((width+.1pt, y-to), (-bend, 0pt)), stroke: draw-params.wire))
place(curve(
curve.move((-.1pt, y-from)),
curve.cubic((bend, y-from), (width + .1pt - bend, y-to), (width + .1pt, y-to)),
stroke: draw-params.wire
))
}
}
)
Expand Down
Binary file modified tests/examples/fault-tolerant-measurement/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/examples/fault-tolerant-toffoli1/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/examples/fault-tolerant-toffoli2/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/examples/teleportation/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/gates/meter/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/gates/meter/ref/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/gates/meter/ref/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/gates/permute/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/gates/permute/ref/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/gates/permute/ref/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/layout/placed-items/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/tequila/basic/ref/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/tequila/basic/ref/8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/wire/mode/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 036044f

Please sign in to comment.