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

Update to recent lazytest #236

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
4 changes: 4 additions & 0 deletions .clj-kondo/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{:lint-as {seesaw.test.examples.example/defexample clojure.core/defn}
:linters {:clojure-lsp/unused-public-var {:level :off}
:refer-all {:level :off}
:unused-binding {:level :off}}}
13 changes: 13 additions & 0 deletions .clj-kondo/imports/io.github.noahtheduke/lazytest/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{:lint-as {lazytest.core/defdescribe clojure.core/def
lazytest.core/defcontext clojure.core/def
lazytest.core/defsuite clojure.core/def
lazytest.core/given clojure.core/let
lazytest.core/around clojure.core/fn
;; clojure.test interface
lazytest.experimental.interfaces.clojure-test/deftest clojure.test/deftest
lazytest.experimental.interfaces.clojure-test/testing clojure.test/testing
lazytest.experimental.interfaces.clojure-test/is clojure.test/is
lazytest.experimental.interfaces.clojure-test/are clojure.test/are
;; xunit interface
lazytest.experimental.interfaces.xunit/defsuite clojure.core/def
}}
2 changes: 2 additions & 0 deletions .clj-kondo/imports/metosin/malli/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{:lint-as {malli.experimental/defn schema.core/defn}
:linters {:unresolved-symbol {:exclude [(malli.core/=>)]}}}
4 changes: 4 additions & 0 deletions .clj-kondo/imports/nubank/matcher-combinators/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{:linters
{:unresolved-symbol
{:exclude [(cljs.test/is [match? thrown-match?])
(clojure.test/is [match? thrown-match?])]}}}
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Clojure CI

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

jobs:
clojure:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Prepare java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '11'

- name: Install clojure tools
uses: DeLaGuardo/[email protected]
with:
cli: 1.12.0.1479
lein: 2.11.2

- name: Cache clojure dependencies
uses: actions/cache@v4
with:
path: |
~/.m2/repository
~/.gitlibs
key: cljdeps-${{ hashFiles('project.clj') }}
restore-keys: cljdeps-

