| 90 | |
| 91 | template <ECGPUBackend backend> |
| 92 | void SwapChainCreation<backend>::test_all() |
| 93 | { |
| 94 | #if defined(_WIN32) || defined(_WIN64) |
| 95 | SUBCASE("CreateFromHWND") |
| 96 | { |
| 97 | auto surface = cgpu_surface_from_hwnd(device, hwnd); |
| 98 | |
| 99 | EXPECT_NE(surface, CGPU_NULLPTR); |
| 100 | EXPECT_NE(surface, nullptr); |
| 101 | |
| 102 | auto swapchain = CreateSwapChainWithSurface(surface); |
| 103 | |
| 104 | EXPECT_NE(swapchain, CGPU_NULLPTR); |
| 105 | EXPECT_NE(swapchain, nullptr); |
| 106 | |
| 107 | cgpu_free_swapchain(swapchain); |
| 108 | cgpu_free_surface(device, surface); |
| 109 | } |
| 110 | #elif defined(__APPLE__) |
| 111 | #define BACK_BUFFER_WIDTH 1280 |
| 112 | #define BACK_BUFFER_HEIGHT 720 |
| 113 | |
| 114 | SUBCASE("CreateFromNSView") |
| 115 | { |
| 116 | auto ns_view = (struct NSView*)nswindow_get_content_view(nswin); |
| 117 | auto surface = cgpu_surface_from_ns_view(device, (CGPUNSView*)ns_view); |
| 118 | |
| 119 | EXPECT_NE(surface, CGPU_NULLPTR); |
| 120 | EXPECT_NE(surface, nullptr); |
| 121 | |
| 122 | auto swapchain = CreateSwapChainWithSurface(surface); |
| 123 | |
| 124 | EXPECT_NE(swapchain, CGPU_NULLPTR); |
| 125 | EXPECT_NE(swapchain, nullptr); |
| 126 | |
| 127 | cgpu_free_swapchain(swapchain); |
| 128 | cgpu_free_surface(device, surface); |
| 129 | } |
| 130 | #endif |
| 131 | } |
| 132 | |
| 133 | #if defined(_WIN32) || defined(_WIN64) |
| 134 | LRESULT CALLBACK WindowProcedure(HWND window, UINT msg, WPARAM wp, LPARAM lp) |
nothing calls this directly
no test coverage detected