Return-Path: X-Original-To: apmail-cordova-dev-archive@www.apache.org Delivered-To: apmail-cordova-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 987BE197C2 for ; Tue, 15 Mar 2016 16:44:38 +0000 (UTC) Received: (qmail 41599 invoked by uid 500); 15 Mar 2016 16:44:38 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 41565 invoked by uid 500); 15 Mar 2016 16:44:38 -0000 Mailing-List: contact dev-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list dev@cordova.apache.org Received: (qmail 41554 invoked by uid 99); 15 Mar 2016 16:44:38 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Mar 2016 16:44:38 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B6D0CDFA42; Tue, 15 Mar 2016 16:44:37 +0000 (UTC) From: nikhilkh To: dev@cordova.apache.org Reply-To: dev@cordova.apache.org References: In-Reply-To: Subject: [GitHub] cordova-windows pull request: CB-10622 Support any MRT qualifiers ... Content-Type: text/plain Message-Id: <20160315164437.B6D0CDFA42@git1-us-west.apache.org> Date: Tue, 15 Mar 2016 16:44:37 +0000 (UTC) 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 infrastructure@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org For additional commands, e-mail: dev-help@cordova.apache.org