| 29 | } |
| 30 | |
| 31 | TEST_F(MultiContext_test, Test) |
| 32 | { |
| 33 | int success = glfwInit(); |
| 34 | |
| 35 | EXPECT_EQ(1, success); |
| 36 | |
| 37 | glfwSetErrorCallback(error); |
| 38 | |
| 39 | glfwWindowHint(GLFW_VISIBLE, false); |
| 40 | glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); |
| 41 | glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); |
| 42 | glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, false); // does not work for all opengl drivers |
| 43 | glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); |
| 44 | |
| 45 | GLFWwindow * window1 = glfwCreateWindow(320, 240, "", nullptr, nullptr); |
| 46 | |
| 47 | EXPECT_NE(nullptr, window1); |
| 48 | |
| 49 | glfwDefaultWindowHints(); |
| 50 | glfwWindowHint(GLFW_VISIBLE, false); |
| 51 | |
| 52 | GLFWwindow * window2 = glfwCreateWindow(320, 240, "", nullptr, nullptr); |
| 53 | |
| 54 | EXPECT_NE(nullptr, window2); |
| 55 | |
| 56 | glfwMakeContextCurrent(window1); |
| 57 | Binding::initialize(false); |
| 58 | |
| 59 | #ifdef SYSTEM_WINDOWS |
| 60 | EXPECT_EQ(Version(3, 2), ContextInfo::version()); |
| 61 | #elif defined(SYSTEM_DARWIN) |
| 62 | EXPECT_EQ(Version(4, 1), ContextInfo::version()); |
| 63 | EXPECT_EQ(nullptr, Binding::DispatchCompute.address()); |
| 64 | #else // Linux |
| 65 | EXPECT_EQ(Version(3, 2), ContextInfo::version()); |
| 66 | EXPECT_NE(nullptr, Binding::DispatchCompute.address()); |
| 67 | #endif |
| 68 | |
| 69 | glfwMakeContextCurrent(window2); |
| 70 | Binding::initialize(false); |
| 71 | |
| 72 | Binding::releaseCurrentContext(); |
| 73 | glfwMakeContextCurrent(window1); |
| 74 | Binding::releaseCurrentContext(); |
| 75 | |
| 76 | glfwTerminate(); |
| 77 | } |
nothing calls this directly
no test coverage detected