You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2012/04/10 00:40:30 UTC
[27/34] updated mobile spec tests for CordovaJS
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/pages/accelerometer.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/accelerometer.html b/tests/MobileSpecUnitTests/www/autotest/pages/accelerometer.html
new file mode 100644
index 0000000..af0ae42
--- /dev/null
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/accelerometer.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+ <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;" />
+
+ <title>Cordova: Accelerometer API Specs</title>
+
+ <!-- Load QUnit -->
+ <link rel="stylesheet" type="text/css" href="../qunit.css" />
+ <script type="text/javascript" src="../qunit.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/accelerometer.tests.js"></script>
+ <script type="text/javascript">
+ document.addEventListener('deviceready', function() {
+ console.log('running tests');
+ var tests = new Tests();
+
+ // Each group of tests are declared as a function in the object `Tests`.
+ // A group of tests are identified by a name that contains the word 'Tests'.
+ //
+ // Load each group of tests into QUnit
+ for (var t in tests) {
+ if (t.indexOf('Tests') > -1) {
+ tests[t]();
+ }
+ }
+
+ // Start the QUnit test suite
+ QUnit.start();
+ }, false);
+ </script>
+ </head>
+ <body>
+ <div class="backBtn" onclick="backHome();">Back</div>
+ <h1 id="qunit-header">Cordova: Accelerometer API Specs</h1>
+ <h2 id="qunit-banner"></h2>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture">
+ <!-- Populated by tests -->
+ </div>
+ </body>
+</html>
+
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/pages/all.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/all.html b/tests/MobileSpecUnitTests/www/autotest/pages/all.html
new file mode 100644
index 0000000..6b045ab
--- /dev/null
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/all.html
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html>
+ <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;" />
+
+ <title>Cordova: All API Specs</title>
+
+ <!-- Load QUnit -->
+ <link rel="stylesheet" type="text/css" href="../qunit.css" />
+ <script type="text/javascript" src="../qunit.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/accelerometer.tests.js"></script>
+ <script type="text/javascript" src="../tests/battery.tests.js"></script>
+ <script type="text/javascript" src="../tests/capture.tests.js"></script>
+ <script type="text/javascript" src="../tests/compass.tests.js"></script>
+ <script type="text/javascript" src="../tests/contacts.tests.js"></script>
+ <script type="text/javascript" src="../tests/camera.tests.js"></script>
+ <script type="text/javascript" src="../tests/device.tests.js"></script>
+ <script type="text/javascript" src="../tests/file.tests.js"></script>
+ <script type="text/javascript" src="../tests/geolocation.tests.js"></script>
+ <script type="text/javascript" src="../tests/media.tests.js"></script>
+ <script type="text/javascript" src="../tests/network.tests.js"></script>
+ <script type="text/javascript" src="../tests/notification.tests.js"></script>
+ <script type="text/javascript" src="../tests/platform.tests.js"></script>
+ <script type="text/javascript" src="../tests/storage.tests.js"></script>
+ <script type="text/javascript">
+ document.addEventListener('deviceready', function() {
+ console.log('running tests');
+ var tests = new Tests();
+
+ // Each group of tests are declared as a function in the object `Tests`.
+ // A group of tests are identified by a name that contains the word 'Tests'.
+ //
+ // Load each group of tests into QUnit
+ for (var t in tests) {
+ if (t.indexOf('Tests') > -1) {
+ tests[t]();
+ }
+ }
+
+ // Start the QUnit test suite
+ QUnit.start();
+ }, false);
+ </script>
+ </head>
+ <body>
+ <div class="backBtn" onclick="backHome();">Back</div>
+ <h1 id="qunit-header">Cordova: All API Specs</h1>
+ <h2 id="qunit-banner"></h2>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture">
+ <!-- Populated by tests -->
+ </div>
+ </body>
+</html>
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/pages/battery.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/battery.html b/tests/MobileSpecUnitTests/www/autotest/pages/battery.html
new file mode 100644
index 0000000..19b1ee6
--- /dev/null
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/battery.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+ <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;" />
+
+ <title>Cordova: Battery API Specs</title>
+
+ <!-- Load QUnit -->
+ <link rel="stylesheet" type="text/css" href="../qunit.css" />
+ <script type="text/javascript" src="../qunit.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/battery.tests.js"></script>
+ <script type="text/javascript">
+ document.addEventListener('deviceready', function() {
+ console.log('running tests');
+ var tests = new Tests();
+
+ // Each group of tests are declared as a function in the object `Tests`.
+ // A group of tests are identified by a name that contains the word 'Tests'.
+ //
+ // Load each group of tests into QUnit
+ for (var t in tests) {
+ if (t.indexOf('Tests') > -1) {
+ tests[t]();
+ }
+ }
+
+ // Start the QUnit test suite
+ QUnit.start();
+ }, false);
+ </script>
+ </head>
+ <body>
+ <div class="backBtn" onclick="backHome();">Back</div>
+ <h1 id="qunit-header">Cordova: Battery API Specs</h1>
+ <h2 id="qunit-banner"></h2>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture">
+ <!-- Populated by tests -->
+ </div>
+ </body>
+</html>
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/pages/camera.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/camera.html b/tests/MobileSpecUnitTests/www/autotest/pages/camera.html
new file mode 100644
index 0000000..e83fb5d
--- /dev/null
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/camera.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+ <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;" />
+
+ <title>Cordova: Camera API Specs</title>
+
+ <!-- Load QUnit -->
+ <link rel="stylesheet" type="text/css" href="../qunit.css" />
+ <script type="text/javascript" src="../qunit.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() {
+ console.log('running tests');
+ var tests = new Tests();
+
+ // Each group of tests are declared as a function in the object `Tests`.
+ // A group of tests are identified by a name that contains the word 'Tests'.
+ //
+ // Load each group of tests into QUnit
+ for (var t in tests) {
+ if (t.indexOf('Tests') > -1) {
+ tests[t]();
+ }
+ }
+
+ // Start the QUnit test suite
+ QUnit.start();
+ }, false);
+ </script>
+ </head>
+ <body>
+ <div class="backBtn" onclick="backHome();">Back</div>
+ <h1 id="qunit-header">Cordova: Camera API Specs</h1>
+ <h2 id="qunit-banner"></h2>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture">
+ <!-- Populated by tests -->
+ </div>
+ </body>
+</html>
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/pages/capture.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/capture.html b/tests/MobileSpecUnitTests/www/autotest/pages/capture.html
new file mode 100644
index 0000000..1f871a0
--- /dev/null
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/capture.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+ <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;" />
+
+ <title>Cordova: Capture API Specs</title>
+
+ <!-- Load QUnit -->
+ <link rel="stylesheet" type="text/css" href="../qunit.css" />
+ <script type="text/javascript" src="../qunit.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/capture.tests.js"></script>
+ <script type="text/javascript">
+ document.addEventListener('deviceready', function() {
+ console.log('running tests');
+ var tests = new Tests();
+
+ // Each group of tests are declared as a function in the object `Tests`.
+ // A group of tests are identified by a name that contains the word 'Tests'.
+ //
+ // Load each group of tests into QUnit
+ for (var t in tests) {
+ if (t.indexOf('Tests') > -1) {
+ tests[t]();
+ }
+ }
+
+ // Start the QUnit test suite
+ QUnit.start();
+ }, false);
+ </script>
+ </head>
+ <body>
+ <div class="backBtn" onclick="backHome();">Back</div>
+ <h1 id="qunit-header">Cordova: Capture API Specs</h1>
+ <h2 id="qunit-banner"></h2>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture">
+ <!-- Populated by tests -->
+ </div>
+ </body>
+</html>
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/pages/compass.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/compass.html b/tests/MobileSpecUnitTests/www/autotest/pages/compass.html
new file mode 100644
index 0000000..1623a5e
--- /dev/null
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/compass.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+ <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;" />
+
+ <title>Cordova: Compass API Specs</title>
+
+ <!-- Load QUnit -->
+ <link rel="stylesheet" type="text/css" href="../qunit.css" />
+ <script type="text/javascript" src="../qunit.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/compass.tests.js"></script>
+ <script type="text/javascript">
+ document.addEventListener('deviceready', function() {
+ console.log('running tests');
+ var tests = new Tests();
+
+ // Each group of tests are declared as a function in the object `Tests`.
+ // A group of tests are identified by a name that contains the word 'Tests'.
+ //
+ // Load each group of tests into QUnit
+ for (var t in tests) {
+ if (t.indexOf('Tests') > -1) {
+ tests[t]();
+ }
+ }
+
+ // Start the QUnit test suite
+ QUnit.start();
+ }, false);
+ </script>
+ </head>
+ <body>
+ <div class="backBtn" onclick="backHome();">Back</div>
+ <h1 id="qunit-header">Cordova: Compass API Specs</h1>
+ <h2 id="qunit-banner"></h2>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture">
+ <!-- Populated by tests -->
+ </div>
+ </body>
+</html>
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/pages/contacts.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/contacts.html b/tests/MobileSpecUnitTests/www/autotest/pages/contacts.html
new file mode 100644
index 0000000..bbd8642
--- /dev/null
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/contacts.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+ <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;" />
+
+ <title>Cordova: Contacts API Specs</title>
+
+ <!-- Load QUnit -->
+ <link rel="stylesheet" type="text/css" href="../qunit.css" />
+ <script type="text/javascript" src="../qunit.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/contacts.tests.js"></script>
+ <script type="text/javascript">
+ document.addEventListener('deviceready', function() {
+ console.log('running tests');
+ var tests = new Tests();
+
+ // Each group of tests are declared as a function in the object `Tests`.
+ // A group of tests are identified by a name that contains the word 'Tests'.
+ //
+ // Load each group of tests into QUnit
+ for (var t in tests) {
+ if (t.indexOf('Tests') > -1) {
+ tests[t]();
+ }
+ }
+
+ // Start the QUnit test suite
+ QUnit.start();
+ }, false);
+ </script>
+ </head>
+ <body>
+ <div class="backBtn" onclick="backHome();">Back</div>
+ <h1 id="qunit-header">Cordova: Contacts API Specs</h1>
+ <h2 id="qunit-banner"></h2>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture">
+ <!-- Populated by tests -->
+ </div>
+ </body>
+</html>
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/pages/device.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/device.html b/tests/MobileSpecUnitTests/www/autotest/pages/device.html
new file mode 100644
index 0000000..35a71bf
--- /dev/null
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/device.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+ <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;" />
+
+ <title>Cordova: Device API Specs</title>
+
+ <!-- Load QUnit -->
+ <link rel="stylesheet" type="text/css" href="../qunit.css" />
+ <script type="text/javascript" src="../qunit.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/device.tests.js"></script>
+ <script type="text/javascript">
+ document.addEventListener('deviceready', function() {
+ console.log('running tests');
+ var tests = new Tests();
+
+ // Each group of tests are declared as a function in the object `Tests`.
+ // A group of tests are identified by a name that contains the word 'Tests'.
+ //
+ // Load each group of tests into QUnit
+ for (var t in tests) {
+ if (t.indexOf('Tests') > -1) {
+ tests[t]();
+ }
+ }
+
+ // Start the QUnit test suite
+ QUnit.start();
+ }, false);
+ </script>
+ </head>
+ <body>
+ <div class="backBtn" onclick="backHome();">Back</div>
+ <h1 id="qunit-header">Cordova: Device API Specs</h1>
+ <h2 id="qunit-banner"></h2>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture">
+ <!-- Populated by tests -->
+ </div>
+ </body>
+</html>
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/pages/file.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/file.html b/tests/MobileSpecUnitTests/www/autotest/pages/file.html
new file mode 100644
index 0000000..4d13200
--- /dev/null
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/file.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+ <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;" />
+
+ <title>Cordova: File API Specs</title>
+
+ <!-- Load QUnit -->
+ <link rel="stylesheet" type="text/css" href="../qunit.css" />
+ <script type="text/javascript" src="../qunit.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/file.tests.js"></script>
+ <script type="text/javascript">
+ document.addEventListener('deviceready', function() {
+ console.log('running tests');
+ var tests = new Tests();
+
+ // Each group of tests are declared as a function in the object `Tests`.
+ // A group of tests are identified by a name that contains the word 'Tests'.
+ //
+ // Load each group of tests into QUnit
+ for (var t in tests) {
+ if (t.indexOf('Tests') > -1) {
+ tests[t]();
+ }
+ }
+
+ // Start the QUnit test suite
+ QUnit.start();
+ }, false);
+ </script>
+ </head>
+ <body>
+ <div class="backBtn" onclick="backHome();">Back</div>
+ <h1 id="qunit-header">Cordova: File API Specs</h1>
+ <h2 id="qunit-banner"></h2>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture">
+ <!-- Populated by tests -->
+ </div>
+ </body>
+</html>
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/pages/geolocation.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/geolocation.html b/tests/MobileSpecUnitTests/www/autotest/pages/geolocation.html
new file mode 100644
index 0000000..ff1f290
--- /dev/null
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/geolocation.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+ <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;" />
+
+ <title>Cordova: Geolocation API Specs</title>
+
+ <!-- Load QUnit -->
+ <link rel="stylesheet" type="text/css" href="../qunit.css" />
+ <script type="text/javascript" src="../qunit.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/geolocation.tests.js"></script>
+ <script type="text/javascript">
+ document.addEventListener('deviceready', function() {
+ console.log('running tests');
+ var tests = new Tests();
+
+ // Each group of tests are declared as a function in the object `Tests`.
+ // A group of tests are identified by a name that contains the word 'Tests'.
+ //
+ // Load each group of tests into QUnit
+ for (var t in tests) {
+ if (t.indexOf('Tests') > -1) {
+ tests[t]();
+ }
+ }
+
+ // Start the QUnit test suite
+ QUnit.start();
+ }, false);
+ </script>
+ </head>
+ <body>
+ <div class="backBtn" onclick="backHome();">Back</div>
+ <h1 id="qunit-header">Cordova: Geolocation API Specs</h1>
+ <h2 id="qunit-banner"></h2>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture">
+ <!-- Populated by tests -->
+ </div>
+ </body>
+</html>
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/pages/media.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/media.html b/tests/MobileSpecUnitTests/www/autotest/pages/media.html
new file mode 100644
index 0000000..5c77260
--- /dev/null
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/media.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+ <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;" />
+
+ <title>Cordova: Media API Specs</title>
+
+ <!-- Load QUnit -->
+ <link rel="stylesheet" type="text/css" href="../qunit.css" />
+ <script type="text/javascript" src="../qunit.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/media.tests.js"></script>
+ <script type="text/javascript">
+ document.addEventListener('deviceready', function() {
+ console.log('running tests');
+ var tests = new Tests();
+
+ // Each group of tests are declared as a function in the object `Tests`.
+ // A group of tests are identified by a name that contains the word 'Tests'.
+ //
+ // Load each group of tests into QUnit
+ for (var t in tests) {
+ if (t.indexOf('Tests') > -1) {
+ tests[t]();
+ }
+ }
+
+ // Start the QUnit test suite
+ QUnit.start();
+ }, false);
+ </script>
+ </head>
+ <body>
+ <div class="backBtn" onclick="backHome();">Back</div>
+ <h1 id="qunit-header">Cordova: Media API Specs</h1>
+ <h2 id="qunit-banner"></h2>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture">
+ <!-- Populated by tests -->
+ </div>
+ </body>
+</html>
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/pages/network.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/network.html b/tests/MobileSpecUnitTests/www/autotest/pages/network.html
new file mode 100644
index 0000000..52196fe
--- /dev/null
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/network.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+ <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;" />
+
+ <title>Cordova: Network API Specs</title>
+
+ <!-- Load QUnit -->
+ <link rel="stylesheet" type="text/css" href="../qunit.css" />
+ <script type="text/javascript" src="../qunit.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/network.tests.js"></script>
+ <script type="text/javascript">
+ document.addEventListener('deviceready', function() {
+ console.log('running tests');
+ var tests = new Tests();
+
+ // Each group of tests are declared as a function in the object `Tests`.
+ // A group of tests are identified by a name that contains the word 'Tests'.
+ //
+ // Load each group of tests into QUnit
+ for (var t in tests) {
+ if (t.indexOf('Tests') > -1) {
+ tests[t]();
+ }
+ }
+
+ // Start the QUnit test suite
+ QUnit.start();
+ }, false);
+ </script>
+ </head>
+ <body>
+ <div class="backBtn" onclick="backHome();">Back</div>
+ <h1 id="qunit-header">Cordova: Network API Specs</h1>
+ <h2 id="qunit-banner"></h2>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture">
+ <!-- Populated by tests -->
+ </div>
+ </body>
+</html>
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/pages/notification.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/notification.html b/tests/MobileSpecUnitTests/www/autotest/pages/notification.html
new file mode 100644
index 0000000..0b05192
--- /dev/null
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/notification.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+ <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;" />
+
+ <title>Cordova: Notification API Specs</title>
+
+ <!-- Load QUnit -->
+ <link rel="stylesheet" type="text/css" href="../qunit.css" />
+ <script type="text/javascript" src="../qunit.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/notification.tests.js"></script>
+ <script type="text/javascript">
+ document.addEventListener('deviceready', function() {
+ console.log('running tests');
+ var tests = new Tests();
+
+ // Each group of tests are declared as a function in the object `Tests`.
+ // A group of tests are identified by a name that contains the word 'Tests'.
+ //
+ // Load each group of tests into QUnit
+ for (var t in tests) {
+ if (t.indexOf('Tests') > -1) {
+ tests[t]();
+ }
+ }
+
+ // Start the QUnit test suite
+ QUnit.start();
+ }, false);
+ </script>
+ </head>
+ <body>
+ <div class="backBtn" onclick="backHome();">Back</div>
+ <h1 id="qunit-header">Cordova: Notification API Specs</h1>
+ <h2 id="qunit-banner"></h2>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture">
+ <!-- Populated by tests -->
+ </div>
+ </body>
+</html>
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/pages/platform.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/platform.html b/tests/MobileSpecUnitTests/www/autotest/pages/platform.html
new file mode 100644
index 0000000..8a8545c
--- /dev/null
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/platform.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+ <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;" />
+
+ <title>Cordova: Platform API Specs</title>
+
+ <!-- Load QUnit -->
+ <link rel="stylesheet" type="text/css" href="../qunit.css" />
+ <script type="text/javascript" src="../qunit.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/platform.tests.js"></script>
+ <script type="text/javascript">
+ document.addEventListener('deviceready', function() {
+ console.log('running tests');
+ var tests = new Tests();
+
+ // Each group of tests are declared as a function in the object `Tests`.
+ // A group of tests are identified by a name that contains the word 'Tests'.
+ //
+ // Load each group of tests into QUnit
+ for (var t in tests) {
+ if (t.indexOf('Tests') > -1) {
+ tests[t]();
+ }
+ }
+
+ // Start the QUnit test suite
+ QUnit.start();
+ }, false);
+ </script>
+ </head>
+ <body>
+ <div class="backBtn" onclick="backHome();">Back</div>
+ <h1 id="qunit-header">Cordova: Platform API Specs</h1>
+ <h2 id="qunit-banner"></h2>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture">
+ <!-- Populated by tests -->
+ </div>
+ </body>
+</html>
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/pages/storage.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/storage.html b/tests/MobileSpecUnitTests/www/autotest/pages/storage.html
new file mode 100644
index 0000000..9659b48
--- /dev/null
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/storage.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+ <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;" />
+
+ <title>Cordova: Storage API Specs</title>
+
+ <!-- Load QUnit -->
+ <link rel="stylesheet" type="text/css" href="../qunit.css" />
+ <script type="text/javascript" src="../qunit.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/storage.tests.js"></script>
+ <script type="text/javascript">
+ document.addEventListener('deviceready', function() {
+ console.log('running tests');
+ var tests = new Tests();
+
+ // Each group of tests are declared as a function in the object `Tests`.
+ // A group of tests are identified by a name that contains the word 'Tests'.
+ //
+ // Load each group of tests into QUnit
+ for (var t in tests) {
+ if (t.indexOf('Tests') > -1) {
+ tests[t]();
+ }
+ }
+
+ // Start the QUnit test suite
+ QUnit.start();
+ }, false);
+ </script>
+ </head>
+ <body>
+ <div class="backBtn" onclick="backHome();">Back</div>
+ <h1 id="qunit-header">Cordova: Storage API Specs</h1>
+ <h2 id="qunit-banner"></h2>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture">
+ <!-- Populated by tests -->
+ </div>
+ </body>
+</html>
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/qunit.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/qunit.js b/tests/MobileSpecUnitTests/www/autotest/qunit.js
index b7e8a1c..6be26e9 100644
--- a/tests/MobileSpecUnitTests/www/autotest/qunit.js
+++ b/tests/MobileSpecUnitTests/www/autotest/qunit.js
@@ -519,7 +519,7 @@ extend(QUnit, {
result.id = "qunit-testresult";
result.className = "result";
tests.parentNode.insertBefore( result, tests );
- result.innerHTML = 'Running...<br/> ';
+ result.innerHTML = 'Running...<br/> ';
}
},
@@ -1175,14 +1175,14 @@ QUnit.jsDump = (function() {
return type;
},
separator:function() {
- return this.multiline ? this.HTML ? '<br />' : '\n' : this.HTML ? ' ' : ' ';
+ return this.multiline ? this.HTML ? '<br />' : '\n' : this.HTML ? ' ' : ' ';
},
indent:function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing
if ( !this.multiline )
return '';
var chr = this.indentChar;
if ( this.HTML )
- chr = chr.replace(/\t/g,' ').replace(/ /g,' ');
+ chr = chr.replace(/\t/g,' ').replace(/ /g,' ');
return Array( this._depth_ + (extra||0) ).join(chr);
},
up:function( a ) {
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/test-runner.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/test-runner.js b/tests/MobileSpecUnitTests/www/autotest/test-runner.js
index 4c9188e..76fecbb 100644
--- a/tests/MobileSpecUnitTests/www/autotest/test-runner.js
+++ b/tests/MobileSpecUnitTests/www/autotest/test-runner.js
@@ -1,33 +1,9 @@
// Prevent QUnit from running when the DOM load event fires
QUnit.config.autostart = false;
-//sessionStorage.clear();
+sessionStorage.clear();
// Timeout is 2 seconds to allow physical devices enough
// time to query the response. This is important for some
-// devices.
+// Android devices.
var Tests = function() {};
Tests.TEST_TIMEOUT = 2000;
-
-
-document.addEventListener('DOMContentLoaded', function() {
- document.addEventListener('deviceready', function() {
-
- var tests = new Tests();
-
- // Each group of tests are declared as a function in the object `Tests`.
- // A group of tests are identified by a name that contains the word 'Tests'.
- //
- // Load each group of tests into QUnit
- for (var t in tests)
- {
- if (t.indexOf('Tests') > -1)
- {
- console.log("in test runner :: LoadingTest = " + t);
- tests[t]();
- }
- }
-
- // Start the QUnit test suite
- QUnit.start();
- }, false);
-}, false);
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/tests/battery.tests.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/tests/battery.tests.js b/tests/MobileSpecUnitTests/www/autotest/tests/battery.tests.js
new file mode 100644
index 0000000..faf14e1
--- /dev/null
+++ b/tests/MobileSpecUnitTests/www/autotest/tests/battery.tests.js
@@ -0,0 +1,7 @@
+Tests.prototype.BatteryTests = function() {
+ module('Battery (navigator.battery)');
+ test("should exist", function() {
+ expect(1);
+ ok(navigator.battery != null, "navigator.battery should not be null.");
+ });
+};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/tests/camera.tests.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/tests/camera.tests.js b/tests/MobileSpecUnitTests/www/autotest/tests/camera.tests.js
index 3aea2d3..2e55f9d 100644
--- a/tests/MobileSpecUnitTests/www/autotest/tests/camera.tests.js
+++ b/tests/MobileSpecUnitTests/www/autotest/tests/camera.tests.js
@@ -1,12 +1,50 @@
Tests.prototype.CameraTests = function() {
module('Camera (navigator.camera)');
test("should exist", function() {
- expect(1);
- ok(navigator.camera != null, "navigator.camera should not be null.");
+ expect(1);
+ ok(navigator.camera !== null, "navigator.camera should not be null.");
});
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 != '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.");
});
-};
\ No newline at end of file
+
+ 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');
+ });
+};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/tests/capture.tests.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/tests/capture.tests.js b/tests/MobileSpecUnitTests/www/autotest/tests/capture.tests.js
index 63ce04f..594d7d1 100644
--- a/tests/MobileSpecUnitTests/www/autotest/tests/capture.tests.js
+++ b/tests/MobileSpecUnitTests/www/autotest/tests/capture.tests.js
@@ -2,31 +2,32 @@ Tests.prototype.CaptureTests = function() {
module('Capture (navigator.device.capture)');
test("should exist", function() {
expect(2);
- ok(navigator.device != null, "navigator.device should not be null.");
- ok(navigator.device.capture != null, "navigator.device.capture should not be null.");
+ ok(navigator.device !== null, "navigator.device should not be null.");
+ ok(navigator.device.capture !== null, "navigator.device.capture should not be null.");
});
test("should have the correct properties ", function() {
expect(3);
- ok(typeof navigator.device.capture.supportedAudioModes != 'undefined' && navigator.device.capture.supportedAudioModes != null , "there should be a supported audio modes property");
- ok(typeof navigator.device.capture.supportedImageModes != 'undefined' && navigator.device.capture.supportedImageModes != null , "there should be a supported image modes property");
- ok(typeof navigator.device.capture.supportedVideoModes != 'undefined' && navigator.device.capture.supportedVideoModes != null , "there should be a supported video modes property");
+ ok(typeof navigator.device.capture.supportedAudioModes != 'undefined' && navigator.device.capture.supportedAudioModes !== null , "there should be a supported audio modes property");
+ ok(typeof navigator.device.capture.supportedImageModes != 'undefined' && navigator.device.capture.supportedImageModes !== null , "there should be a supported image modes property");
+ ok(typeof navigator.device.capture.supportedVideoModes != 'undefined' && navigator.device.capture.supportedVideoModes !== null , "there should be a supported video modes property");
});
test("should contain a captureAudio function", function() {
expect(2);
- ok(typeof navigator.device.capture.captureAudio != 'undefined' && navigator.device.capture.captureAudio != null, "navigator.device.capture.captureAudio should not be null.");
+ ok(typeof navigator.device.capture.captureAudio != 'undefined' && navigator.device.capture.captureAudio !== null, "navigator.device.capture.captureAudio should not be null.");
ok(typeof navigator.device.capture.captureAudio == 'function', "navigator.device.capture.captureAudio should be a function.");
});
test("should contain a captureImage function", function() {
expect(2);
- ok(typeof navigator.device.capture.captureImage != 'undefined' && navigator.device.capture.captureImage != null, "navigator.device.capture.captureImage should not be null.");
+ ok(typeof navigator.device.capture.captureImage != 'undefined' && navigator.device.capture.captureImage !== null, "navigator.device.capture.captureImage should not be null.");
ok(typeof navigator.device.capture.captureImage == 'function', "navigator.device.capture.captureImage should be a function.");
});
test("should contain a captureVideo function", function() {
expect(2);
- ok(typeof navigator.device.capture.captureVideo != 'undefined' && navigator.device.capture.captureVideo != null, "navigator.device.capture.captureVideo should not be null.");
+ ok(typeof navigator.device.capture.captureVideo != 'undefined' && navigator.device.capture.captureVideo !== null, "navigator.device.capture.captureVideo should not be null.");
ok(typeof navigator.device.capture.captureVideo == 'function', "navigator.device.capture.captureVideo should be a function.");
});
- module('CaptureAudioOptions');
+
+ module('CaptureAudioOptions');
test("CaptureAudioOptions constructor should exist", function() {
expect(4);
var options = new CaptureAudioOptions();
@@ -35,6 +36,7 @@ Tests.prototype.CaptureTests = function() {
ok(typeof options.duration !== 'undefined', "CaptureAudioOptions object should have a 'duration' property.");
ok(typeof options.mode !== 'undefined', "CaptureAudioOptions object should have a 'mode' property.");
});
+
module('CaptureImageOptions');
test("CaptureImageOptions constructor should exist", function() {
expect(3);
@@ -43,6 +45,7 @@ Tests.prototype.CaptureTests = function() {
ok(typeof options.limit !== 'undefined', "CaptureImageOptions object should have a 'limit' property.");
ok(typeof options.mode !== 'undefined', "CaptureImageOptions object should have a 'mode' property.");
});
+
module('CaptureVideoOptions');
test("CaptureVideoOptions constructor should exist", function() {
expect(4);
@@ -52,6 +55,7 @@ Tests.prototype.CaptureTests = function() {
ok(typeof options.duration !== 'undefined', "CaptureVideoOptions object should have a 'duration' property.");
ok(typeof options.mode !== 'undefined', "CaptureVideoOptions object should have a 'mode' property.");
});
+
module('CaptureError interface');
test("CaptureError constants should be defined", function() {
expect(4);
@@ -66,6 +70,7 @@ Tests.prototype.CaptureTests = function() {
ok(error !== null, "CaptureError object should not be null.");
ok(typeof error.code !== 'undefined', "CaptureError object should have a 'code' property.");
});
+
module('MediaFileData');
test("MediaFileData constructor should exist", function() {
expect(6);
@@ -77,4 +82,16 @@ Tests.prototype.CaptureTests = function() {
ok(typeof fileData.height !== 'undefined', "MediaFileData object should have a 'height' property.");
ok(typeof fileData.width !== 'undefined', "MediaFileData object should have a 'width' property.");
});
-};
\ No newline at end of file
+
+ module('MediaFile');
+ test("MediaFile constructor should exist", function() {
+ expect(6);
+ var fileData = new MediaFile();
+ ok(fileData !== null, "MediaFile object should not be null.");
+ ok(typeof fileData.name !== 'undefined', "MediaFile object should have a 'name' property.");
+ ok(typeof fileData.fullPath !== 'undefined', "MediaFile object should have a 'fullPath' property.");
+ ok(typeof fileData.type !== 'undefined', "MediaFile object should have a 'type' property.");
+ ok(typeof fileData.lastModifiedDate !== 'undefined', "MediaFile object should have a 'lastModifiedDate' property.");
+ ok(typeof fileData.size !== 'undefined', "MediaFile object should have a 'size' property.");
+ });
+};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/5bca3c1a/tests/MobileSpecUnitTests/www/autotest/tests/compass.tests.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/tests/compass.tests.js b/tests/MobileSpecUnitTests/www/autotest/tests/compass.tests.js
index 824325f..b3abf2b 100644
--- a/tests/MobileSpecUnitTests/www/autotest/tests/compass.tests.js
+++ b/tests/MobileSpecUnitTests/www/autotest/tests/compass.tests.js
@@ -1,63 +1,72 @@
-Tests.prototype.CompassTests = function()
-{
- module('Compass (navigator.compass)');
-
- test("should exist",
- function() {
- expect(1);
- ok(navigator.compass != null, "navigator.compass should not be null.");
+Tests.prototype.CompassTests = function() {
+ module('Compass (navigator.compass)');
+ test("should exist", function() {
+ expect(1);
+ ok(navigator.compass !== null, "navigator.compass should not be null.");
});
-
- test("should contain a getCurrentHeading function",
- function() {
+ test("should contain a getCurrentHeading function", function() {
expect(2);
- ok(typeof navigator.compass.getCurrentHeading != 'undefined' && navigator.compass.getCurrentHeading != null, "navigator.compass.getCurrentHeading should not be null.");
+ ok(typeof navigator.compass.getCurrentHeading != 'undefined' && navigator.compass.getCurrentHeading !== null, "navigator.compass.getCurrentHeading should not be null.");
ok(typeof navigator.compass.getCurrentHeading == 'function', "navigator.compass.getCurrentHeading should be a function.");
});
-
- test("getCurrentHeading success callback should be called with an heading (string)",
- function() {
+ test("getCurrentHeading success callback should be called with a Heading object", function() {
expect(9);
QUnit.stop(Tests.TEST_TIMEOUT);
- var win = function(a)
- {
- ok(typeof a == 'object', "Compass heading object returned in getCurrentHeading success callback should be of type 'Object'.");
- ok(a.magneticHeading != null, "Compass heading object has a magneticHeading property");
- ok(typeof a.magneticHeading == "number", "Compass heading.magneticHeading is a Number");
-
- ok(a.trueHeading != null, "Compass heading object has a magneticHeading property");
- ok(typeof a.trueHeading == "number", "Compass heading.trueHeading is a Number");
-
- ok(a.headingAccuracy != null, "Compass heading object has a magneticHeading property");
- ok(typeof a.headingAccuracy == "number", "Compass heading.headingAccuracy is a Number");
-
- ok(a.timestamp != null, "Compass heading object has a magneticHeading property");
- ok(typeof a.timestamp == "number", "Compass heading.timestamp is a Number");
-
- start();
- };
- var fail = function(a)
- {
- ok(typeof a == 'object', "Compass heading object returned in getCurrentHeading FAIL callback should be of type 'object'.");
- ok(a.code != null, "Compass error result should have a 'code' property");
- ok(typeof a.code == 'string', "Compass error result should have a 'code' property of type string");
- start();
+ var win = function(a) {
+ ok(a instanceof CompassHeading, "Heading object returned in getCurrentHeading success callback should be an instance of CompassHeading.");
+ ok(a.magneticHeading !== null, "Heading object returned in getCurrentHeading success callback should have an 'magneticHeading' property.");
+ ok(typeof a.magneticHeading == 'number', "Heading object's 'magneticHeading' property returned in getCurrentHeading success callback should be of type 'number'.");
+ ok(a.trueHeading !== undefined, "Heading object returned in getCurrentHeading success callback should have a 'trueHeading' property.");
+ ok(typeof a.trueHeading == 'number' || a.trueHeading === null, "Heading object's 'trueHeading' property returned in getCurrentHeading success callback should be of type 'number', or should be null if not available.");
+ ok(a.headingAccuracy !== undefined, "Heading object returned in getCurrentHeading success callback should have a 'headingAccuracy' property.");
+ ok(typeof a.headingAccuracy == 'number' || a.headingAccuracy === null, "Heading object's 'headingAccuracy' property returned in getCurrentHeading success callback should be of type 'number', or should be null if not available.");
+ ok(a.timestamp !== null, "Heading object returned in getCurrentHeading success callback should have a 'timestamp' property.");
+ ok(a.timestamp instanceof Date, "Heading object's 'timestamp' property returned in getCurrentHeading success callback should be of type 'Date'.");
+ QUnit.start();
};
+ var fail = function() { QUnit.start(); };
navigator.compass.getCurrentHeading(win, fail);
});
-
- test("should contain a watchHeading function",
- function() {
+ test("should contain a watchHeading function", function() {
expect(2);
- ok(typeof navigator.compass.watchHeading != 'undefined' && navigator.compass.watchHeading != null, "navigator.compass.watchHeading should not be null.");
+ ok(typeof navigator.compass.watchHeading != 'undefined' && navigator.compass.watchHeading !== null, "navigator.compass.watchHeading should not be null.");
ok(typeof navigator.compass.watchHeading == 'function', "navigator.compass.watchHeading should be a function.");
});
-
- test("should contain a clearWatch function", function()
- {
+ test("should contain a clearWatch function", function() {
expect(2);
- ok(typeof navigator.compass.clearWatch != 'undefined' && navigator.compass.clearWatch != null, "navigator.compass.clearWatch should not be null.");
+ ok(typeof navigator.compass.clearWatch != 'undefined' && navigator.compass.clearWatch !== null, "navigator.compass.clearWatch should not be null.");
ok(typeof navigator.compass.clearWatch == 'function', "navigator.compass.clearWatch should be a function!");
});
-
-};
\ No newline at end of file
+
+ module('Compass Constants (window.CompassError)');
+ test("CompassError globals should exist", function() {
+ expect(3);
+ ok(window.CompassError !== null, 'window.CompassError should not be null');
+ equals(window.CompassError.COMPASS_INTERNAL_ERR, 0, 'window.CompassError.COMPASS_INTERNAL_ERR should be 0');
+ equals(window.CompassError.COMPASS_NOT_SUPPORTED, 20, 'window.CompassError.COMPASS_NOT_SUPPORTED should be 20');
+ });
+
+ module('Compass Heading model (CompassHeading)');
+ test("CompassHeading function should exist", function() {
+ expect(1);
+ ok(typeof CompassHeading != 'undefined' && CompassHeading !== null, 'CompassHeading should not be null');
+ });
+ test("Creating a new CompassHeading instance with no parameters", function() {
+ expect(5);
+ var h = new CompassHeading();
+ equals(h.magneticHeading, null, "CompassHeading instance should have null magneticHeading property by default");
+ equals(h.trueHeading, null, "CompassHeading instance should have null trueHeading property by default");
+ equals(h.headingAccuracy, null, "CompassHeading instance should have null headingAccuracy property by default");
+ ok(h.timestamp !== null, "CompassHeading instance should have timestamp that is not null by default");
+ ok(h.timestamp instanceof Date, "CompassHeading instance should have timestamp that is an instance of a Date object.");
+ });
+ test("Creating a new CompassHeading instance with parameters", function() {
+ expect(5);
+ var h = new CompassHeading(1,2,3,4);
+ equals(h.magneticHeading, 1, "CompassHeading instance should have specified magneticHeading.");
+ equals(h.trueHeading, 2, "CompassHeading instance should have specified trueHeading.");
+ equals(h.headingAccuracy, 3, "CompassHeading instance should have specified headingAccuracy.");
+ equals(h.timestamp.valueOf(), 4, "CompassHeading instance should have specified timestamp cast as a Date object");
+ ok(h.timestamp instanceof Date, "CompassHeading instance should have timestamp that is an instance of a Date object.");
+ });
+};