@@ -9,7 +9,9 @@ interface DesktopPackage {
99 readonly afterPack : string
1010 readonly appId : string
1111 readonly dmg : {
12+ readonly background : string
1213 readonly contents : readonly {
14+ readonly name ?: string
1315 readonly path ?: string
1416 readonly type : string
1517 readonly x : number
@@ -135,11 +137,39 @@ describe('desktop packaging configuration', () => {
135137 window : { height : 400 , width : 660 } ,
136138 } )
137139 expect ( desktopPackage . build . dmg . contents ) . toEqual ( [
138- { x : 180 , y : 200 , type : 'file' } ,
139- { x : 480 , y : 200 , type : 'link' , path : '/Applications' } ,
140+ { x : 180 , y : 250 , type : 'file' } ,
141+ { x : 480 , y : 250 , type : 'link' , path : '/Applications' } ,
142+ {
143+ name : '.background.png' ,
144+ path : 'build/background.png' ,
145+ type : 'file' ,
146+ x : 760 ,
147+ y : 520 ,
148+ } ,
149+ {
150+ name : '.VolumeIcon.icns' ,
151+ path : 'dist/.icon-icns/icon.icns' ,
152+ type : 'file' ,
153+ x : 760 ,
154+ y : 520 ,
155+ } ,
140156 ] )
141157 } )
142158
159+ it ( 'uses the branded 660x400 macOS DMG background' , ( ) => {
160+ const backgroundPath = resolve ( desktopRoot , 'build/background.png' )
161+
162+ expect ( desktopPackage . build . dmg . background ) . toBe ( 'build/background.png' )
163+ expect ( existsSync ( backgroundPath ) ) . toBe ( true )
164+
165+ const background = readFileSync ( backgroundPath )
166+ expect ( createHash ( 'sha256' ) . update ( background ) . digest ( 'hex' ) )
167+ . toBe ( '95e8b785add86919d269b198844d8a903280190f8fd33d5f8ffdca404c113fa8' )
168+ expect ( background . subarray ( 0 , 8 ) . toString ( 'hex' ) ) . toBe ( '89504e470d0a1a0a' )
169+ expect ( background . readUInt32BE ( 16 ) ) . toBe ( 660 )
170+ expect ( background . readUInt32BE ( 20 ) ) . toBe ( 400 )
171+ } )
172+
143173 it ( 'configures the Windows x64 NSIS installer' , ( ) => {
144174 expect ( desktopPackage . build . win . target ) . toEqual ( [ { target : 'nsis' , arch : [ 'x64' ] } ] )
145175 expect ( desktopPackage . build . nsis ) . toEqual ( {
0 commit comments