incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [33/37] spec commit: converted camera tests
Date Wed, 18 Apr 2012 21:49:53 GMT
converted camera tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/commit/db171ea5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/tree/db171ea5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/diff/db171ea5

Branch: refs/heads/master
Commit: db171ea5134cafdf2bc24a3c644fd9bd559ef8b2
Parents: 7785df5
Author: Gord Tanner <gtanner@gmail.com>
Authored: Mon Apr 2 22:56:00 2012 -0400
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Mon Apr 16 16:05:12 2012 -0700

----------------------------------------------------------------------
 autotest/pages/camera.html     |   46 ++++++++++++++++++
 autotest/tests/camera.tests.js |   91 +++++++++++++++++------------------
 2 files changed, 90 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/blob/db171ea5/autotest/pages/camera.html
----------------------------------------------------------------------
diff --git a/autotest/pages/camera.html b/autotest/pages/camera.html
index e83fb5d..f2a01f3 100644
--- a/autotest/pages/camera.html
+++ b/autotest/pages/camera.html
@@ -1,5 +1,6 @@
 <!DOCTYPE html>
 <html>
+<<<<<<< HEAD
   <head>
     <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
     <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes,
initial-scale=1.0;" />
@@ -48,6 +49,51 @@
             <!-- Populated by tests -->
         </div>
     </body>
