clojure-android / neko

The Clojure/Android Toolkit
Other
297 stars 36 forks source link

Make config handle proxies of android.* classses #70

Open satchit8 opened 7 years ago

satchit8 commented 7 years ago

I found another use of keyword-by-classname, so here are similar modifications as with #68.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.02%) to 77.944% when pulling e556a75e78e4439e449b8c9ab52a5ac7b2a624ad on satchit8:config-proxy into df40df53beb604e3db486fe56c62a5f45a3b7163 on clojure-android:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.1%) to 78.044% when pulling 0479ae1ab1d0491e062a484432cdf0134fa940a0 on satchit8:config-proxy into df40df53beb604e3db486fe56c62a5f45a3b7163 on clojure-android:master.

satchit8 commented 7 years ago

After reading more of the existing tests, I see that using multiple let blocks within a single deftest seems to be preferred. So may be the following is more appropraite:

(deftest config
  (let [v (ui/make-ui RuntimeEnvironment/application [:button {:text "hello"}])]
    (is (= View/VISIBLE (.getVisibility v)))
    (is (= "hello" (.getText v)))
    (ui/config v :text "updated" :visibility View/GONE)
    (is (= "updated" (.getText v)))
    (is (= View/GONE (.getVisibility v))))

  (let [ll (ui/make-ui RuntimeEnvironment/application
             [:linear-layout {:custom-constructor
                              (fn [ctx]
                                (proxy [LinearLayout] [ctx]))
                              :orientation :vertical}])]
    (is (= LinearLayout/VERTICAL(.getOrientation ll)))
    (ui/config ll :orientation :horizontal)
    (is (= LinearLayout/HORIZONTAL (.getOrientation ll)))))