Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing value type conversions; see tests #92

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/fn_fx/render_core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,14 @@
[v _]
(int v))

(defmethod convert-value [Long Integer/TYPE]
[v _]
(int v))

(defmethod convert-value [Integer Integer/TYPE]
[v _]
(int v))

(defmethod convert-value [Double Double/TYPE]
[v _]
(double v))
Expand Down
14 changes: 13 additions & 1 deletion test/fn_fx/fx_dom_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,19 @@
(Thread/sleep 100)
(is (= (get-prop @root :title) "Hello"))))


(deftest test-primitive-type-conversions
(let [default-count (-> :javafx.animation.TranslateTransition
(component {}) dom/app :root)
long-count (-> :javafx.animation.TranslateTransition
(component {:cycle-count 22}) dom/app :root)
integer-count
(-> :javafx.animation.TranslateTransition
(component {:cycle-count javafx.animation.Animation/INDEFINITE})
dom/app :root)]
(Thread/sleep 100)
(is (= 1 (get-prop @default-count :cycle-count)))
(is (= 22 (get-prop @long-count :cycle-count)))
(is (= -1 (get-prop @integer-count :cycle-count)))))

(defn gen-list [cnt]
(let [items (vec (for [x (range cnt)]
Expand Down