mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
🐛 Relax schema for importing plain path data related to curve-to command
Some checks failed
Commit Message Check / Check Commit Message (push) Has been cancelled
Some checks failed
Commit Message Check / Check Commit Message (push) Has been cancelled
This commit is contained in:
@@ -498,10 +498,10 @@
|
|||||||
[:map
|
[:map
|
||||||
[:x schema:safe-number]
|
[:x schema:safe-number]
|
||||||
[:y schema:safe-number]
|
[:y schema:safe-number]
|
||||||
[:c1x schema:safe-number]
|
[:c1x {:optional true} schema:safe-number]
|
||||||
[:c1y schema:safe-number]
|
[:c1y {:optional true} schema:safe-number]
|
||||||
[:c2x schema:safe-number]
|
[:c2x {:optional true} schema:safe-number]
|
||||||
[:c2y schema:safe-number]]]])
|
[:c2y {:optional true} schema:safe-number]]]])
|
||||||
|
|
||||||
(def ^:private schema:segment
|
(def ^:private schema:segment
|
||||||
[:multi {:title "PathSegment"
|
[:multi {:title "PathSegment"
|
||||||
|
|||||||
@@ -116,6 +116,27 @@
|
|||||||
(t/is (= sample-content
|
(t/is (= sample-content
|
||||||
(vec pdata)))))
|
(vec pdata)))))
|
||||||
|
|
||||||
|
|
||||||
|
;; Test the specific case where cuve-to commands comes without the
|
||||||
|
;; optional attrs
|
||||||
|
(t/deftest path-data-plain-to-binary-2
|
||||||
|
(let [plain-content
|
||||||
|
[{:command :move-to :params {:x 480.0 :y 839.0}}
|
||||||
|
{:command :line-to :params {:x 439.0 :y 802.0}}
|
||||||
|
{:command :curve-to :params {:x 264.0 :y 634.0}}
|
||||||
|
{:command :curve-to :params {:x 154.0 :y 508.0}}]
|
||||||
|
|
||||||
|
binary-content
|
||||||
|
(path/content plain-content)]
|
||||||
|
|
||||||
|
#?(:clj
|
||||||
|
(t/is (= "M480.0,839.0L439.0,802.0C264.0,634.0,264.0,634.0,264.0,634.0C154.0,508.0,154.0,508.0,154.0,508.0"
|
||||||
|
(str binary-content)))
|
||||||
|
|
||||||
|
:cljs
|
||||||
|
(t/is (= "M480,839L439,802C264,634,264,634,264,634C154,508,154,508,154,508"
|
||||||
|
(str binary-content))))))
|
||||||
|
|
||||||
(t/deftest path-data-from-binary
|
(t/deftest path-data-from-binary
|
||||||
(let [barray #?(:clj (byte-array sample-bytes)
|
(let [barray #?(:clj (byte-array sample-bytes)
|
||||||
:cljs (js/Int8Array.from sample-bytes))
|
:cljs (js/Int8Array.from sample-bytes))
|
||||||
|
|||||||
Reference in New Issue
Block a user