Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 39 lines (33 sloc) 1.522 kb
304ac5d @daveray Started working stylesheets. It's almost too boring to include, but more
authored
1 ; Copyright (c) Dave Ray, 2011. All rights reserved.
2
3 ; The use and distribution terms for this software are covered by the
4 ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
5 ; which can be found in the file epl-v10.html at the root of this
6 ; distribution.
7 ; By using this software in any fashion, you are agreeing to be bound by
8 ; the terms of this license.
9 ; You must not remove this notice, or any other, from this software.
10
11 (ns seesaw.test.style
12 (:use seesaw.style
13 [seesaw.core :only [border-panel label button config text]]
14 [seesaw.color :only [to-color]])
15 (:use [lazytest.describe :only (describe it testing)]
16 [lazytest.expect :only (expect)]))
17
18 (describe apply-stylesheet
19
20 (it "returns its input"
21 (let [lbl (label)]
22 (expect (= lbl (apply-stylesheet lbl {})))))
23
24 (it "changes styles of widget for rules that match"
25 (let [lbl (label :id :lbl)
26 btn-a (button :class :btn)
27 btn-b (button :class :btn :id :btn-b)
28 p (border-panel :center lbl :north btn-a :south btn-b)]
29 (apply-stylesheet p
30 {[:#lbl] { :background :aliceblue
31 :text "hi"}
32 [:.btn] { :foreground :red }
33 [:#btn-b] {:text "B"}})
34 (expect (= (to-color :aliceblue) (config lbl :background)))
35 (expect (= "hi" (text lbl)))
36 (expect (= "B" (text btn-b)))
37 (expect (= (to-color :red) (config btn-a :foreground)))
38 (expect (= (to-color :red) (config btn-b :foreground))))))
Something went wrong with that request. Please try again.