Skip to content
Browse files

Add create test

  • Loading branch information...
1 parent b946221 commit 9ccbd950d32a3ca6a46c99737ae35ad96e575ea2 @sattvik committed Mar 14, 2011
Showing with 16 additions and 4 deletions.
  1. +16 −4 test/src/clojure/neko/dialog/alert_test.clj
View
20 test/src/clojure/neko/dialog/alert_test.clj
@@ -15,12 +15,15 @@
(:gen-class :main false
:extends android.test.AndroidTestCase
:methods [[testNewBuilder [] void]
+ [testBasicCreate [] void]
]
:exposes-methods {setUp superSetUp}
)
- (:import neko.dialog.alert.FunctionalAlertDialogBuilder)
+ (:import android.app.AlertDialog$Builder
+ neko.dialog.alert.FunctionalAlertDialogBuilder)
(:use junit.assert
neko.context
+ neko.find-view
neko.dialog.alert
)
)
@@ -42,7 +45,16 @@
(does-throw AssertionError (new-builder "neko"))
(is (instance? FunctionalAlertDialogBuilder (new-builder @context)))
(with-context @context
- (is (instance? FunctionalAlertDialogBuilder (new-builder))))
+ (is (instance? FunctionalAlertDialogBuilder (new-builder)))))
-
- )
+(defn -testBasicCreate
+ "Tests that the create function works with no other set-up."
+ [this]
+ (let [test-builder (fn [builder]
+ ; a simple test that just ensures a view exists
+ (let [dialog (create builder)]
+ (is-not-nil (find-view dialog :android/icon))))]
+ ; test with android builder
+ (test-builder (AlertDialog$Builder. @context))
+ ; test with functional builder
+ (test-builder (new-builder @context))))

0 comments on commit 9ccbd95

Please sign in to comment.
Something went wrong with that request. Please try again.