Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions source/tests/glbinding-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ set(sources
RingBuffer_test.cpp
SharedBitfield_test.cpp
Boolean_compilation_test.cpp
MultiContext_test.cpp
MultiThreading_test.cpp

# regession tests
Regression_test_82.cpp
Expand Down
17 changes: 11 additions & 6 deletions source/tests/glbinding-test/MultiContext_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
#include <GLFW/glfw3.h>

#include <glbinding/AbstractFunction.h>
#include <glbinding/Meta.h>
#include <glbinding/ContextInfo.h>
#include <glbinding/Version.h>
#include <glbinding/Binding.h>
#include <glbinding/glbinding.h>
#include <glbinding-aux/ContextInfo.h>

#include <glbinding/gl/gl.h>

using namespace gl;
using namespace glbinding;
using namespace aux;

class MultiContext_test : public testing::Test
{
Expand Down Expand Up @@ -54,7 +55,9 @@ TEST_F(MultiContext_test, Test)
EXPECT_NE(nullptr, window2);

glfwMakeContextCurrent(window1);
Binding::initialize(false);
glbinding::initialize(0, [](const char * name) {
return glfwGetProcAddress(name);
});

#ifdef SYSTEM_WINDOWS
EXPECT_EQ(Version(3, 2), ContextInfo::version());
Expand All @@ -67,11 +70,13 @@ TEST_F(MultiContext_test, Test)
#endif

glfwMakeContextCurrent(window2);
Binding::initialize(false);
glbinding::initialize(1, [](const char * name) {
return glfwGetProcAddress(name);
});

Binding::releaseCurrentContext();
Binding::releaseContext(1);
glfwMakeContextCurrent(window1);
Binding::releaseCurrentContext();
Binding::releaseContext(2);

glfwTerminate();
}
11 changes: 7 additions & 4 deletions source/tests/glbinding-test/MultiThreading_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
#include <GLFW/glfw3.h>

#include <glbinding/AbstractFunction.h>
#include <glbinding/Meta.h>
#include <glbinding/ContextInfo.h>
#include <glbinding/Version.h>
#include <glbinding/Binding.h>
#include <glbinding/glbinding.h>

#include <glbinding/gl/gl.h>

Expand Down Expand Up @@ -60,7 +59,9 @@ TEST_F(MultiThreading_test, Test)
std::thread t1([window1]()
{
glfwMakeContextCurrent(window1);
Binding::initialize(false);
glbinding::initialize(0, [](const char * name) {
return glfwGetProcAddress(name);
});

std::this_thread::sleep_for(std::chrono::milliseconds(5));

Expand All @@ -82,7 +83,9 @@ TEST_F(MultiThreading_test, Test)
std::thread t2([window2]()
{
glfwMakeContextCurrent(window2);
Binding::initialize(false);
glbinding::initialize(1, [](const char * name) {
return glfwGetProcAddress(name);
});

std::this_thread::sleep_for(std::chrono::milliseconds(4));

Expand Down