File: lib-i3test-test.html

package info (click to toggle)
i3-wm 4.25-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 7,676 kB
  • sloc: ansic: 30,144; perl: 19,136; sh: 70; makefile: 9
file content (107 lines) | stat: -rw-r--r-- 4,650 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<html><head><title>i3test::Test</title>
</head>
<body>

        <div id="main">
            <a href="/"><h1 id="title">i3 - improved tiling WM</h1></a>
			<ul id="nav">
				<li><a style="border-bottom: 2px solid #fff" href="/docs">Docs</a></li>
				<li><a href="/screenshots">Screens</a></li>
				<li><a href="https://www.github.com/i3/i3/discussions">Get Help</a></li>
				<li><a href="/contact">Contact</a></li>
				<li><a href="https://bugs.i3wm.org/">Bugs</a></li>
			</ul>
	<br style="clear: both">
<div id="content" class="pod">
<h1>i3 Perl documentation</h1>

<a name='___top' class='dummyTopAnchor' ></a>

<div class='indexgroup'>
<ul   class='indexList indexList1'>
  <li class='indexItem indexItem1'><a href='#NAME'>NAME</a>
  <li class='indexItem indexItem1'><a href='#SYNOPSIS'>SYNOPSIS</a>
  <li class='indexItem indexItem1'><a href='#DESCRIPTION'>DESCRIPTION</a>
  <li class='indexItem indexItem1'><a href='#EXPORT'>EXPORT</a>
  <ul   class='indexList indexList2'>
    <li class='indexItem indexItem2'><a href='#is_num_children(%24workspace%2C_%24expected%2C_%24test_name)'>is_num_children($workspace, $expected, $test_name)</a>
    <li class='indexItem indexItem2'><a href='#is_num_fullscreen(%24workspace%2C_%24expected%2C_%24test_name)'>is_num_fullscreen($workspace, $expected, $test_name)</a>
    <li class='indexItem indexItem2'><a href='#cmp_float(%24a%2C_%24b)'>cmp_float($a, $b)</a>
    <li class='indexItem indexItem2'><a href='#does_i3_live'>does_i3_live</a>
  </ul>
  <li class='indexItem indexItem1'><a href='#AUTHOR'>AUTHOR</a>
</ul>
</div>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="NAME"
>NAME</a></h1>

<p>i3test::Test - Additional test instructions for use in i3 testcases</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="SYNOPSIS"
>SYNOPSIS</a></h1>
<pre><tt>  use i3test;

  my $ws = fresh_workspace;
  is_num_children($ws, 0, &#39;no containers on this workspace yet&#39;);
  cmd &#39;open&#39;;
  is_num_children($ws, 1, &#39;one container after &#34;open&#34;&#39;);

  done_testing;</tt></pre>
<h1><a class='u' href='#___top' title='click to go to top of document'
name="DESCRIPTION"
>DESCRIPTION</a></h1>

<p>This module provides convenience methods for i3 testcases. If you notice that a certain pattern is present in 5 or more test cases, it should most likely be moved into this module.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="EXPORT"
>EXPORT</a></h1>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="is_num_children($workspace,_$expected,_$test_name)"
>is_num_children($workspace, $expected, $test_name)</a></h2>

<p>Gets the number of children on the given workspace and verifies that they match the expected amount of children.</p>
<pre><tt>  is_num_children(&#39;1&#39;, 0, &#39;no containers on workspace 1 at startup&#39;);</tt></pre>
<h2><a class='u' href='#___top' title='click to go to top of document'
name="is_num_fullscreen($workspace,_$expected,_$test_name)"
>is_num_fullscreen($workspace, $expected, $test_name)</a></h2>

<p>Gets the number of fullscreen containers on the given workspace and verifies that they match the expected amount.</p>
<pre><tt>  is_num_fullscreen(&#39;1&#39;, 0, &#39;no fullscreen containers on workspace 1&#39;);</tt></pre>
<h2><a class='u' href='#___top' title='click to go to top of document'
name="cmp_float($a,_$b)"
>cmp_float($a, $b)</a></h2>

<p>Compares floating point numbers <code>$a</code> and <code>$b</code> and returns true if they differ less then 1e-6.</p>
<pre><tt>  $tmp = fresh_workspace;

  open_window for (1..4);

  cmd &#39;resize grow width 10 px or 25 ppt&#39;;

  ($nodes, $focus) = get_ws_content($tmp);
  ok(cmp_float($nodes-&#62;[0]-&#62;{percent}, 0.166666666666667), &#39;first window got 16%&#39;);
  ok(cmp_float($nodes-&#62;[1]-&#62;{percent}, 0.166666666666667), &#39;second window got 16%&#39;);
  ok(cmp_float($nodes-&#62;[2]-&#62;{percent}, 0.166666666666667), &#39;third window got 16%&#39;);
  ok(cmp_float($nodes-&#62;[3]-&#62;{percent}, 0.50), &#39;fourth window got 50%&#39;);</tt></pre>
<h2><a class='u' href='#___top' title='click to go to top of document'
name="does_i3_live"
>does_i3_live</a></h2>

<p>Returns true if the layout tree can still be received from i3.</p>
<pre><tt>  # i3 used to crash on invalid commands in revision X
  cmd &#39;invalid command&#39;;
  does_i3_live;</tt></pre>
<h1><a class='u' href='#___top' title='click to go to top of document'
name="AUTHOR"
>AUTHOR</a></h1>

<p>Michael Stapelberg &#60;michael@i3wm.org&#62;</p>

<!-- end doc -->

</body></html>