Github user nikhilkh commented on a diff in the pull request:
https://github.com/apache/cordova-windows/pull/159#discussion_r56196972
--- Diff: spec/unit/Prepare.Win10.spec.js ---
@@ -380,3 +383,79 @@ describe('A Windows 10 project should apply the uap:
namespace prefix to certain
expect(testResults.location).toBe('DeviceCapability');
});
});
+
+describe('copyIcons method', function () {
+ var copyImages = prepare.__get__('copyImages');
+
+ var PROJECT = '/some/path';
+
+ function createMockConfig(images) {
+ var result = jasmine.createSpyObj('config', ['getIcons',
'getSplashScreens']);
+ result.getIcons.andReturn(images);
+ result.getSplashScreens.andReturn([]);
+
+ return result;
+ }
+
+ beforeEach(function () {
+ spyOn(shell, 'cp');
+ });
+
+ it('should guess target filename based on icon size', function () {
+ var images = [
+ {src: 'res/Windows/Square44x44Logo_100.png', width: '44',
height: '44' },
+ {src: 'res/Windows/Square44x44Logo_240.png', width: '106',
height: '106' }
+ ];
+
+ var config = createMockConfig(images);
+
+ copyImages(config, PROJECT);
+
+ expect(shell.cp).toHaveBeenCalledWith('-f',
path.normalize('res/Windows/Square44x44Logo_100.png'), path.join(PROJECT,
'images/Square44x44Logo.scale-100.png'));
+ expect(shell.cp).toHaveBeenCalledWith('-f',
path.normalize('res/Windows/Square44x44Logo_240.png'), path.join(PROJECT,
'images/Square44x44Logo.scale-240.png'));
+ });
+
+ it('should ignore unknown icon sizes and emit a warning', function () {
+ var config = createMockConfig([
+ {src: 'res/Windows/UnknownImage.png', width: '999', height:
'999' },
+ ]);
+
+ var warnSpy = jasmine.createSpy('warn');
+ events.on('warn', warnSpy);
+ copyImages(config, PROJECT);
+ expect(shell.cp).not.toHaveBeenCalled();
+ expect(warnSpy.calls[0].args[0]).toMatch('image is skipped');
+ });
+
+ 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',
--- End diff --
Does the qualifier not have to be following a specific syntax for it to
work? Should we validate that?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]