[ 
https://issues.apache.org/jira/browse/CB-10622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15201275#comment-15201275
 ] 

ASF GitHub Bot commented on CB-10622:
-------------------------------------

Github user vladimir-kotikov commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/159#discussion_r56635687
  
    --- 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 --
    
    From 
[doc](https://msdn.microsoft.com/en-us/library/windows/apps/hh965372.aspx) the 
syntax is:
    
    > The dotted segment in the file just before the file extension is 
considered a token that indicates qualifiers. Multiple qualifiers are separated 
by an underscore, and qualifiers are traditionally specified with their name 
and value
    
    It's not very clear what happens if the last segment doesn't match any 
qualifier or has some incorrect qualifier name/value, so i preferred not to 
perform any validation here.
    
    Also i've just checked and it seems that MSBuild already does some basic 
validation and emits a warning in this case
    
    ```
    e:\PROJECTS\Temp\foo
    λ cordova build windows
    Building project: 
e:\PROJECTS\Temp\foo\platforms\windows\CordovaApp.Windows.jsproj
            Configuration : debug
            Platform      : anycpu
    MakePRI : warning 0xdef00520: Invalid qualifier: DIMENSION-240 
[e:\PROJECTS\Temp\foo\platforms\windows\CordovaApp.Windows.jsproj]
    MakePRI : warning 0xdef00520: Invalid qualifier: SCALE-FOO 
[e:\PROJECTS\Temp\foo\platforms\windows\CordovaApp.Windows.jsproj]
    MakePRI : warning 0xdef00520: Invalid qualifier: SCALE-240_DIMENSION-FOO 
[e:\PROJECTS\Temp\foo\platforms\windows\CordovaApp.Windows.jsproj]
    ```
    
    the build succeeds though, and the resultant package contains improperly 
named files, so i think we could rely on MSBuild here.


> 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]

Reply via email to