X Tutup
The Wayback Machine - https://web.archive.org/web/20201021132508/https://github.com/unoplatform/uno/pull/2698
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve BitmapImage.SetSource() #2698

Open
wants to merge 3 commits into
base: master
from
Open

Conversation

@TopperDEL
Copy link
Contributor

@TopperDEL TopperDEL commented Feb 26, 2020

GitHub Issue (If applicable): #2377

PR Type

What kind of change does this PR introduce?

  • Bugfix

What is the current behavior?

BitmapImage.SetSource Needs Access to the provided stream, Which makes it difficult to handle. It should be in line with SetSourceAsync.

What is the new behavior?

BitmapImage.SetSource makes a local copy of the provided stream and therefore manges it in ist own.

PR Checklist

Please check if your PR fulfills the following requirements:

  • Contains NO breaking changes
  • Updated the Release Notes
  • Associated with an issue (GitHub or internal)

Other information

Internal Issue (If applicable):

TopperDEL added 2 commits Feb 26, 2020
@gitpod-io
Copy link

@gitpod-io gitpod-io bot commented Feb 26, 2020

@TopperDEL TopperDEL marked this pull request as ready for review Feb 26, 2020
@TopperDEL
Copy link
Contributor Author

@TopperDEL TopperDEL commented Feb 26, 2020

I don't know what's wrong with the checks ("Pull Request Labeler" failed). Did I name the PR wrong?

@jeromelaban
Copy link
Member

@jeromelaban jeromelaban commented Feb 27, 2020

Thanks for your submission!

You'll need to add a UI Test to validate the behavior. You can add a control here:

@jeromelaban
Copy link
Member

@jeromelaban jeromelaban commented Feb 27, 2020

Thank you for your contribution!

You'll need to add a UI test control here: https://github.com/unoplatform/uno/tree/master/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ImageTests

In the constructor or a loaded event, your can add reference an image and call SetSource with a stream that comes from an embedded resource image, and that sets that stream position to the end (so that it would fail if the image was read later.

Once there, you can add a UI Tests here:

That will validate that the size of the image is the appropriate one. Note that the UI Test will need to be disabled for Wasm (SetSource is not supported yet).

You can get more information on how to create uitests here.

GitHub
Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported. - unoplatform/uno

Stream = streamSource;

if (streamSource != null)

This comment has been minimized.

@carldebilly

carldebilly Apr 16, 2020
Member

Code convention here: when you have a else block, please try to avoid a not equal != had write the equal == first.

@CLAassistant
Copy link

@CLAassistant CLAassistant commented Jun 10, 2020

CLA assistant check
All committers have signed the CLA.

@carldebilly carldebilly self-assigned this Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.
X Tutup