class glXCreateContextAttribARB_test : public ::testing::Test {
public:
virtual void SetUp();
+ virtual void TearDown();
/**
* Replace the existing screen with a direct-rendering screen
void use_direct_rendering_screen();
mock_XDisplay *dpy;
+ GLXContext ctx;
struct glx_config fbc;
};
memset(&this->fbc, 0, sizeof(this->fbc));
this->fbc.fbconfigID = 0xbeefcafe;
+
+ this->ctx = NULL;
+}
+
+void
+glXCreateContextAttribARB_test::TearDown()
+{
+ if (ctx)
+ delete (fake_glx_context *)ctx;
+
+ delete (fake_glx_screen *)psc;
+
+ delete this->dpy;
}
void
psc->scr,
psc->serverGLXexts);
- delete psc;
+ delete (fake_glx_screen *)psc;
psc = direct_psc;
}
TEST_F(glXCreateContextAttribARB_test, NULL_screen_returns_None)
{
- delete psc;
+ delete (fake_glx_screen *)psc;
psc = NULL;
GLXContext ctx =
/*@{*/
TEST_F(glXCreateContextAttribARB_test, does_send_protocol)
{
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
False, NULL);
EXPECT_TRUE(CreateContextAttribsARB_was_sent);
TEST_F(glXCreateContextAttribARB_test, sent_correct_context)
{
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
False, NULL);
-
EXPECT_EQ(99u, req.context);
}
TEST_F(glXCreateContextAttribARB_test, sent_correct_fbconfig)
{
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
False, NULL);
EXPECT_EQ(0xbeefcafe, req.fbconfig);
ASSERT_NE((GLXContext) 0, share);
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, share,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, share,
False, NULL);
struct glx_context *glx_ctx = (struct glx_context *) share;
EXPECT_EQ(glx_ctx->xid, req.share_list);
+
+ delete (fake_glx_context *)share;
}
TEST_F(glXCreateContextAttribARB_test, sent_correct_is_direct_for_indirect_screen_and_direct_set_to_true)
{
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
True, NULL);
EXPECT_FALSE(req.is_direct);
TEST_F(glXCreateContextAttribARB_test, sent_correct_is_direct_for_indirect_screen_and_direct_set_to_false)
{
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
False, NULL);
EXPECT_FALSE(req.is_direct);
{
this->use_direct_rendering_screen();
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
True, NULL);
EXPECT_TRUE(req.is_direct);
{
this->use_direct_rendering_screen();
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
False, NULL);
EXPECT_FALSE(req.is_direct);
this->fbc.screen = 7;
psc->scr = 7;
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
False, NULL);
EXPECT_EQ(7u, req.screen);
0, 0
};
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
False, attribs);
EXPECT_EQ(4u, req.num_attribs);
0,
};
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
False, attribs);
EXPECT_EQ(0u, req.num_attribs);
TEST_F(glXCreateContextAttribARB_test, sent_correct_num_attribs_NULL_list_pointer)
{
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
False, NULL);
EXPECT_EQ(0u, req.num_attribs);
0
};
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
False, attribs);
for (unsigned i = 0; i < 6; i++) {
/*@{*/
TEST_F(glXCreateContextAttribARB_test, correct_context)
{
- GLXContext ctx =
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
False, NULL);
/* Since the server did not return an error, the GLXContext should not be
TEST_F(glXCreateContextAttribARB_test, correct_context_xid)
{
- GLXContext ctx =
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
False, NULL);
/* Since the server did not return an error, the GLXContext should not be
struct glx_context *share = (struct glx_context *) first;
struct glx_context *ctx = (struct glx_context *) second;
EXPECT_EQ(share->xid, ctx->share_xid);
+
+ delete (fake_glx_context *)first;
+ delete (fake_glx_context *)second;
}
TEST_F(glXCreateContextAttribARB_test, correct_context_isDirect_for_indirect_screen_and_direct_set_to_true)
{
- GLXContext ctx =
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
True, NULL);
ASSERT_NE((GLXContext) 0, ctx);
TEST_F(glXCreateContextAttribARB_test, correct_context_isDirect_for_indirect_screen_and_direct_set_to_false)
{
- GLXContext ctx =
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
False, NULL);
ASSERT_NE((GLXContext) 0, ctx);
{
this->use_direct_rendering_screen();
- GLXContext ctx =
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
True, NULL);
ASSERT_NE((GLXContext) 0, ctx);
{
this->use_direct_rendering_screen();
- GLXContext ctx =
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
False, NULL);
ASSERT_NE((GLXContext) 0, ctx);
TEST_F(glXCreateContextAttribARB_test, correct_indirect_context_client_state_private)
{
- GLXContext ctx =
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
False, NULL);
ASSERT_NE((GLXContext) 0, ctx);
TEST_F(glXCreateContextAttribARB_test, correct_indirect_context_config)
{
- GLXContext ctx =
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
False, NULL);
ASSERT_NE((GLXContext) 0, ctx);
this->fbc.screen = 7;
psc->scr = 7;
- GLXContext ctx =
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
False, NULL);
ASSERT_NE((GLXContext) 0, ctx);
TEST_F(glXCreateContextAttribARB_test, correct_context_screen_pointer)
{
- GLXContext ctx =
- glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
+ ctx = glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0,
False, NULL);
ASSERT_NE((GLXContext) 0, ctx);