Skip to content

[Android] Ensure Image scaling takes Width/Height into account - #2742

Merged
carldebilly merged 1 commit into
masterfrom
dev/djo/image-android-fix-2
Mar 4, 2020
Merged

carldebilly merged 1 commit into
masterfrom
dev/djo/image-android-fix-2

Conversation

@davidjohnoliver

Copy link
Copy Markdown
Contributor

This fixes bug where image requests all available size, even when it has a fixed dimension and aspect ratio.

GitHub Issue (If applicable): fixes #2541

PR Type

  • Bugfix

What kind of change does this PR introduce?

What is the current behavior?

What is the new behavior?

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Docs have been added/updated which fit documentation template (for bug fixes / features)
  • Unit Tests and/or UI Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Wasm UI Tests are not showing unexpected any differences. Validate PR Screenshots Compare Test Run results.
  • Contains NO breaking changes
  • Updated the Release Notes
  • Associated with an issue (GitHub or internal)

Other information

Internal Issue (If applicable):

This fixes bug where image requests all available size, even when it has a fixed dimension and aspect ratio.
@gitpod-io

gitpod-io Bot commented Mar 4, 2020

Copy link
Copy Markdown

public static Size AdjustSize(this Image image, Size availableSize, Size measuredSize)
{
return AdjustSize(image.Stretch, availableSize, measuredSize);
return AdjustSize(image.Stretch, image.ApplySizeConstraints(availableSize), measuredSize);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very big changes :-)

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 12783 found UI Test snapshots differences.

  • android-28: 5 changed over 315

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • PopupWithOverlay_After
    • BasicNavigationView_SamplesApp_Samples_Windows_UI_Xaml_Controls_NavigationViewTests_NavigationView_Pane_Automated
    • TestManipulation_Result
    • ToggleSwitch_TemplateReuseTest_UITests_Shared_Windows_UI_Xaml_Controls_ToggleSwitchControl_ToggleSwitch_TemplateReuse
    • Simple_ContentDialog_01_PrimaryCommand_UITests_Shared_Windows_UI_Xaml_Controls_ContentDialogTests_ContentDialog_Simple
  • android-28-Snap: 10 changed over 678

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Button_Custom_Button_With_ContentTemplate_Uno_UI_Samples_Content_UITests_ButtonTestsControl_Custom_Button_With_ContentTemplate
    • ComboBox_UITests_Shared_Windows_UI_Xaml_Controls_ComboBox_ComboBox_DropDownPlacement_UITests_Shared_Windows_UI_Xaml_Controls_ComboBox_ComboBox_DropDownPlacement
    • Image_UITests_Windows_UI_Xaml_Controls_ImageTests_ImageAlignment2541_UITests_Windows_UI_Xaml_Controls_ImageTests_ImageAlignment2541
    • Image_UniformToFill100x100_Uno_UI_Samples_UITests_ImageTestsControl_UniformToFill100x100
    • ListView_ListViewIncrementalLoading_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewIncrementalLoading
    • TextBlockControl_TextBoxSizeChanging_Uno_UI_Samples_Content_UITests_TextBlockControl_TextBoxSizeChanging
    • Transform_TransformToVisual_Translate2d_SamplesApp_Wasm_Windows_UI_Xaml_Media_Transform_TransformToVisual_Translate2d
    • XBind_Phase_Large_Uno_UI_Samples_Content_UITests_XBind_PhaseBinding_Large
    • TextBox_Uno_UI_Samples_Content_UITests_TextBoxControl_PasswordBox_Reveal_Scroll_Uno_UI_Samples_Content_UITests_TextBoxControl_PasswordBox_Reveal_Scroll
    • WebView_WebView_NavigateToString_Uno_UI_Samples_Content_UITests_WebView_WebView_NavigateToString
  • ios: 8 changed over 166

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Keyboard_Textbox_NoScrollViewer_Validation_0_-_Remove_Focus_on_normalTextBox
    • Keyboard_Textbox_NoScrollViewer_Validation_4_-_Remove_Focus_on_multilineTextBox
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • Keyboard_Textbox_InsideScrollViewer_Validation_0_-_Remove_Focus_on_normalTextBox
    • Keyboard_Textbox_InsideScrollViewer_Validation_1_-_Remove_Focus_on_filledTextBox
    • Keyboard_Textbox_InsideScrollViewer_Validation_2_-_Remove_Focus_on_placeholderTextTextBox
    • Keyboard_Textbox_InsideScrollViewer_Validation_4_-_Remove_Focus_on_multilineTextBox
    • Keyboard_Textbox_NoScrollViewer_Validation_1_-_Remove_Focus_on_filledTextBox
  • ios-Snap: 4 changed over 670

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Default_Uno_UI_Samples_UITests_Image_Image_Stretch_Uno_UI_Samples_UITests_Image_Image_Stretch
    • MediaPlayerElement_Using__3gp_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_3gp_Extension
    • ListView_ListView_Image_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListView_Image
    • MediaPlayerElement_Using__flv_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Flv_Extension
  • wasm: 2 changed over 679

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Uno.UI.Samples.Content.UITests.Transform.Image_With_RotateTransform
    • Uno.UI.Samples.UITests.Image.Image_Margin
  • wasm-automated: 6 changed over 352

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • RunRuntimeTests_SamplesApp_Samples_UnitTests_UnitTestsPage
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • Simple_ContentDialog_01_Primary_Primary_Button
    • ListView_Weird_Measure_During_Arrange_after_layout
    • LoadEmptyContentControl_ContentControlNoTemplateNoContent_-_bntContentClear
    • Simple_ContentDialog_06_Reuse_Primary_Button

@carldebilly
carldebilly merged commit d7e1191 into master Mar 4, 2020
@carldebilly
carldebilly deleted the dev/djo/image-android-fix-2 branch March 4, 2020 21:43
@jeromelaban

Copy link
Copy Markdown
Member

@Mergifyio backport release/beta/2.1

@mergify

mergify Bot commented Mar 11, 2020

Copy link
Copy Markdown
Contributor

Command backport release/beta/2.1: success

Backports have been created

jeromelaban added a commit that referenced this pull request Mar 11, 2020
…/pr-2742

[Android] Ensure Image scaling takes Width/Height into account (bp #2742)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android] HorizontalAlignement issue when image is inside a button

5 participants