-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ICOMTest2 for more thorough Support module tests.
- Loading branch information
1 parent
de174bb
commit 9233a8c
Showing
10 changed files
with
145 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
|
||
#include "SWRT/windows/unknwn.h" | ||
|
||
// ICOMTest2 | ||
typedef struct SWRT_ICOMTest2 { | ||
struct SWRT_ICOMTest2_VirtualTable* VirtualTable; | ||
} SWRT_ICOMTest2; | ||
|
||
struct SWRT_ICOMTest2_VirtualTable { | ||
SWRT_HResult (__stdcall *QueryInterface)(SWRT_ICOMTest2* _this, SWRT_Guid* riid, void** ppvObject); | ||
uint32_t (__stdcall *AddRef)(SWRT_ICOMTest2* _this); | ||
uint32_t (__stdcall *Release)(SWRT_ICOMTest2* _this); | ||
SWRT_HResult (__stdcall *COMTest2)(SWRT_ICOMTest2* _this); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
module TestsABI { | ||
header "SWRT_ICOMTest.h" | ||
header "SWRT_ICOMTest2.h" | ||
header "SWRT_IWinRTTest.h" | ||
export * | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import COM | ||
|
||
internal typealias ICOMTest2 = any ICOMTest2Protocol | ||
internal protocol ICOMTest2Protocol: IUnknownProtocol { | ||
func comTest2() throws | ||
} | ||
|
||
import TestsABI | ||
|
||
internal enum ICOMTest2Binding: COMTwoWayBinding { | ||
public typealias SwiftObject = ICOMTest2 | ||
public typealias ABIStruct = TestsABI.SWRT_ICOMTest2 | ||
|
||
public static let interfaceID = COMInterfaceID(0x5CF9DEB3, 0xD7C6, 0x42A9, 0x85B3, 0x61D8B68A7B2B) | ||
public static var virtualTablePointer: UnsafeRawPointer { .init(withUnsafePointer(to: &virtualTable) { $0 }) } | ||
|
||
public static func _wrap(_ reference: consuming ABIReference) -> SwiftObject { | ||
Import(_wrapping: reference) | ||
} | ||
|
||
public static func toCOM(_ object: SwiftObject) throws -> ABIReference { | ||
try Import.toCOM(object) | ||
} | ||
|
||
private final class Import: COMImport<ICOMTest2Binding>, ICOMTest2Protocol { | ||
public func comTest2() throws { try _interop.comTest2() } | ||
} | ||
|
||
private static var virtualTable: TestsABI.SWRT_ICOMTest2_VirtualTable = .init( | ||
QueryInterface: { IUnknownVirtualTable.QueryInterface($0, $1, $2) }, | ||
AddRef: { IUnknownVirtualTable.AddRef($0) }, | ||
Release: { IUnknownVirtualTable.Release($0) }, | ||
COMTest2: { this in _implement(this) { try $0.comTest2() } }) | ||
} | ||
|
||
public func uuidof(_: TestsABI.SWRT_ICOMTest2.Type) -> COMInterfaceID { | ||
ICOMTest2Binding.interfaceID | ||
} | ||
|
||
extension COMInterop where ABIStruct == TestsABI.SWRT_ICOMTest2 { | ||
public func comTest2() throws { | ||
try COMError.fromABI(this.pointee.VirtualTable.pointee.COMTest2(this)) | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import XCTest | ||
import WindowsRuntime | ||
|
||
internal class WinRTTestCase: XCTestCase { | ||
// Due to caching in the projections, we can't deinitialize the WinRT runtime after each test | ||
private static var winRTInitialization: WinRTInitialization? = nil | ||
|
||
override func setUpWithError() throws { | ||
if Self.winRTInitialization == nil { | ||
Self.winRTInitialization = try WinRTInitialization(multithreaded: false) | ||
} | ||
|
||
try super.setUpWithError() | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.