mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fix dp vs dip conversions in iOS for errors of tests
This commit is contained in:
@@ -139,8 +139,10 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
|
||||
|
||||
if (label.ios) {
|
||||
this.waitUntilTestElementLayoutIsValid();
|
||||
|
||||
const expectedValue = 3;
|
||||
let expectedValue = NSString.stringWithString("i").sizeWithAttributes(<any>{
|
||||
[NSFontAttributeName]: UIFont.systemFontOfSize(9)
|
||||
}).width;
|
||||
expectedValue = Math.ceil(utils.layout.toDevicePixels(expectedValue));
|
||||
const measuredWidth = label.getMeasuredWidth();
|
||||
TKUnit.assertEqual(measuredWidth, expectedValue, "measuredWidth should not be rounded down.");
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import * as color from "color";
|
||||
import * as helper from "../helper";
|
||||
import * as TKUnit from "../../TKUnit";
|
||||
import * as button from "ui/button";
|
||||
import * as utils from "utils/utils";
|
||||
|
||||
global.moduleMerge(commonTests, exports);
|
||||
|
||||
@@ -21,7 +22,7 @@ class MyGrid extends grid.GridLayout {
|
||||
}
|
||||
|
||||
export function getUniformNativeBorderWidth(v: view.View): number {
|
||||
return (<UIView>v.ios).layer.borderWidth;
|
||||
return utils.layout.toDevicePixels((<UIView>v.ios).layer.borderWidth);
|
||||
}
|
||||
|
||||
export function checkUniformNativeBorderColor(v: view.View): boolean {
|
||||
|
||||
Reference in New Issue
Block a user