- name: run tests
run: lein test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ autodoc/**
.clj-kondo/.cache
.lsp/.cache
.portal/vs-code.edn
.nrepl-port
9 changes: 4 additions & 5 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,20 @@
:distribution :repo
:comments "same as Clojure"}

:warn-on-reflection true

; To run the examples:
;
; $ lein examples
;
:aliases { "examples" ["run" "-m" "seesaw.test.examples.launcher"] }
:aliases {"test" ["run" "-m" "lazytest.main"]
"examples" ["run" "-m" "seesaw.test.examples.launcher"]}

:dependencies [[org.clojure/clojure "1.4.0"]
:dependencies [[org.clojure/clojure "1.11.1"]
[com.miglayout/miglayout "3.7.4"]
[com.jgoodies/forms "1.2.1"]
[org.swinglabs.swingx/swingx-core "1.6.3"]
[j18n "1.0.2"]
[com.fifesoft/rsyntaxtextarea "2.5.6"]]
:profiles { :dev {:dependencies [[com.stuartsierra/lazytest "1.1.2"]
:profiles {:dev {:dependencies [[io.github.noahtheduke/lazytest "1.2.0"]
[lein-autodoc "0.9.0"]]}}
:repositories [["stuartsierra-releases" "https://stuartsierra.com/maven2"]]
:autodoc {
Expand Down
2 changes: 1 addition & 1 deletion src/seesaw/action.clj
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
See:
http://download.oracle.com/javase/6/docs/api/javax/swing/Action.html
"
[& opts]
^Action [& opts]
(let [a (proxy [AbstractAction] []
(actionPerformed [e]
(if-let [f (get-meta this action-handler-property)] (f e))))]
Expand Down
7 changes: 3 additions & 4 deletions src/seesaw/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@
See:
http://download.oracle.com/javase/6/docs/api/javax/swing/JLabel.html
"
[& args]
^JLabel [& args]
(case (count args)
0 (label :text "")
1 (label :text (first args))
Expand Down Expand Up @@ -1532,8 +1532,7 @@
(seesaw.core/style-text!)
http://download.oracle.com/javase/6/docs/api/javax/swing/JTextPane.html
"
{ :arglists '([& args]) }
[& {:as opts}]
^JTextPane [& {:as opts}]
(let [pane (proxy [JTextPane] []
(getScrollableTracksViewportWidth []
(boolean (get-meta this :wrap-lines?))))]
Expand All @@ -1548,7 +1547,7 @@
(seesaw.core/text)
http://download.oracle.com/javase/tutorial/uiswing/components/editorpane.html
"
[^JTextPane target id ^Integer start ^Integer length]
^JTextPane [^JTextPane target id ^Integer start ^Integer length]
(check-args (instance? JTextPane target) "style-text! only applied to styled-text widgets")
(.setCharacterAttributes (.getStyledDocument target)
start length (.getStyle target (name id)) true)
Expand Down
6 changes: 4 additions & 2 deletions src/seesaw/graphics.clj
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
(.setRenderingHint RenderingHints/KEY_ANTIALIASING RenderingHints/VALUE_ANTIALIAS_ON)))

(defn buffered-image
([width height] (buffered-image width height BufferedImage/TYPE_INT_ARGB))
([width height t] (BufferedImage. width height t)))
(^BufferedImage [width height] (buffered-image width height BufferedImage/TYPE_INT_ARGB))
(^BufferedImage [width height t] (BufferedImage. width height t)))

(defn- to-image [v]
(cond
Expand Down Expand Up @@ -137,6 +137,8 @@
(.addPoint p x y))
p))

(declare line-to move-to curve-to quad-to)

(def ^{:private true} path-ops {
'line-to '.lineTo
'move-to '.moveTo
Expand Down
4 changes: 2 additions & 2 deletions src/seesaw/icon.clj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
;*******************************************************************************
; Icons

(defn ^javax.swing.Icon icon
(defn icon
"Loads an icon. The parameter p can be any of the following:

nil - returns nil
Expand All @@ -33,7 +33,7 @@
This is the function used to process the :icon property on most widgets
and windows. Thus, any of these values may be used for the :icon property.
"
[p]
^javax.swing.ImageIcon [p]
(cond
(nil? p) nil
(instance? javax.swing.Icon p) p
Expand Down
2 changes: 1 addition & 1 deletion src/seesaw/keystroke.clj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
arg can also be an i18n resource keyword.

See http://download.oracle.com/javase/6/docs/api/javax/swing/KeyStroke.html#getKeyStroke(java.lang.String)"
[arg]
^KeyStroke [arg]
(cond
(nil? arg) nil
(instance? KeyStroke arg) arg
Expand Down
2 changes: 1 addition & 1 deletion src/seesaw/mig.clj
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
(seesaw.core/default-options)
"
{ :seesaw {:class 'javax.swing.JPanel }}
[& opts]
^javax.swing.JPanel [& opts]
(abstract-panel (net.miginfocom.swing.MigLayout.) opts))

(extend-protocol LayoutManipulation
Expand Down
28 changes: 14 additions & 14 deletions src/seesaw/swingx.clj
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
(declare p-pattern)
(declare p-fn)

(defn- ^HighlightPredicate to-p [v]
(defn- to-p ^HighlightPredicate [v]
(cond
(instance? HighlightPredicate v) v
(instance? java.util.regex.Pattern v) (p-pattern v)
Expand Down Expand Up @@ -159,7 +159,7 @@
:else
(HighlighterFactory/createSimpleStriping)))

(defn ^Highlighter to-highlighter [v]
(defn to-highlighter ^Highlighter [v]
(cond
(instance? Highlighter v) v
(= :shade v) (hl-shade)
Expand Down Expand Up @@ -529,7 +529,7 @@
;*******************************************************************************
; JXList

(def ^ {:private true} sort-order-table
(def ^:private sort-order-table
{ :ascending javax.swing.SortOrder/ASCENDING
:descending javax.swing.SortOrder/DESCENDING})

Expand Down Expand Up @@ -585,7 +585,7 @@
See:
(seesaw.core/listbox)
"
[& args]
^org.jdesktop.swingx.JXList [& args]
(apply-options
(doto (construct org.jdesktop.swingx.JXList)
(.setAutoCreateRowSorter true)
Expand Down Expand Up @@ -633,7 +633,7 @@
See:
(seesaw.core/listbox)
"
[& args]
^org.jdesktop.swingx.JXTitledPanel [& args]
(apply-options
(construct org.jdesktop.swingx.JXTitledPanel)
args))
Expand Down Expand Up @@ -666,7 +666,7 @@
(seesaw.core/tree-options)
(seesaw.core/tree)
"
[& args]
^org.jdesktop.swingx.JXTree [& args]
(apply-options
(doto (construct org.jdesktop.swingx.JXTree)
(.setRolloverEnabled true))
Expand Down Expand Up @@ -707,7 +707,7 @@
(seesaw.core/table-options)
(seesaw.core/table)
"
[& args]
^org.jdesktop.swingx.JXTable [& args]
(apply-options
(doto (construct org.jdesktop.swingx.JXTable)
(.setRolloverEnabled true)
Expand All @@ -731,25 +731,25 @@
(defn- abstract-panel-x [layout opts]
(abstract-panel (construct org.jdesktop.swingx.JXPanel) layout opts))

(defn xyz-panel-x [& opts]
(defn xyz-panel-x ^org.jdesktop.swingx.JXPanel [& opts]
(abstract-panel-x nil opts))

(defn border-panel-x [& opts]
(defn border-panel-x ^org.jdesktop.swingx.JXPanel [& opts]
(abstract-panel-x (java.awt.BorderLayout.) opts))

(defn flow-panel-x [& opts]
(defn flow-panel-x ^org.jdesktop.swingx.JXPanel [& opts]
(abstract-panel-x (java.awt.FlowLayout.) opts))

(defn horizontal-panel-x [& opts]
(defn horizontal-panel-x ^org.jdesktop.swingx.JXPanel [& opts]
(abstract-panel-x (box-layout :horizontal) opts))

(defn vertical-panel-x [& opts]
(defn vertical-panel-x ^org.jdesktop.swingx.JXPanel [& opts]
(abstract-panel-x (box-layout :vertical) opts))

(defn grid-panel-x
[& {:keys [rows columns] :as opts}]
^org.jdesktop.swingx.JXPanel [& {:keys [rows columns] :as opts}]
(abstract-panel-x (grid-layout rows columns) opts))

(defn card-panel-x [& opts]
(defn card-panel-x ^org.jdesktop.swingx.JXPanel [& opts]
(abstract-panel-x (java.awt.CardLayout.) opts))

6 changes: 3 additions & 3 deletions src/seesaw/table.clj
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
(let [[head [_ & tail]] (split-at pos row-vec)]
(vec (concat head tail))))

(defn- ^javax.swing.table.DefaultTableModel proxy-table-model
[column-names column-key-map column-classes]
(defn- proxy-table-model
^javax.swing.table.DefaultTableModel [column-names column-key-map column-classes]
(let [full-values (atom [])]
(proxy [javax.swing.table.DefaultTableModel] [(object-array column-names) 0]
(isCellEditable [row col] false)
Expand Down Expand Up @@ -131,7 +131,7 @@
(seesaw.core/table)
http://download.oracle.com/javase/6/docs/api/javax/swing/table/TableModel.html
"
[& {:keys [columns rows] :as opts}]
^javax.swing.table.DefaultTableModel [& {:keys [columns rows] :as opts}]
(let [norm-cols (map normalize-column columns)
col-names (map :text norm-cols)
col-classes (map :class norm-cols)
Expand Down
2 changes: 1 addition & 1 deletion src/seesaw/timer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

See http://download.oracle.com/javase/6/docs/api/javax/swing/Timer.html
"
[f & {:keys [start? initial-value] :or {start? true} :as opts}]
^javax.swing.Timer [f & {:keys [start? initial-value] :or {start? true} :as opts}]
(let [a (action :handler (timer-handler f initial-value))
t (javax.swing.Timer. 0 a)]
(.setDelay t 1000)
Expand Down
10 changes: 5 additions & 5 deletions src/seesaw/util.clj
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,19 @@
(cast c x)
(catch ClassCastException e nil)))

(defn ^URL to-url
(defn to-url
"Try to parse (str s) as a URL. Returns new java.net.URL on success, nil
otherwise. This is different from clojure.java.io/as-url in that it doesn't
throw an exception and it uses (str) on the input."
[s]
^URL [s]
(if (instance? URL s) s
(try
(URL. (str s))
(catch MalformedURLException e nil))))

(defn ^URI to-uri
(defn to-uri
"Try to make a java.net.URI from s"
[s]
^URI [s]
(cond
(instance? URI s) s
(instance? URL s) (.toURI ^URL s)
Expand All @@ -132,7 +132,7 @@
(catch URISyntaxException e nil))))

(defn to-dimension
[v]
^java.awt.Dimension [v]
(cond
(instance? java.awt.Dimension v) v
(and (vector? v) (= 3 (count v)) (= :by (second v)))
Expand Down
4 changes: 2 additions & 2 deletions src/seesaw/widgets/rounded_label.clj
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
See:
(seesaw.core/label)
"
[& opts]
^javax.swing.JLabel [& opts]
(let [radius 15
paint (fn [^javax.swing.JLabel c ^java.awt.Graphics g]
(doto g
(.setColor (.getBackground c))
(.fillRoundRect
0 0 (dec (.getWidth c)) (dec (.getHeight c))
@radius @radius)))
radius radius)))
widget (rounded-label-proxy paint)]
(apply-options widget opts)))

Expand Down
Loading