From e3468c66a374ac4a05940ccb3b0cbf1e5b56b193 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Mon, 12 Nov 2018 21:50:20 -0500 Subject: [PATCH] Check target-dir mapping of plugin xml source file (PR #550) Possibly related to: CB-13830: Add handlers for plugins that use non-Java source files, such as Camera --- .../org.test.plugins.dummyplugin/plugin.xml | 1 + .../src/android/mysettings.xml | 1 + spec/unit/pluginHandlers/handlers.spec.js | 13 +++++++++++++ 3 files changed, 15 insertions(+) create mode 100644 spec/fixtures/org.test.plugins.dummyplugin/src/android/mysettings.xml diff --git a/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml b/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml index b299b645..5cd28720 100644 --- a/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml +++ b/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml @@ -76,6 +76,7 @@ target-dir="app/libs" /> + diff --git a/spec/fixtures/org.test.plugins.dummyplugin/src/android/mysettings.xml b/spec/fixtures/org.test.plugins.dummyplugin/src/android/mysettings.xml new file mode 100644 index 00000000..421376db --- /dev/null +++ b/spec/fixtures/org.test.plugins.dummyplugin/src/android/mysettings.xml @@ -0,0 +1 @@ +dummy diff --git a/spec/unit/pluginHandlers/handlers.spec.js b/spec/unit/pluginHandlers/handlers.spec.js index 60a69144..6d90bd02 100644 --- a/spec/unit/pluginHandlers/handlers.spec.js +++ b/spec/unit/pluginHandlers/handlers.spec.js @@ -127,6 +127,13 @@ describe('android project handler', function () { expect(copyFileSpy) .toHaveBeenCalledWith(dummyplugin, 'src/android/TestAar.aar', temp, path.join('app/libs/TestAar.aar'), false); }); + + it('Test#006d : should allow installing xml file from sources with old target-dir scheme', function () { + android['source-file'].install(valid_source[4], dummyPluginInfo, dummyProject, {android_studio: true}); + expect(copyFileSpy).toHaveBeenCalledWith(dummyplugin, + 'src/android/mysettings.xml', temp, + path.join('app/src/main/res/xml/mysettings.xml'), false); + }); }); describe('of elements', function () { @@ -300,6 +307,12 @@ describe('android project handler', function () { android['source-file'].uninstall(valid_source[3], dummyPluginInfo, dummyProject, {android_studio: true}); expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/libs/TestAar.aar')); }); + + it('Test#019d : should remove stuff by calling common.removeFile for Android Studio projects, of xml with old target-dir scheme', function () { + android['source-file'].install(valid_source[4], dummyPluginInfo, dummyProject, {android_studio: true}); + android['source-file'].uninstall(valid_source[4], dummyPluginInfo, dummyProject, {android_studio: true}); + expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/res/xml/mysettings.xml')); + }); }); describe('of elements', function () {