[
https://issues.apache.org/jira/browse/CB-10622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15195614#comment-15195614
]
ASF GitHub Bot commented on CB-10622:
-------------------------------------
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?
> Windows MRT images are not parsed from config.xml
> -------------------------------------------------
>
> Key: CB-10622
> URL: https://issues.apache.org/jira/browse/CB-10622
> Project: Apache Cordova
> Issue Type: Bug
> Components: CordovaLib, Windows
> Affects Versions: 6.0.0
> Reporter: Andor Polgari
> Assignee: Sergey Grebnov
> Labels: mustfix, triaged
>
> MRT images on Windows are not working correctly through the config.xml file.
> "Target" attribute is not parsed from config and not all kind of images are
> recognized ("scale" only, "targetsize" images are ignored)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]