You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reduce duplicated code between Darwin's and Windows' image attachments. (#1270)
This PR cleans up the implementations of image attachments on Darwin and
Windows so that we have less code duplication between the two.
`_AttachableImageWrapper` is partially lowered to the main library
(excepting the platform-specific bits) and `ImageAttachmentError` is
lowered in its entirety.
There are some adjustments to the (internal/package) interface of
`_AttachableImageWrapper` to accomodate it not being able to specify
conformance to `AttachableAsCGImage` or `AttachableAsIWICBitmapSource`.
Namely, whatever code initializes an instance of it is responsible for
copying `image` and providing a deinitializer function as needed.
### Checklist:
- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.
/// | Windows | [`HBITMAP`](https://learn.microsoft.com/en-us/windows/win32/gdi/bitmaps), [`HICON`](https://learn.microsoft.com/en-us/windows/win32/menurc/icons), [`IWICBitmapSource`](https://learn.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmapsource) (including its subclasses declared by Windows Imaging Component) |
32
31
///
33
32
/// You do not generally need to add your own conformances to this protocol. If
34
33
/// you have an image in another format that needs to be attached to a test,
35
34
/// first convert it to an instance of one of the types above.
/// | Windows | [`HBITMAP`](https://learn.microsoft.com/en-us/windows/win32/gdi/bitmaps), [`HICON`](https://learn.microsoft.com/en-us/windows/win32/menurc/icons), [`IWICBitmapSource`](https://learn.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmapsource) (including its subclasses declared by Windows Imaging Component) |
38
37
///
39
38
/// The testing library uses the image format specified by `imageFormat`. Pass
40
39
/// `nil` to let the testing library decide which image format to use. If you
/// | Windows | [`HBITMAP`](https://learn.microsoft.com/en-us/windows/win32/gdi/bitmaps), [`HICON`](https://learn.microsoft.com/en-us/windows/win32/menurc/icons), [`IWICBitmapSource`](https://learn.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmapsource) (including its subclasses declared by Windows Imaging Component) |
78
78
///
79
79
/// The testing library uses the image format specified by `imageFormat`. Pass
80
80
/// `nil` to let the testing library decide which image format to use. If you
/// | Windows | [`HBITMAP`](https://learn.microsoft.com/en-us/windows/win32/gdi/bitmaps), [`HICON`](https://learn.microsoft.com/en-us/windows/win32/menurc/icons), [`IWICBitmapSource`](https://learn.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmapsource) (including its subclasses declared by Windows Imaging Component) |
31
31
///
32
32
/// You do not generally need to add your own conformances to this protocol. If
33
33
/// you have an image in another format that needs to be attached to a test,
@@ -93,26 +93,27 @@ public protocol _AttachableByAddressAsIWICBitmapSource {
93
93
}
94
94
95
95
/// A protocol describing images that can be converted to instances of
/// | Windows | [`HBITMAP`](https://learn.microsoft.com/en-us/windows/win32/gdi/bitmaps), [`HICON`](https://learn.microsoft.com/en-us/windows/win32/menurc/icons), [`IWICBitmapSource`](https://learn.microsoft.com/en-us/windows/win32/api/wincodec/nn-wincodec-iwicbitmapsource) (including its subclasses declared by Windows Imaging Component) |
110
111
///
111
112
/// You do not generally need to add your own conformances to this protocol. If
112
113
/// you have an image in another format that needs to be attached to a test,
113
114
/// first convert it to an instance of one of the types above.
0 commit comments