Repository navigation
Description
This issue tracks porting some set of tests from mono's test suite, covering the portions of System.Drawing that we support on .NET Core.
Mono's test cases are in this folder: https://github.com/mono/mono/tree/master/mcs/class/System.Drawing/Test
We most likely want to convert the most useful tests from all of the sections here, with the exception of System.Drawing.Design, which we aren't going to support right now on .NET Core (it is mainly related to designer / WinForms support).
Mono's tests use NUnit, so we will need to convert them to Xunit when copying them.
Additionally, I've identified that there will need to be some functional changes made to the tests themselves, as they do not pass against the .NET Framework implementation. We consider the .NET Framework implementation to be the compatibility baseline, so we should change the tests to accomodate it, rather than the other way around. The test failures seemed mainly related to very small, subtle differences in things like floating-point precision, color values, offsets, etc. We should do the following when we have both Windows and Unix implementations up and running:
- Ensure that all tests have enough "leniency" to accomodate floating-point differences (and other minor inconsistencies) where unavoidable.
- Ensure that all minor inconsistencies are acceptable or otherwise very difficult / problematic to fix.
- Ensure that all minor inconsistencies are listed somewhere, so that we can mention it both in the tests, and in the user documentation.
@hughbe @qmfrederik @marek-safar
Current Status
Code coverage:
Note that there is a large amount of internal and debug-only code which distorts these numbers. When the coverage is generally high, we can clean out a lot of dead code and then get more accurate data.
| Date | Branch Coverage | Line Coverage |
|---|---|---|
| 6/26/2017 | 33% | 25% |
| 7/11/2017 | 49% | 54% |
| 7/17/2017 | 55% | 60% |
| 8/2/2017 | 58% | 66% |
| 8/25/2017 | 62% | 71% |
| 9/21/2017 | 64.6% | 75.3% |
Namespaces and coverage, as of 9/21/2017:
- System.Drawing: 76.3%
- System.Drawing.Drawing2D: 93.8%
- System.Drawing.Imaging: 86.1%
- System.Drawing.Printing: 62.8%
- System.Drawing.Text: 96%
Activity
norek commentedon Jun 5, 2017
Hi I can grab some part of those tests for example System.Drawing.Printing, on start. Then when all will be fine i can port next part. What do you think?
mellinoe commentedon Jun 5, 2017
@norek Splitting up the work sounds like a good idea to me. I've created separate items above for each of the folders in mono's test bed. I've put your name next to System.Drawing.Printing.
Looking over the tests in that folder, I think they are fairly straightforward, with a couple of exceptions. I would ignore the following tests for now:
We don't care about any of this permissions stuff in .NET Core, nor do we enforce it.
This one isn't going to work outside of Unix or the libgdiplus implemetation, so don't bother with it for now.
norek commentedon Jun 6, 2017
@mellinoe in
slnfile is reference to test project but it is missing in source code. Did you forgot push it?mellinoe commentedon Jun 6, 2017
@norek Oops -- it was a mistake to include it in the solution file. I had a couple of tests written on my local machine, but they weren't worth merging.
norek commentedon Jun 8, 2017
I have little question about moving tests from Nunit to Xunit. In mono tests, very often
Assertis used with description,prabobly beacuse there are more than one assert in test and description provide better debug (i think). What should I do with this case. Xunit doesn't provide description forAssert.Equal.Should I remove this description?
mellinoe commentedon Jun 8, 2017
Yes -- remove the description. If really necessary, just provide the message in a comment next to the assertion.
hughbe commentedon Jun 9, 2017
@norek a test project has been merged so feel free to get started. Mind if I ask what you're working on so we avoid conflicts?
Note that I'm gonna put some effort into beautifying and modernising these tests using xunit's features like parameter names in exceptions and theory/member data
Keep me up to date :)
norek commentedon Jun 9, 2017
@hughbe Thanks! Im working on System.Drawing.Printing namespace. In description of this issue You can see list of assigned items.
norek commentedon Jun 12, 2017
How about testing
PageSettingsclass? In mono's test i found comment:I dont know what to do with this.
mellinoe commentedon Jun 12, 2017
@norek We certainly don't have any printers attached to the machines that run our CI tests, if that is what you are alluding to. You can just keep that check in the test code. Are you asking about something else?
mellinoe commentedon Jun 12, 2017
@hughbe Could you post something here as you start writing/porting tests for individual components? It would be good to have a list of "in-progress" work so that we know what's being covered.
norek commentedon Jun 13, 2017
@mellinoe yup, this is what I meant. Thanks
norek commentedon Jun 13, 2017
@hughbe Can you tell me what is this?
public static IEnumerable<(int, Color)> SystemColors_TestData()inColorTranslatorTests.csbuild is passing, but VS highlight this syntax. I see this syntax for first time ;o
second: In my machine after pull your changes, I have failing your tests for example:
do you have idea why? clean, build on root completed.
mellinoe commentedon Jun 13, 2017
Those are
ValueTuples, a new C#7 feature. You will need VS 2017 to edit that, I believe...mellinoe commentedon Jun 13, 2017
@norek As for the test failure: what language settings does your computer use? We might be assuming that English is used, and number parsing could fail with other culture settings.
90 remaining items
Adding System.Drawing.Printing PrintDocument tests. (#20711)
KostaVlev commentedon Aug 2, 2017
I moved on System.Drawing.Printing.
hughbe commentedon Aug 2, 2017
<3 good stuff
Adding System.Drawing.Printing PrintDocument tests. (#22868)
mellinoe commentedon Aug 25, 2017
Code coverage numbers are looking really good to me (updated at the top), considering there are a few large files full of dead code (or code that doesn't really need to be tested). Thanks for all of the contributions, everyone!
norek commentedon Sep 19, 2017
How nice, a lot of work was made since my "vacation". I just bought new computer and i'm ready to go!
mellinoe commentedon Sep 21, 2017
Some more steady progress was made in the past month. I think @qmfrederik's current effort will give us enough coverage to fill in the remaining gaps and let us close this issue out.