@@ -24,7 +24,7 @@ def frame_scope(imgui_context, null_renderer):
24
24
def test_current_context (imgui_context ):
25
25
assert imgui_context is not None
26
26
assert imgui .get_current_context () is not None
27
- assert imgui_context == imgui .get_current_context ()
27
+ assert imgui_context is imgui .get_current_context ()
28
28
29
29
def test_style_access (imgui_context ):
30
30
styles = imgui .get_style ()
@@ -37,6 +37,29 @@ def test_style_access(imgui_context):
37
37
styles .window_padding = (2 , 4 )
38
38
assert styles .window_padding == (2 , 4 )
39
39
40
+ def test_set_current_context (imgui_context ):
41
+ assert imgui_context is not None
42
+ assert imgui .get_current_context () is not None
43
+ assert imgui_context is imgui .get_current_context ()
44
+
45
+ ctx2 = imgui .create_context ()
46
+ assert ctx2 is imgui .get_current_context ()
47
+ assert imgui_context is not imgui .get_current_context ()
48
+ c = imgui .get_current_context ()
49
+ assert c is not None
50
+ assert imgui_context .context is not c .context
51
+ imgui .set_current_context (imgui_context )
52
+ assert imgui_context is imgui .get_current_context ()
53
+ c = imgui .get_current_context ()
54
+ assert c is not None
55
+ assert imgui_context .context is c .context
56
+ imgui .set_current_context (ctx2 )
57
+ imgui .destroy_context (None )
58
+ assert imgui .get_current_context () is None
59
+ imgui .set_current_context (imgui_context )
60
+ assert imgui_context is imgui .get_current_context ()
61
+
62
+
40
63
def test_begin_base_window (frame_scope ):
41
64
visible , _ = imgui .begin ("Window" )
42
65
imgui .end ()
0 commit comments