

def test_context_share_texture(self):
    w1 = window.Window(200, 200)
    try:
        w1.switch_to()
        textures = c_uint()
        glGenTextures(1, byref(textures))
        texture = textures.value
        glBindTexture(GL_TEXTURE_2D, texture)
        data = (c_ubyte * 4)()
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, data)
        self.assertTrue(glIsTexture(texture))
    except:
        w1.close()
        raise
    w2 = window.Window(200, 200)
    try:
        w2.switch_to()
        self.assertTrue(glIsTexture(texture))
        glDeleteTextures(1, byref(textures))
        self.assertTrue((not glIsTexture(texture)))
        w1.switch_to()
        self.assertTrue((not glIsTexture(texture)))
    finally:
        w1.close()
        w2.close()

dataset/ETHPy150Open ardekantur/pyglet/tests/window/CONTEXT_SHARE.py CONTEXT_SHARE.test_context_share_texture/original