File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -339,19 +339,21 @@ export var test_DimensionsAreRoundedAfterScale = function() {
339339 let host = new StackLayout ( ) ;
340340 let image = new Image ( ) ;
341341 image . src = "~/ui/image/700x50.png" ;
342+ let imageWidth = 700 ;
343+ let imageHeight = 50 ;
342344
343345 let density = utils . layout . getDisplayDensity ( ) ;
344- let limit = 320 ;
345- host . width = limit / density ;
346- host . height = limit / density ;
346+ let hostWidth = 320 ;
347+ host . width = hostWidth / density ;
348+ host . height = hostWidth / density ;
347349 host . addChild ( image ) ;
348350 let mainPage = helper . getCurrentPage ( ) ;
349351 mainPage . content = host ;
350352 TKUnit . waitUntilReady ( ( ) => host . isLoaded ) ;
351353 TKUnit . waitUntilReady ( ( ) => image . isLayoutValid ) ;
352354
353- let scale = limit / 700 ;
354- let expectedHeight = Math . round ( 50 * scale ) ;
355- TKUnit . assertEqual ( image . getMeasuredWidth ( ) , limit , "Actual width is different from expected width." ) ;
355+ let scale = hostWidth / imageWidth ;
356+ let expectedHeight = Math . round ( imageHeight * scale ) ;
357+ TKUnit . assertEqual ( image . getMeasuredWidth ( ) , hostWidth , "Actual width is different from expected width." ) ;
356358 TKUnit . assertEqual ( image . getMeasuredHeight ( ) , expectedHeight , "Actual height is different from expected height." ) ;
357359} ;
You can’t perform that action at this time.
0 commit comments