]> icculus.org git repositories - duncan/yast2-qt4.git/blob - testsuite/tests/vbox1.ui
clicking packages work! so the package selector is now
[duncan/yast2-qt4.git] / testsuite / tests / vbox1.ui
1
2 # ---------------------------------------------------------
3 #
4 #  Filename:    Vbox1.ui
5 #
6 #  Purpose:     test cases for ui test
7 #
8 #  Creator:     jd@suse.de
9 #
10 #  Maintainer:  jd@suse.de
11 #
12 #  Remarks:     Always the user interaction is removed:
13 #                   any answer = UserInput();
14 #               Furthermore the tested action is set into a loop
15 #
16 # ---------------------------------------------------------
17
18
19 // Example1 for VBox
20 //
21 // Syntax: VBox( [Id id, ] widget1, widget2, ... )
22 //
23 // A VBox is used to give the UI a hint about how to
24 // organize the dialog. All widgets listed inside the VBox 
25 // are laid out from top to bottom.
26 // 
27 // A VBox can have an Id. This Id will be added as a prefix 
28 // to all widget Ids within the VBox.
29 //
30 // This example shows a VBox which organizes 4 checkboxes
31 // above each other.
32 //
33
34
35 {
36
37     define Check( boolean CheckBoxTwoState )
38         ``{
39                return( ( is( CurrentMap, map ) == true ) &&
40                        ( size( CurrentMap ) == 4 ) &&
41                        ( select( CurrentMap, 0 ) == [`Id("cb1"), false] ) &&
42                        ( select( CurrentMap, 1 ) == [`Id("cb2"), CheckBoxTwoState] ) &&
43                        ( select( CurrentMap, 2 ) == [`Id("cb3"), false] ) &&
44                        ( select( CurrentMap, 3 ) == [`Id("cb4"), false] ) );
45            };
46
47
48 // the display function ShowDialog() is called without parameters
49     if( true )
50     {  
51         any ok = `HBox(`Stretch(), `Pushbutton(`Id("ok"), "OK"), `Stretch());
52     
53         integer loop = 0;
54         while( loop < 100 )
55         {
56             any dialog = OpenDialog( `VBox(
57               `VBox( 
58               `Checkbox(`Id("cb1"), "Option1"),
59               `Checkbox(`Id("cb2"), "Option2"),
60               `Checkbox(`Id("cb3"), "Option3"),
61               `Checkbox(`Id("cb4"), "Option4")
62               ),
63               ok
64              ));
65     
66             ShowDialog( );
67             any CurrentMap = QueryDialog( dialog );
68             CloseDialog( );
69     
70             if( Check( false ) == false ) return false;
71
72             loop = loop + 1;
73         }
74     }
75
76 // the display function ShowDialog() is called with the dialog parameter
77     if( true )
78     {  
79         any ok = `HBox(`Stretch(), `Pushbutton(`Id("ok"), "OK"), `Stretch());
80     
81         integer loop = 0;
82         while( loop < 100 )
83         {
84             any dialog = Dialog( `VBox(
85               `VBox( 
86               `Checkbox(`Id("cb1"), "Option1"),
87               `Checkbox(`Id("cb2"), "Option2"),
88               `Checkbox(`Id("cb3"), "Option3"),
89               `Checkbox(`Id("cb4"), "Option4")
90               ),
91               ok
92              ));
93     
94             ShowDialog( dialog );
95             any CurrentMap = QueryDialog( dialog );
96             CloseDialog( dialog );
97     
98             if( Check( false ) == false ) return false;
99
100             loop = loop + 1;
101         }
102     }
103
104 // the display function ShowDialog() is called with the dialog itself
105     if( true )
106     {  
107         any ok = `HBox(`Stretch(), `Pushbutton(`Id("ok"), "OK"), `Stretch());
108     
109         integer loop = 0;
110         while( loop < 100 )
111         {
112             ShowDialog( 
113                  Dialog( `VBox(
114                           `VBox( 
115                             `Checkbox(`Id("cb1"), "Option1"),
116                             `Checkbox(`Id("cb2"), "Option2", true),
117                             `Checkbox(`Id("cb3"), "Option3"),
118                             `Checkbox(`Id("cb4"), "Option4", false)
119                              ),
120                            ok
121                         )));
122             any CurrentMap = QueryDialog( );
123             CloseDialog( );
124     
125             if( Check( true ) == false ) return false;
126
127             loop = loop + 1;
128         }
129     }
130
131     return true;
132 }
133