+=======
+<head>
+  <title>Cordova: Camera API Specs</title>
+
+  <!-- Load jasmine -->
+  <link href="../jasmine.css" rel="stylesheet"/>
+  <script type="text/javascript" src="../jasmine.js"></script>
+  <script type="text/javascript" src="../html/HtmlReporterHelpers.js"></script>
+  <script type="text/javascript" src="../html/HtmlReporter.js"></script>
+  <script type="text/javascript" src="../html/ReporterView.js"></script>
+  <script type="text/javascript" src="../html/SpecView.js"></script>
+  <script type="text/javascript" src="../html/SuiteView.js"></script>
+  <script type="text/javascript" src="../html/TrivialReporter.js"></script>
+
+  <!-- Source -->
+  <script type="text/javascript" src="../../phonegap.js"></script>
+
+  <!-- Load Test Runner -->
+  <script type="text/javascript" src="../test-runner.js"></script>
+
+  <!-- Tests -->
+  <script type="text/javascript" src="../tests/camera.tests.js"></script>
+
+  <script type="text/javascript">
+    document.addEventListener('deviceready', function () {
+      var jasmineEnv = jasmine.getEnv();
+      jasmineEnv.updateInterval = 1000;
+
+      var htmlReporter = new jasmine.HtmlReporter();
+
+      jasmineEnv.addReporter(htmlReporter);
+
+      jasmineEnv.specFilter = function(spec) {
+        return htmlReporter.specFilter(spec);
+      };
+
+      jasmineEnv.execute();
+    }, false);
+  </script>
+</head>
+
+<body>
+  <a href="javascript:" class="backBtn" onclick="backHome();">Back</a>
+</body>
+>>>>>>> converted camera tests
 </html>
 
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/blob/db171ea5/autotest/tests/camera.tests.js
----------------------------------------------------------------------
diff --git a/autotest/tests/camera.tests.js b/autotest/tests/camera.tests.js
index 2e55f9d..9b6b04c 100644
--- a/autotest/tests/camera.tests.js
+++ b/autotest/tests/camera.tests.js
@@ -1,50 +1,47 @@
-Tests.prototype.CameraTests = function() {	
-	module('Camera (navigator.camera)');
-	test("should exist", function() {
-      expect(1);
-      ok(navigator.camera !== null, "navigator.camera should not be null.");
+describe('Camera (navigator.camera)', function () {
+	it("should exist", function() {
+        expect(navigator.camera).toBeDefined();
 	});
-	test("should contain a getPicture function", function() {
-		expect(2);
-		ok(typeof navigator.camera.getPicture != 'undefined' && navigator.camera.getPicture
!== null, "navigator.camera.getPicture should not be null.");
-		ok(typeof navigator.camera.getPicture == 'function', "navigator.camera.getPicture should
be a function.");
+
+	it("should contain a getPicture function", function() {
+        expect(navigator.camera.getPicture).toBeDefined();
+		expect(typeof navigator.camera.getPicture == 'function').toBe(true);
 	});
+});
+
+describe('Camera Constants (window.Camera + navigator.camera)', function () {
+    it("window.Camera should exist", function() {
+        expect(window.Camera).toBeDefined();
+    });
+
+    it("should contain two DestinationType constants", function() {
+        expect(Camera.DestinationType.DATA_URL).toBe(0);
+        expect(Camera.DestinationType.FILE_URI).toBe(1);
+        expect(navigator.camera.DestinationType.DATA_URL).toBe(0);
+        expect(navigator.camera.DestinationType.FILE_URI).toBe(1);
+    });
+
+    it("should contain two EncodingType constants", function() {
+        expect(Camera.EncodingType.JPEG).toBe(0);
+        expect(Camera.EncodingType.PNG).toBe(1);
+        expect(navigator.camera.EncodingType.JPEG).toBe(0);
+        expect(navigator.camera.EncodingType.PNG).toBe(1);
+    });
 
-  module('Camera Constants (window.Camera + navigator.camera)');
-  test("window.Camera should exist", function() {
-    expect(1);
-    ok(window.Camera !== null, "window.Camera should not be null.");
-  });
-  test("should contain two DestinationType constants", function() {
-    expect(4);
-    equals(Camera.DestinationType.DATA_URL, 0, "Camera.DestinationType.DATA_URL should equal
to 0");
-    equals(Camera.DestinationType.FILE_URI, 1, "Camera.DestinationType.DATA_URL should equal
to 1");
-    equals(navigator.camera.DestinationType.DATA_URL, 0, "navigator.camera.DestinationType.DATA_URL
should equal to 0");
-    equals(navigator.camera.DestinationType.FILE_URI, 1, "navigator.camera.DestinationType.DATA_URL
should equal to 1");
-  });
-  test("should contain two EncodingType constants", function() {
-    expect(4);
-    equals(Camera.EncodingType.JPEG, 0, "Camera.EncodingType.JPEG should equal to 0");
-    equals(Camera.EncodingType.PNG, 1, "Camera.EncodingType.PNG should equal to 1");
-    equals(navigator.camera.EncodingType.JPEG, 0, "navigator.camera.EncodingType.JPEG should
equal to 0");
-    equals(navigator.camera.EncodingType.PNG, 1, "navigator.camera.EncodingType.PNG should
equal to 1");
-  });
-  test("should contain three MediaType constants", function() {
-    expect(6);
-    equals(Camera.MediaType.PICTURE, 0, 'Camera.MediaType.PICTURE should equal to 0');
-    equals(Camera.MediaType.VIDEO, 1, 'Camera.MediaType.VIDEO should equal to 1');
-    equals(Camera.MediaType.ALLMEDIA, 2, 'Camera.MediaType.ALLMEDIA should equal to 2');
-    equals(navigator.camera.MediaType.PICTURE, 0, 'navigator.camera.MediaType.PICTURE should
equal to 0');
-    equals(navigator.camera.MediaType.VIDEO, 1, 'navigator.camera.MediaType.VIDEO should
equal to 1');
-    equals(navigator.camera.MediaType.ALLMEDIA, 2, 'navigator.camera.MediaType.ALLMEDIA should
equal to 2');
-  });
-  test("should contain three PictureSourceType constants", function() {
-    expect(6);
-    equals(Camera.PictureSourceType.PHOTOLIBRARY, 0, 'Camera.PictureSourceType.PHOTOLIBRARY
should equal to 0');
-    equals(Camera.PictureSourceType.CAMERA, 1, 'Camera.PictureSourceType.CAMERA should equal
to 1');
-    equals(Camera.PictureSourceType.SAVEDPHOTOALBUM, 2, 'Camera.PictureSourceType.SAVEDPHOTOALBUM
should equal to 2');
-    equals(navigator.camera.PictureSourceType.PHOTOLIBRARY, 0, 'navigator.camera.PictureSourceType.PHOTOLIBRARY
should equal to 0');
-    equals(navigator.camera.PictureSourceType.CAMERA, 1, 'navigator.camera.PictureSourceType.CAMERA
should equal to 1');
-    equals(navigator.camera.PictureSourceType.SAVEDPHOTOALBUM, 2, 'navigator.camera.PictureSourceType.SAVEDPHOTOALBUM
should equal to 2');
-  });
-};
+    it("should contain three MediaType constants", function() {
+        expect(Camera.MediaType.PICTURE).toBe(0);
+        expect(Camera.MediaType.VIDEO).toBe(1);
+        expect(Camera.MediaType.ALLMEDIA).toBe(2);
+        expect(navigator.camera.MediaType.PICTURE).toBe(0);
+        expect(navigator.camera.MediaType.VIDEO).toBe(1);
+        expect(navigator.camera.MediaType.ALLMEDIA).toBe(2);
+    });
+    it("should contain three PictureSourceType constants", function() {
+        expect(Camera.PictureSourceType.PHOTOLIBRARY).toBe(0);
+        expect(Camera.PictureSourceType.CAMERA).toBe(1);
+        expect(Camera.PictureSourceType.SAVEDPHOTOALBUM).toBe(2);
+        expect(navigator.camera.PictureSourceType.PHOTOLIBRARY).toBe(0);
+        expect(navigator.camera.PictureSourceType.CAMERA).toBe(1);
+        expect(navigator.camera.PictureSourceType.SAVEDPHOTOALBUM).toBe(2);
+    });
+});


Mime
View raw message