Skip to content
This repository has been archived by the owner on Apr 18, 2019. It is now read-only.

Commit

Permalink
update tests for 1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
purplecabbage committed Mar 26, 2012
1 parent b96a05b commit 4fce8c2
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 75 deletions.
3 changes: 2 additions & 1 deletion tests/MobileSpecUnitTests/CordovaSourceDictionary.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This file is auto-generated, do not edit! -jm -->
<CordovaSourceDictionary>
<FilePath Value="www\cordova-1.5.0.js"/>
<FilePath Value="www\cordova-1.6.0.js"/>
<FilePath Value="www\cordova.wp7.js"/>
<FilePath Value="www\index.html"/>
<FilePath Value="www\master.css"/>
<FilePath Value="www\autotest\index.html"/>
Expand Down
3 changes: 2 additions & 1 deletion tests/MobileSpecUnitTests/MobileSpecUnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@
<Content Include="www\autotest\tests\orientation.tests.js" />
<Content Include="www\autotest\tests\storage.tests.js" />
<Content Include="www\autotest\tests\system.tests.js" />
<Content Include="www\cordova-1.5.0.js" />
<Content Include="www\cordova-1.6.0.js" />
<Content Include="www\cordova.wp7.js" />
<Content Include="www\index.html">
<SubType>Designer</SubType>
</Content>
Expand Down
2 changes: 1 addition & 1 deletion tests/MobileSpecUnitTests/MobileSpecUnitTests.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010 Express for Windows Phone
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MobileSpecUnitTests", "MobileSpecUnitTests.csproj", "{86DC5E2F-4AEE-42E3-9471-A082B9BEBEAC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WP7CordovaClassLib", "..\..\framework\WP7CordovaClassLib.csproj", "{FC6A1A70-892D-46AD-9E4A-9793F72AF780}"
Expand Down
37 changes: 13 additions & 24 deletions tests/MobileSpecUnitTests/www/autotest/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,12 @@
<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>PhoneGap API Spec</title>
<title>Cordova API Spec</title>

<!-- Load QUnit -->
<link rel="stylesheet" type="text/css" href="qunit.css" />

<script type="text/javascript">
// provide our own console if it does not exist, huge dev aid!
if(typeof window.console == "undefined")
{
window.console = {log:function(str){window.external.Notify(str);}};
}

// output any errors to console log, created above.
window.onerror=function(e)
{
console.log("window.onerror ::" + JSON.stringify(e));
};

console.log("Installed console ! ");

function onBodyLoad()
{
Expand All @@ -31,6 +18,7 @@

function onBackButton()
{

window.history.go(-1);
}

Expand All @@ -40,7 +28,7 @@


<!-- Source -->
<script type="text/javascript" src="../cordova-1.5.0.js"></script>
<script type="text/javascript" src="../cordova-1.6.0.js"></script>

<!-- Load Test Runner -->
<script type="text/javascript" src="test-runner.js"></script>
Expand All @@ -49,15 +37,21 @@

<!-- Individual Tests -->



<script type="text/javascript" src="tests/capture.tests.js"></script>


<script type="text/javascript" src="tests/device.tests.js"></script>
<script type="text/javascript" src="tests/accelerometer.tests.js"></script>
<script type="text/javascript" src="tests/camera.tests.js"></script>
<script type="text/javascript" src="tests/capture.tests.js"></script>


<script type="text/javascript" src="tests/notification.tests.js"></script>
<script type="text/javascript" src="tests/network.tests.js"></script>
<script type="text/javascript" src="tests/geolocation.tests.js"></script>

<!--<script type="text/javascript" src="tests/compass.tests.js"></script>-->
<script type="text/javascript" src="tests/compass.tests.js"></script>



Expand All @@ -68,14 +62,9 @@


<script type="text/javascript" src="tests/storage.tests.js"></script>




<script type="text/javascript" src="tests/device.tests.js"></script>


<!--<script type="text/javascript" src="tests/orientation.tests.js"></script> -->

<script type="text/javascript" src="tests/orientation.tests.js"></script>



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ Tests.prototype.DeviceTests = function() {
ok(typeof window.device.cordova != 'undefined' && window.device.cordova != null, "window.device.cordova should not be null.")
ok((new String(window.device.cordova)).length > 0, "window.device.cordova should contain some kind of string value.")
});

};
Original file line number Diff line number Diff line change
Expand Up @@ -1042,15 +1042,37 @@ var Capture = function(){
this.supportedVideoModes = [];
};

function _capture(type, successCallback, errorCallback, options)
{
var win = function (pluginResult)
{
var mediaFiles = [];
var i;
for (i = 0; i < pluginResult.length; i++) {
var mediaFile = new MediaFile();
mediaFile.name = pluginResult[i].name;
mediaFile.fullPath = pluginResult[i].fullPath;
mediaFile.type = pluginResult[i].type;
mediaFile.lastModifiedDate = pluginResult[i].lastModifiedDate;
mediaFile.size = pluginResult[i].size;
mediaFiles.push(mediaFile);
}
successCallback(mediaFiles);
};
Cordova.exec(win, errorCallback, "Capture", type, [options]);
}

