2 Test that we are able to find out how many children NSWindow has
7 from lldbsuite
.test
.decorators
import *
8 from lldbsuite
.test
.lldbtest
import *
9 from lldbsuite
.test
import lldbutil
12 # TODO: The Jenkins testers on OS X fail running this test because they don't
13 # have access to WindowServer so NSWindow doesn't work. We should disable this
14 # test if WindowServer isn't available.
15 # Note: Simply applying the @skipIf decorator here confuses the test harness
16 # and gives a spurious failure.
17 class Rdar12408181TestCase(TestBase
):
19 # Call super's setUp().
21 # We'll use the test method name as the exe_name.
22 self
.exe_name
= self
.testMethodName
23 # Find the line number to break inside main().
24 self
.main_source
= "main.m"
25 self
.line
= line_number(self
.main_source
, "// Set breakpoint here.")
27 def test_nswindow_count(self
):
28 """Test that we are able to find out how many children NSWindow has."""
30 self
.skipTest("Skipping this test due to timeout flakiness")
32 d
= {"EXE": self
.exe_name
}
33 self
.build(dictionary
=d
)
34 self
.setTearDownCleanup(dictionary
=d
)
36 exe
= self
.getBuildArtifact(self
.exe_name
)
37 self
.runCmd("file " + exe
, CURRENT_EXECUTABLE_SET
)
39 lldbutil
.run_break_set_by_file_and_line(
40 self
, self
.main_source
, self
.line
, num_expected_locations
=1, loc_exact
=True
43 self
.runCmd("run", RUN_SUCCEEDED
)
46 .EvaluateExpression("(void*)_CGSDefaultConnection()")
50 window
= self
.frame().FindVariable("window")
51 window_dynamic
= window
.GetDynamicValue(lldb
.eDynamicCanRunTarget
)
53 window
.GetNumChildren(), 1, "NSWindow (static) only has 1 child!"
56 window_dynamic
.GetNumChildren(),
58 "NSWindow (dynamic) only has 1 child!",
61 window
.GetChildAtIndex(0).IsValid(),
62 "NSWindow (static) has an invalid child",
65 window_dynamic
.GetChildAtIndex(0).IsValid(),
66 "NSWindow (dynamic) has an invalid child",
69 self
.skipTest("no WindowServer connection")