mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
Merge pull request #3938 from NativeScript/fix-border-and-corner-radius-tests
The asserted border and corner radius values were not rounded, we now round on dip to px conversion
This commit is contained in:
@ -809,7 +809,7 @@ export function testSetInlineStyle() {
|
|||||||
export function testBorderWidth() {
|
export function testBorderWidth() {
|
||||||
helper.buildUIAndRunTest(_createLabelWithBorder(), function (views: Array<View>) {
|
helper.buildUIAndRunTest(_createLabelWithBorder(), function (views: Array<View>) {
|
||||||
const lbl = views[0];
|
const lbl = views[0];
|
||||||
const expectedValue = <number>lbl.borderWidth * utils.layout.getDisplayDensity();
|
const expectedValue = Math.round(<number>lbl.borderWidth * utils.layout.getDisplayDensity());
|
||||||
const actualValue = definition.getUniformNativeBorderWidth(lbl);
|
const actualValue = definition.getUniformNativeBorderWidth(lbl);
|
||||||
TKUnit.assertAreClose(actualValue, expectedValue, 0.01, "borderWidth");
|
TKUnit.assertAreClose(actualValue, expectedValue, 0.01, "borderWidth");
|
||||||
});
|
});
|
||||||
@ -819,7 +819,7 @@ export function testCornerRadius() {
|
|||||||
helper.buildUIAndRunTest(_createLabelWithBorder(), function (views: Array<View>) {
|
helper.buildUIAndRunTest(_createLabelWithBorder(), function (views: Array<View>) {
|
||||||
const lbl = views[0];
|
const lbl = views[0];
|
||||||
TKUnit.waitUntilReady(() => lbl.isLayoutValid);
|
TKUnit.waitUntilReady(() => lbl.isLayoutValid);
|
||||||
const expectedValue = <number>lbl.borderRadius * utils.layout.getDisplayDensity();
|
const expectedValue = Math.round(<number>lbl.borderRadius * utils.layout.getDisplayDensity());
|
||||||
const actualValue = definition.getUniformNativeCornerRadius(lbl);
|
const actualValue = definition.getUniformNativeCornerRadius(lbl);
|
||||||
TKUnit.assertAreClose(actualValue, expectedValue, 0.01, "borderRadius");
|
TKUnit.assertAreClose(actualValue, expectedValue, 0.01, "borderRadius");
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user