/**
* Launch audio recorder application for recording audio clip(s).
*
* @param {Function} successCB
* @param {Function} errorCB
* @param {CaptureAudioOptions} options
*/
Capture.prototype.captureAudio = function(successCallback, errorCallback, options){
Cordova.exec(successCallback, errorCallback, "Capture", "captureAudio", options);
Capture.prototype.captureAudio = function (successCallback, errorCallback, options)
{
_capture("captureAudio", successCallback, errorCallback, options);
//Cordova.exec(successCallback, errorCallback, "Capture", "captureAudio", options);
};

/**
Expand All @@ -1060,8 +1082,10 @@ Capture.prototype.captureAudio = function(successCallback, errorCallback, option
* @param {Function} errorCB
* @param {CaptureImageOptions} options
*/
Capture.prototype.captureImage = function (successCallback, errorCallback, options) {
Cordova.exec(successCallback, errorCallback, "Capture", "captureImage", options);
Capture.prototype.captureImage = function (successCallback, errorCallback, options)
{
_capture("captureImage", successCallback, errorCallback, options);
//Cordova.exec(successCallback, errorCallback, "Capture", "captureImage", options);
};

/**
Expand All @@ -1071,29 +1095,34 @@ Capture.prototype.captureImage = function (successCallback, errorCallback, optio
* @param {Function} errorCB
* @param {CaptureVideoOptions} options
*/
Capture.prototype.captureVideo = function(successCallback, errorCallback, options){
Cordova.exec(successCallback, errorCallback, "Capture", "captureVideo", options);
Capture.prototype.captureVideo = function (successCallback, errorCallback, options)
{
_capture("captureVideo", successCallback, errorCallback, options);
//Cordova.exec(successCallback, errorCallback, "Capture", "captureVideo", options);
};




/**
* This function returns and array of MediaFiles. It is required as we need to convert raw
* JSON objects into MediaFile objects.
*/
Capture.prototype._castMediaFile = function(pluginResult){
var mediaFiles = [];
var i;
for (i = 0; i < pluginResult.message.length; i++) {
var mediaFile = new MediaFile();
mediaFile.name = pluginResult.message[i].name;
mediaFile.fullPath = pluginResult.message[i].fullPath;
mediaFile.type = pluginResult.message[i].type;
mediaFile.lastModifiedDate = pluginResult.message[i].lastModifiedDate;
mediaFile.size = pluginResult.message[i].size;
mediaFiles.push(mediaFile);
}
pluginResult.message = mediaFiles;
return pluginResult;
};
//Capture.prototype._castMediaFile = function(pluginResult){
// var mediaFiles = [];
// var i;
// for (i = 0; i < pluginResult.message.length; i++) {
// var mediaFile = new MediaFile();
// mediaFile.name = pluginResult.message[i].name;
// mediaFile.fullPath = pluginResult.message[i].fullPath;
// mediaFile.type = pluginResult.message[i].type;
// mediaFile.lastModifiedDate = pluginResult.message[i].lastModifiedDate;
// mediaFile.size = pluginResult.message[i].size;
// mediaFiles.push(mediaFile);
// }
// pluginResult.message = mediaFiles;
// return pluginResult;
//};

/**
* Encapsulates a set of parameters that the capture device supports.
Expand Down
55 changes: 28 additions & 27 deletions tests/MobileSpecUnitTests/www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,50 @@

<title>Cordova Tests</title>
<link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no title" charset="utf-8"/>


<script type="text/javascript" charset="utf-8" src="cordova-1.5.0.js"></script>
<script type="text/javascript" charset="utf-8" src="cordova-1.6.0.js"></script>

<script type="text/javascript">


function init()
{
document.addEventListener("deviceready",onDeviceReady,false);
document.addEventListener("backbutton",onBackButton,false);
function init()
{
document.addEventListener("deviceready",onDeviceReady,false);
document.addEventListener("backbutton",onBackButton,false);

}
}


function onBackButton()
{
console.log("onBackButton");
}
function onBackButton()
{
console.log("onBackButton");
}

function onDeviceReady(e)
{
updateDeviceInfo();
console.log("deviceready event fired!");
}
function onDeviceReady(e)
{
updateDeviceInfo();
console.log("deviceready event fired!");
}

function updateDeviceInfo()
{
document.getElementById("platform").innerHTML = device.platform;
document.getElementById("version").innerHTML = device.version;
document.getElementById("uuid").innerHTML = device.uuid;
document.getElementById("name").innerHTML = device.name;
document.getElementById("width").innerHTML = screen.width;
document.getElementById("height").innerHTML = screen.height;
document.getElementById("colorDepth").innerHTML = screen.colorDepth;
document.getElementById("cordovaVersion").innerHTML = device.cordova;
function updateDeviceInfo()
{
document.getElementById("platform").innerHTML = device.platform;
document.getElementById("version").innerHTML = device.version;
document.getElementById("uuid").innerHTML = device.uuid;
document.getElementById("name").innerHTML = device.name;
document.getElementById("width").innerHTML = screen.width;
document.getElementById("height").innerHTML = screen.height;
document.getElementById("colorDepth").innerHTML = screen.colorDepth;
document.getElementById("cordovaVersion").innerHTML = device.cordova;

};
};





</script>
</script>


</head>
Expand Down

0 comments on commit 4fce8c2

Please sign in to comment.