Skip to content

Commit b27c05e

Browse files
author
hshristov
committed
Fix label ellipsis issue on zoomed iPhone 6 Plus.
Fix Image.imageSource propertyMetadata to affects layout.
1 parent d2160f7 commit b27c05e

5 files changed

Lines changed: 30 additions & 7 deletions

File tree

apps/tests/ui/image/image-tests.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,8 @@ export var test_SettingStretch_none = function () {
249249

250250
helper.buildUIAndRunTest(image, testFunc);
251251
}
252+
253+
export var test_src_property_affects_layout = function () {
254+
var sourceProperty = ImageModule.Image.imageSourceProperty;
255+
TKUnit.assertEqual(sourceProperty.metadata.affectsLayout, true, "sourceProperty should invalidate layout");
256+
}

apps/tests/ui/label/label-tests.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,24 @@ export var test_Set_Text_Native = function () {
8787
helper.buildUIAndRunTest(label, test);
8888
}
8989

90+
export var test_measuredWidth_is_not_clipped = function () {
91+
var label = new LabelModule.Label();
92+
label.horizontalAlignment = "left";
93+
label.text = "i";
94+
label.fontSize = 9;
95+
96+
var test = function (views: Array<view.View>) {
97+
98+
TKUnit.waitUntilReady(() => { return label.isLayoutValid; });
99+
100+
var expectedValue = 3;
101+
var measuredWidth = label.getMeasuredWidth();
102+
TKUnit.assertEqual(measuredWidth, expectedValue, "measuredWidth should not be rounded down.");
103+
}
104+
105+
helper.buildUIAndRunTest(label, test);
106+
}
107+
90108
export var test_Set_TextWrap_TNS = function () {
91109
// <snippet module="ui/label" title="Label">
92110
// ### How to turn on text wrapping for a label

ui/core/view-common.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ export class View extends proxy.ProxyObject implements definition.View {
476476

477477
case utils.layout.AT_MOST:
478478
if (specSize < size) {
479-
result = Math.round(specSize) | utils.layout.MEASURED_STATE_TOO_SMALL;
479+
result = Math.round(specSize + 0.499) | utils.layout.MEASURED_STATE_TOO_SMALL;
480480
}
481481
break;
482482

@@ -485,7 +485,7 @@ export class View extends proxy.ProxyObject implements definition.View {
485485
break;
486486
}
487487

488-
return Math.round(result) | (childMeasuredState & utils.layout.MEASURED_STATE_MASK);
488+
return Math.round(result + 0.499) | (childMeasuredState & utils.layout.MEASURED_STATE_MASK);
489489
}
490490

491491
public static layoutChild(parent: View, child: View, left: number, top: number, right: number, bottom: number): void {

ui/image/image-common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class Image extends view.View implements definition.Image {
6565
IMAGE,
6666
new proxy.PropertyMetadata(
6767
undefined,
68-
dependencyObservable.PropertyMetadataSettings.None
68+
dependencyObservable.PropertyMetadataSettings.AffectsLayout
6969
)
7070
);
7171

ui/image/image.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ declare module "ui/image" {
1010
* Represents a class that provides functionality for loading and streching image(s).
1111
*/
1212
export class Image extends view.View {
13-
public static urlProperty: dependencyObservable.Property;
14-
public static sourceProperty: dependencyObservable.Property;
13+
public static srcProperty: dependencyObservable.Property;
14+
public static imageSourceProperty: dependencyObservable.Property;
1515
public static isLoadingProperty: dependencyObservable.Property;
1616
public static stretchProperty: dependencyObservable.Property;
1717

@@ -53,12 +53,12 @@ declare module "ui/image" {
5353
/**
5454
* Gets or sets the image source of the image.
5555
*/
56-
source: imageSource.ImageSource;
56+
imageSource: imageSource.ImageSource;
5757

5858
/**
5959
* Gets or sets the URL of the image.
6060
*/
61-
url: string;
61+
src: string;
6262

6363
/**
6464
* Gets or sets the image stretch mode. Possible values are contained in the [Stretch enumeration](../enums/Stretch/README.md).

0 commit comments

Comments
 (0)