Skip to content

Commit

Permalink
Fix class name; also update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eb1 committed Nov 6, 2017
1 parent e0256d1 commit e865d31
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 5 deletions.
4 changes: 2 additions & 2 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<!-- android -->
<platform name="android">
<config-file target="config.xml" parent="/*">
<feature name="Environment">
<param name="android-package" value="org.adaptit.cordova.environment.Environment"/>
<feature name="Env">
<param name="android-package" value="org.adaptit.cordova.environment.Env"/>
</feature>
</config-file>

Expand Down
88 changes: 85 additions & 3 deletions tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
if (navigator.Env) {
navigator.Env.getExternalStorageState(
function (result) {
console.log("getExternalStorageStateTest() - value returned" + result);
logMessage("getExternalStorageStateTest() - value returned: " + result);
},
function (error) {
logMessage(error);
Expand All @@ -94,7 +94,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
if (navigator.Env) {
navigator.Env.isExternalStorageEmulated(
function (result) {
console.log("isExternalStorageEmulatedTest() - value returned" + result);
logMessage("isExternalStorageEmulatedTest() - value returned: " + result);
},
function (error) {
logMessage(error);
Expand All @@ -111,7 +111,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
if (navigator.Env) {
navigator.Env.isExternalStorageRemovable(
function (result) {
console.log("isExternalStorageRemovableTest() - value returned" + result);
logMessage("isExternalStorageRemovableTest() - value returned: " + result);
},
function (error) {
logMessage(error);
Expand All @@ -122,6 +122,85 @@ exports.defineManualTests = function (contentEl, createActionButton) {
}
},

getDirectoryTest = function () {
clearLog();
console.log("getDirectoryTest()");
if (navigator.Env) {
navigator.Env.getDirectory("Alarms",
function (result) {
logMessage("Alarms directory: " + result);
},
function (error) {
logMessage(error);
});
navigator.Env.getDirectory("DCIM",
function (result) {
logMessage("DCIM directory: " + result);
},
function (error) {
logMessage(error);
});
navigator.Env.getDirectory("Documents",
function (result) {
logMessage("Documents directory: " + result);
},
function (error) {
logMessage(error);
});
navigator.Env.getDirectory("Downloads",
function (result) {
logMessage("Downloads directory: " + result);
},
function (error) {
logMessage(error);
});
navigator.Env.getDirectory("Movies",
function (result) {
logMessage("Movies directory: " + result);
},
function (error) {
logMessage(error);
});
navigator.Env.getDirectory("Music",
function (result) {
logMessage("Music directory: " + result);
},
function (error) {
logMessage(error);
});
navigator.Env.getDirectory("Notifications",
function (result) {
logMessage("Notifications directory: " + result);
},
function (error) {
logMessage(error);
});
navigator.Env.getDirectory("Pictures",
function (result) {
logMessage("Pictures directory: " + result);
},
function (error) {
logMessage(error);
});
navigator.Env.getDirectory("Podcasts",
function (result) {
logMessage("Podcasts directory: " + result);
},
function (error) {
logMessage(error);
});
navigator.Env.getDirectory("Ringtones",
function (result) {
logMessage("Ringtones directory: " + result);
},
function (error) {
logMessage(error);
});
} else {
console.log("PLugin error: Environment plugin not found (is is installed?)");
}
},

device_tests = '<p/><div id="cdv_storage_state"></div><p/><div id="cdv_storage_emulated"></div><p/><div id="cdv_storage_removable"></div><p/><div id="cdv_directories"></div>';

contentEl.innerHTML = '<div id="info"></div>' + device_tests;
Expand All @@ -138,4 +217,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
isExternalStorageRemovableTest();
}, "cdv_storage_removable");

createActionButton('getDirectories', function () {
getDirectoryTest();
}, "cdv_directories");
};

0 comments on commit e865d31

Please sign in to comment.