Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Add System.Drawing.Region tests #20901

Merged
merged 3 commits into from
Jun 14, 2017
Merged

Add System.Drawing.Region tests #20901

merged 3 commits into from
Jun 14, 2017

Conversation

hughbe
Copy link

@hughbe hughbe commented Jun 10, 2017

A 50-50 mix of tests cleanup up from Mono, and tests I wrote myself

@mellinoe

@@ -0,0 +1,1930 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
Copy link
Member

Choose a reason for hiding this comment

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

I believe the middle line here needs to come out if it's Mono code:

	1. Keep the existing copyright headers in place
		○ Note: If you are porting just portions of the file over, you still need to bring over all the existing copyright headers.
	2. Add the following copyright headers – NOTE this is missing the middle line of the ‘regular’ CoreFx copyright headers:
 // Licensed to the .NET Foundation under one or more agreements.
// See the LICENSE file in the project root for more information.

Although if only part is, I'm not sure. @AlexGhiondea did legal indicate what to do in that case?

Copy link
Author

Choose a reason for hiding this comment

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

I removed it

Copy link
Contributor

Choose a reason for hiding this comment

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

@danmosemsft I didn't ask them about this case in particular. Could we split the file so that whatever came from Mono is in a single file and the new tests in a separate one?

Copy link
Author

@hughbe hughbe Jun 12, 2017

Choose a reason for hiding this comment

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

That's going to be tricky. Basically these tests aren't really entirely from Mono - I'm just using their test data interweaved amongst tests I added to increase coverage

Copy link
Member

Choose a reason for hiding this comment

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

Applying common sense: I would just keep the Mono "copyright" there. Nothing prevents us to extend Mono files and modify them. Even upon initial checkin AFAIK. The key thing is to acknowledge where it came from. Of course, I am not a lawyer, maybe we should ask ...

Copy link
Author

Choose a reason for hiding this comment

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

You expect common sense of law!? 😃
But, seriously, do you mean both the net foundation header and the mono one or just mono?

Copy link
Member

Choose a reason for hiding this comment

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

Aren't you supposed to be the law expert here? 😆

The rule I heard was having both - Mono & .NET Foundation at the top of the file. Again, we may need to check. HttpListener code came from Mono, so you might want to check there.

Copy link
Member

Choose a reason for hiding this comment

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

@karelz the question is not whether to have both, it's whether to remove this line // The .NET Foundation licenses this file to you under the MIT license.

@AlexGhiondea since you had the original thread with legal, could you please ask them whether we should have that line if there's non-Mono content in there? (Presumably pretty much all the files we borrowed from Mono will eventually have non-Mono content in there)

I don't think that should hold up checking this in - either way around :)

@karelz karelz added this to the 2.1.0 milestone Jun 11, 2017
@karelz
Copy link
Member

karelz commented Jun 11, 2017

@mellinoe can you please double-check we keep Mono license header? There were some rules around that ...

Copy link
Contributor

@mellinoe mellinoe left a comment

Choose a reason for hiding this comment

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

Thanks for all of these tests. They look good as far as validating existing Windows behavior. I left two small style requests.

{
public class RegionTests
{
private static Graphics s_graphic = Graphics.FromImage(new Bitmap(1, 1));
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: readonly

public void Ctor_EmptyGraphicsPath_ThrowsExternalException()
{
var region = new Region(new GraphicsPath());
Assert.Throws<ExternalException>(() => new Region(region.GetRegionData()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you split this into two lines so it is clear which call should be throwing an exception?

[ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))]
public void Ctor_GraphicsPath()
{
var graphics = new GraphicsPath();
Copy link
Contributor

Choose a reason for hiding this comment

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

This variable should probably be called graphicsPath.

@hughbe
Copy link
Author

hughbe commented Jun 13, 2017

Addressed all the PR feedback

@mellinoe
Copy link
Contributor

The latest version looks good. You will just need to rebase because I've merged other PR's.

@hughbe
Copy link
Author

hughbe commented Jun 14, 2017

Rebased

@mellinoe mellinoe merged commit 2e833a4 into dotnet:master Jun 14, 2017
@hughbe hughbe deleted the region-tests branch June 14, 2017 22:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants