]> icculus.org git repositories - duncan/yast2-qt4.git/blob - testsuite/tests/vbox2.ui
clicking packages work! so the package selector is now
[duncan/yast2-qt4.git] / testsuite / tests / vbox2.ui
1
2 # ---------------------------------------------------------
3 #
4 #  Filename:    Vbox2.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 // Example 2 for VBox
19 //
20 // Syntax: VBox( [Id id, ] widget1, widget2, ... )
21 //
22 // A VBox is used to give the UI a hint about how to
23 // organize the dialog. All widgets listed inside the VBox 
24 // are laid out from top to bottom.
25 // 
26 // A VBox can have an Id. This Id will be added as a prefix 
27 // to all widget Ids within the VBox.
28 //
29 // This example shows two VBox'es. The first VBox has an Id
30 // set. The Id's of the checkboxes in this VBox will be
31 // prefixed with the Id of the VBox.
32 //
33
34
35 {  
36     define Check( )
37         `` {
38                return( ( ( is( CurrentMap, map ) == true ) &&
39                        ( size( CurrentMap ) == 5 ) &&
40                        ( select( CurrentMap, 0 ) == [`Id("vb", "cb1", "cb2", "cb3", "cb4"), false] ) &&
41                        ( select( CurrentMap, 1 ) == [`Id("cb1"), false] ) &&
42                        ( select( CurrentMap, 2 ) == [`Id("cb2"), false] ) &&
43                        ( select( CurrentMap, 3 ) == [`Id("cb3"), false] ) &&
44                        ( select( CurrentMap, 4 ) == [`Id("cb4"), false] )));
45            };
46
47
48     any ok = `HBox(`Stretch(), `Pushbutton(`Id("ok"), "OK"), `Stretch());
49
50     boolean CheckState = true;
51     integer loop = 0;
52     while( loop < 100 )
53     {
54         any dialog = Dialog( `VBox( 
55           `VBox( `Id("vb"),
56           `Checkbox(`Id("cb1"), "Option1"),
57           `Checkbox(`Id("cb2"), "Option2"),
58           `Checkbox(`Id("cb3"), "Option3"),
59           `Checkbox(`Id("cb4"), "Option4")
60           ),
61           `VBox( 
62           `Checkbox(`Id("cb1"), "Option1"),
63           `Checkbox(`Id("cb2"), "Option2"),
64           `Checkbox(`Id("cb3"), "Option3"),
65           `Checkbox(`Id("cb4"), "Option4")
66           ),
67           ok
68          ));
69     
70         ShowDialog();
71         any CurrentMap = QueryDialog( dialog );
72         CloseDialog( dialog );
73
74         CheckState = Check( );
75         if( CheckState == false ) return CheckState;
76
77         loop = loop + 1;
78     }
79     
80     return CheckState;
81 }