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

Control printing test coverage #3540

Open
weltkante opened this issue Jul 7, 2020 · 0 comments
Open

Control printing test coverage #3540

weltkante opened this issue Jul 7, 2020 · 0 comments
Labels
test-enhancement Improvements of test source code
Milestone

Comments

@weltkante
Copy link
Contributor

weltkante commented Jul 7, 2020

Is your feature request related to a problem? Please describe.

During PR review it was noted that there is likely little test coverage of printing support of Controls. Printers typically use higher DPI and it was unclear how this represents itself during control rendering. The behavior should be checked and if possible tests should be added.

The most common usage of printing functionality I am aware of is used in reporting, where WinForms UserControls can be printed into a report. Sometimes people also want to print out a form filled with values for documentation purposes. Printing is also used to generate PDF or XPS documents to be sent by mail, so is not restricted to physical printers.

Describe the solution you'd like and alternatives you've considered

  • add tests for covering Control.DrawToBitmap, both for general functionality and also covering DPI behavior. Preliminary testing indicates that Control.DrawToBitmap currently ignores image DPI.

  • examine how WM_PRINT / WM_PRINTCLIENT scenarios are propagating DPI when rendering to a printer HDC (e.g. by calling PrintDlgEx to select a printer in a local test environment and use PrintWindow to trigger a WM_PRINT, or maybe send messages directly).

    Depending on how WinForms reacts on native messages with a printer HDC it may not be necessary to have dedicated tests, if it also ignores DPI like DrawToBitmap does then test coverage through the latter might be enough. If drawing to a printer HDC actually preserves DPI then there should be tests added to provide coverage and prevent regressions. It might be possible to use the XPS printing driver which "prints" to a file of zipped xmls.

Will this feature affect UI controls?

no

@weltkante weltkante added the api-suggestion (1) Early API idea and discussion, it is NOT ready for implementation label Jul 7, 2020
@RussKie RussKie added this to the 6.0 milestone Sep 4, 2020
@RussKie RussKie added test-enhancement Improvements of test source code and removed api-suggestion (1) Early API idea and discussion, it is NOT ready for implementation labels Feb 5, 2021
@RussKie RussKie modified the milestones: 6.0, 7.0 Aug 27, 2021
@merriemcgaw merriemcgaw modified the milestones: .NET 7.0, .NET 8.0 Aug 11, 2022
@JeremyKuhne JeremyKuhne modified the milestones: .NET 8.0, Future Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test-enhancement Improvements of test source code
Projects
None yet
Development

No branches or pull requests

4 participants