Hi,
Just for laughs I decided to fix this bug outstanding since Flex 2.0!
https://issues.apache.org/jira/browse/FLEX-369
Basically AlertForm was calculating the text height but then ignoring that
value.
I have it working but have a couple of mustella Alert tests failing:
[java] =====================================================
[java] Failed:
[java] =====================================================
[java] components/Alert/Styles/Alert_Styles Alert_messageStyleName Failed
CompareBitmap(body:step 2) compare returned[object BitmapData]
[java] components/Alert/Styles/Alert_Styles Alert_titleStyleName Failed
CompareBitmap(body:step 2) compare returned[object BitmapData]
[java] components/Alert/Styles/Alert_Styles Alert_embedded_font_verdana
Failed CompareBitmap(body:step 3) compare returned[object BitmapData]
[java] components/Alert/Styles/Alert_Styles
Alert_embedded_font_verdana_italic Failed CompareBitmap(body:step 3) compare
returned[object BitmapData]
[java] components/Alert/Styles/Alert_Styles
Alert_embedded_font_verdana_bold Failed CompareBitmap(body:step 3) compare
returned[object BitmapData]
[java]
[java]
[java] =====================================================
[java] Passes: 42
[java] Fails: 5
[java] =====================================================
Of those 3 have no noticeable differences in the bitmaps I can detect (even
when compared in photoshop), one stops the text from going over the buttons (ie
fixes another bug) and the last has the text at a slightly different vertical
position (messageEmbedFont).
Here's the patch. Any suggestions for improvement or do we just replace the
baseline images?
diff --git a/frameworks/projects/mx/src/mx/controls/alertClasses/AlertForm.as
b/frameworks/projects/mx/src/mx/controls/alertClasses/AlertForm.as
index ce7e525..4329df2 100644
--- a/frameworks/projects/mx/src/mx/controls/alertClasses/AlertForm.as
+++ b/frameworks/projects/mx/src/mx/controls/alertClasses/AlertForm.as
@@ -331,6 +331,8 @@ public class AlertForm extends UIComponent implements
IFontContextComponent
// Limit the height if it exceeds the height of the Stage.
prefHeight = Math.min(prefHeight, screen.height * 0.75);
+ textHeight = Math.min(textHeight, prefHeight);
+
// Add space for buttons, spacing between buttons and text,
// and top/bottom margins
prefHeight += buttons[0].height + (3 * 8);
@@ -377,10 +379,9 @@ public class AlertForm extends UIComponent implements
IFontContextComponent
icon.y = (newY - icon.height) / 2;
newX += icon.width + 8;
}
-
- var newHeight:Number = textField.getExplicitOrMeasuredHeight();
- textField.move(newX, Math.round((newY - newHeight) / 2));
- textField.setActualSize(textWidth+5, newHeight);
+
+ textField.move(newX, Math.round((newY - textHeight) / 2));
+ textField.setActualSize(textWidth+5, textHeight);
}
/**
Thanks,
Justin