Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
CB-11516 windows: Preparing icons w/ target fails
Browse files Browse the repository at this point in the history
This closes #179
  • Loading branch information
Cody Hoover authored and Vladimir Kotikov committed Jul 11, 2016
1 parent 779c64e commit 18f6120
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
34 changes: 17 additions & 17 deletions spec/unit/Prepare.Win10.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,16 +507,16 @@ describe('copyIcons method', function () {
describe('when "target" attribute is specified for the image', function () {
it('should copy all images with the same base name and extension to destination dir', function () {
var matchingFiles = [
'res/Windows/Square44x44.scale-100.png',
'res/Windows/Square44x44.targetsize-16.png',
'res/Windows/Square44x44.scale-150_targetsize-16.png',
'res/Windows/Square44x44.targetsize-16_scale-200.png',
'res/Windows/Square44x44.targetsize-16_altform-unplated_scale-200.png'
'Square44x44.scale-100.png',
'Square44x44.targetsize-16.png',
'Square44x44.scale-150_targetsize-16.png',
'Square44x44.targetsize-16_scale-200.png',
'Square44x44.targetsize-16_altform-unplated_scale-200.png'
];

var nonMatchingFiles = [
'res/Windows/Square55x55.scale-100.png',
'res/Windows/Square44x44.targetsize-16.jpg'
'Square55x55.scale-100.png',
'Square44x44.targetsize-16.jpg'
];

spyOn(fs, 'readdirSync').andReturn(matchingFiles.concat(nonMatchingFiles));
Expand All @@ -528,16 +528,16 @@ describe('copyIcons method', function () {
copyImages(project, locations);

var expectedPathMap = {};
expectedPathMap['images' + path.sep + 'SmallIcon.scale-100.png'] =
'res/Windows/Square44x44.scale-100.png';
expectedPathMap['images' + path.sep + 'SmallIcon.targetsize-16.png'] =
'res/Windows/Square44x44.targetsize-16.png';
expectedPathMap['images' + path.sep + 'SmallIcon.scale-150_targetsize-16.png'] =
'res/Windows/Square44x44.scale-150_targetsize-16.png';
expectedPathMap['images' + path.sep + 'SmallIcon.targetsize-16_scale-200.png'] =
'res/Windows/Square44x44.targetsize-16_scale-200.png';
expectedPathMap['images' + path.sep + 'SmallIcon.targetsize-16_altform-unplated_scale-200.png'] =
'res/Windows/Square44x44.targetsize-16_altform-unplated_scale-200.png';
expectedPathMap[path.join('images', 'SmallIcon.scale-100.png')] =
path.join('res', 'Windows', 'Square44x44.scale-100.png');
expectedPathMap[path.join('images','SmallIcon.targetsize-16.png')] =
path.join('res', 'Windows', 'Square44x44.targetsize-16.png');
expectedPathMap[path.join('images', 'SmallIcon.scale-150_targetsize-16.png')] =
path.join('res', 'Windows', 'Square44x44.scale-150_targetsize-16.png');
expectedPathMap[path.join('images', 'SmallIcon.targetsize-16_scale-200.png')] =
path.join('res', 'Windows', 'Square44x44.targetsize-16_scale-200.png');
expectedPathMap[path.join('images', 'SmallIcon.targetsize-16_altform-unplated_scale-200.png')] =
path.join('res', 'Windows', 'Square44x44.targetsize-16_altform-unplated_scale-200.png');
expect(FileUpdater.updatePaths).toHaveBeenCalledWith(expectedPathMap, { rootDir: PROJECT }, logFileOp);
});
});
Expand Down
2 changes: 1 addition & 1 deletion template/cordova/lib/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ function mapImageResources(images, imagesDir) {

// then get all matching MRT images in source directory
var candidates = fs.readdirSync(imageToCopy.location)
.map(function (file) { return new MRTImage(file); })
.map(function (file) { return new MRTImage(path.join(imageToCopy.location, file)); })
.filter(imageToCopy.matchesTo, imageToCopy);

// Warn user if no images were copied
Expand Down

0 comments on commit 18f6120

Please sign in to comment.