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

System.Drawing.Tests.PenTests.Ctor_Brush_Width<SolidBrush> test fail #60480

Closed
AlexRadch opened this issue Oct 15, 2021 · 3 comments
Closed

System.Drawing.Tests.PenTests.Ctor_Brush_Width<SolidBrush> test fail #60480

AlexRadch opened this issue Oct 15, 2021 · 3 comments
Labels
area-System.Drawing test-bug Problem in test source code (most likely)
Milestone

Comments

@AlexRadch
Copy link
Contributor

AlexRadch commented Oct 15, 2021

Description

System.Drawing.Tests.PenTests.Ctor_Brush_Width<SolidBrush> test fail on Russian Windows when SolidBrush width < 1 with next logs:

    6)   System.Drawing.Tests.PenTests.Ctor_Brush_Width<SolidBrush>(brush: SolidBrush { Color = Color [Red] }, width: 0, expectedPenType: SolidColor) 
      Duration: 9 ms

      Message: 
Assert.Equal() Failure
Expected: 0
Actual:   1

      Stack Trace: 
PenTests.VerifyPen[T](Pen pen, PenType expectedPenType, Single expectedWidth) line 1378
PenTests.Ctor_Brush_Width[T](T brush, Single width, PenType expectedPenType) line 56
    7)   System.Drawing.Tests.PenTests.Ctor_Brush_Width<SolidBrush>(brush: SolidBrush { Color = Color [Red] }, width: -1, expectedPenType: SolidColor) 
      Duration: < 1 ms

      Message: 
Assert.Equal() Failure
Expected: -1
Actual:   1

      Stack Trace: 
PenTests.VerifyPen[T](Pen pen, PenType expectedPenType, Single expectedWidth) line 1378
PenTests.Ctor_Brush_Width[T](T brush, Single width, PenType expectedPenType) line 56
    9)   System.Drawing.Tests.PenTests.Ctor_Brush_Width<SolidBrush>(brush: SolidBrush { Color = Color [Red] }, width: -∞, expectedPenType: SolidColor) 
      Duration: < 1 ms

      Message: 
Assert.Equal() Failure
Expected: -∞
Actual:   1

      Stack Trace: 
PenTests.VerifyPen[T](Pen pen, PenType expectedPenType, Single expectedWidth) line 1378
PenTests.Ctor_Brush_Width[T](T brush, Single width, PenType expectedPenType) line 56

Reproduction Steps

Run tests on Russian Windows 10.

Expected behavior

Passed tests.

Actual behavior

Failed tests.

Regression?

Are test data correct for all windows?

            yield return new object[] { new SolidBrush(Color.Red), 0, PenType.SolidColor };
            yield return new object[] { new SolidBrush(Color.Red), -1, PenType.SolidColor };
            yield return new object[] { new SolidBrush(Color.Red), float.NegativeInfinity, PenType.SolidColor };

Known Workarounds

No response

Configuration

No response

Other information

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Drawing untriaged New issue has not been triaged by the area owner labels Oct 15, 2021
@ghost
Copy link

ghost commented Oct 15, 2021

Tagging subscribers to this area: @safern, @tarekgh
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

System.Drawing.Tests.PenTests.Ctor_Brush_Width test fail on Russian Windows with next logs:

    6)   System.Drawing.Tests.PenTests.Ctor_Brush_Width<SolidBrush>(brush: SolidBrush { Color = Color [Red] }, width: 0, expectedPenType: SolidColor) 
      Duration: 9 ms

      Message: 
Assert.Equal() Failure
Expected: 0
Actual:   1

      Stack Trace: 
PenTests.VerifyPen[T](Pen pen, PenType expectedPenType, Single expectedWidth) line 1378
PenTests.Ctor_Brush_Width[T](T brush, Single width, PenType expectedPenType) line 56
    7)   System.Drawing.Tests.PenTests.Ctor_Brush_Width<SolidBrush>(brush: SolidBrush { Color = Color [Red] }, width: -1, expectedPenType: SolidColor) 
      Duration: < 1 ms

      Message: 
Assert.Equal() Failure
Expected: -1
Actual:   1

      Stack Trace: 
PenTests.VerifyPen[T](Pen pen, PenType expectedPenType, Single expectedWidth) line 1378
PenTests.Ctor_Brush_Width[T](T brush, Single width, PenType expectedPenType) line 56
    9)   System.Drawing.Tests.PenTests.Ctor_Brush_Width<SolidBrush>(brush: SolidBrush { Color = Color [Red] }, width: -∞, expectedPenType: SolidColor) 
      Duration: < 1 ms

      Message: 
Assert.Equal() Failure
Expected: -∞
Actual:   1

      Stack Trace: 
PenTests.VerifyPen[T](Pen pen, PenType expectedPenType, Single expectedWidth) line 1378
PenTests.Ctor_Brush_Width[T](T brush, Single width, PenType expectedPenType) line 56

Reproduction Steps

Run tests on Russian Windows 10.

Expected behavior

Passed tests.

Actual behavior

Failed tests.

Regression?

Are test data correct for all windows?

            yield return new object[] { new SolidBrush(Color.Red), 0, PenType.SolidColor };
            yield return new object[] { new SolidBrush(Color.Red), -1, PenType.SolidColor };
            yield return new object[] { new SolidBrush(Color.Red), float.NegativeInfinity, PenType.SolidColor };

Known Workarounds

No response

Configuration

No response

Other information

No response

Author: AlexRadch
Assignees: -
Labels:

area-System.Drawing, untriaged

Milestone: -

@safern safern added test-bug Problem in test source code (most likely) and removed untriaged New issue has not been triaged by the area owner labels Oct 15, 2021
@safern safern added this to the Future milestone Oct 15, 2021
@danmoseley
Copy link
Member

We just call

            int status = Gdip.GdipCreatePen2(new HandleRef(brush, brush.NativeBrush),
                width,
                (int)GraphicsUnit.World,
                out pen);

including checking the return code, then read it back

                var width = new float[] { 0 };
                int status = Gdip.GdipGetPenWidth(new HandleRef(this, NativePen), width);

and again throw if it returns other than OK. Seems a Windows issue.

Apparently this is only happening for those invalid width values, and passing for the valid ones. So it seems no big deal. My suggestion is to just disable the invalid ones (Ctor_Brush_Width_TestData) for non English.

@AlexRadch
Copy link
Contributor Author

My suggestion is to just disable the invalid ones (Ctor_Brush_Width_TestData) for non English.

Do you suggest disabling the invalid ones for non-English for all OS or Windows only?

danmoseley pushed a commit that referenced this issue Oct 16, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Nov 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Drawing test-bug Problem in test source code (most likely)
Projects
None yet
Development

No branches or pull requests

3 participants