Fix segfault setting MenuFace pixmap style for menus.
[fvwm.git] / tests / purify / windowshade.pl
blob91cc27d1dba5502dd9a3f0f14f3da00bbc99976f
1 #!/usr/bin/perl -w
3 # Modification History
5 # Created on 01/12/03 by Dan Espen (dane):
7 # This test script is designed to be driven with FvwmCommandS:
8 # All the functionality related to windowshading is tested,
9 # based on my reading of the man page.
11 my $W1='window1';
12 my $W2='window2';
13 # xterm is chosen because it doesn't like being resized by pixel
14 my $CMD1="xterm -geometry 10x5+0+0 -T $W1 -n $W1 -e sleep 1000";
15 # xv is OK being resized to almost any size
16 # Note that some copies of xv put <unregistered> after the name
17 # so wildcards are used the the commands that match the window name.
18 my $CMD2="xv -geometry 400x400+200+0 -name $W2";
20 # Just in case, set default conditions:
21 &Reset();
23 # Create some windows to windowshade:
24 my $child1 = fork;
25 if ($child1 == 0) {
26 exec $CMD1;
27 # Never gets here
28 exit 0;
30 my $child2 = fork;
31 if ($child2 == 0) {
32 exec $CMD2;
33 # Never gets here
34 exit 0;
36 sleep 1; # give windows time to appear
38 if ( "$ARGV[0]" ne "debug" ) {
39 &ShadeDir("",""); # defaults to titlebar direction
40 &ShadeDir("West","W");
42 &ShadeDir("South","S");
43 &ShadeDir("East","E");
44 &ShadeDir("North","N");
46 &ShadeDir("NorthEast","NE");
47 &ShadeDir("SouthEast","SE");
48 &ShadeDir("NorthWest","NW");
49 &ShadeDir("SouthWest","SW");
51 &SetStyle("TitleAtBottom");
52 &ShadeDir("South","S");
53 &ShadeDir("East","E");
54 &ShadeDir("North","N");
56 &SetStyle("TitleAtRight");
57 # Just go for the default:
58 &ShadeDir("","");
60 &SetStyle("TitleAtLeft");
61 # Just go for the default:
62 &ShadeDir("","");
64 &SetStyle("NoTitle");
65 &ShadeDir("",""); # This goes up
66 &ShadeDir("West","W");
67 &ShadeDir("South","S");
68 &ShadeDir("East","E");
69 &ShadeDir("North","N");
71 # Restore normality:
72 &SetStyle("TitleAtTop,Title");
73 &ShadeDir("South","S","stay");
74 &ShadeDir("ShadeAgain North","ShadeAgain N","stay");
75 &ShadeDir("ShadeAgain East","ShadeAgain E","stay");
76 &ShadeDir("ShadeAgain West","ShadeAgain W");
78 # Now some animation:
79 &SetStyle("WindowShadeSteps 1p");
80 &ShadeDir("South","S");
81 &ShadeDir("North","N");
82 &ShadeDir("East","E");
83 &ShadeDir("West","W");
84 &SetStyle("WindowShadeSteps 0");
86 print "WindowShadeShrinks\n";
87 &SetStyle("WindowShadeSteps 2p"); # Need some steps to see anything
88 &SetStyle("WindowShadeShrinks");
89 &ShadeDir("South","S");
90 &ShadeDir("North","N");
91 &ShadeDir("East","E");
92 &ShadeDir("West","W");
94 # I just kept moving this down as I added tests...
95 } else {
96 print "Debug switch set, bypassing some tests\n";
99 print "WindowBusy/AlwaysLazy/Lazy\n";
100 &SetStyle("WindowShadeSteps 10"); # Need some steps to see anything
101 &SetStyle("WindowShadeBusy");
102 &ShadeDir("South","S");
103 &ShadeDir("North","NW");
104 &SetStyle("WindowShadeAlwaysLazy");
105 &ShadeDir("South","S");
106 &ShadeDir("North","NW");
107 &SetStyle("WindowShadeLazy");
108 &ShadeDir("South","S");
109 &ShadeDir("North","NW");
111 &Reset();
113 print "Close both windows\n";
114 `FvwmCommand "Next ($W1*) Close"`;
115 `FvwmCommand "Next ($W2*) Close"`;
116 print "Done\n";
117 exit 0;
119 # When I wrote this I used fork because I thought I might
120 # have to resort to killing the windows.
121 # This would do the job:
122 #kill (9, $child2,$child1);
124 # Subroutines:
126 # Set styles, both windows:
127 sub SetStyle {
128 my ($style)=@_;
129 print "Style set to $style\n";
130 `FvwmCommand "Style $W1* $style"`;
131 `FvwmCommand "Style $W2* $style"`;
134 # Shade both windows, pause, then unshade
135 sub ShadeDir {
136 my ($dir,$dirshort,$stay)=@_;
137 print "Shade $dir both windows\n";
138 `FvwmCommand "Next ($W1*) WindowShade $dir"`;
139 `FvwmCommand "Next ($W2*) WindowShade $dirshort"`;
140 sleep 1;
141 if ( $#_ > 2 ) {
142 if ( "$stay" ne "stay") {
143 &unShade();
148 # Unshade both windows:
149 sub unShade {
150 print "UnShade both windows\n";
151 `FvwmCommand "Next ($W1*) WindowShade"`;
152 `FvwmCommand "Next ($W2*) WindowShade"`;
153 sleep 1;
156 # Reset Styles back to "starting condition":
157 sub Reset {
158 &SetStyle("TitleAtTop,Title,BorderWidth 6,HandleWidth 6");
159 &SetStyle("WindowShadeSteps 0,WindowShadeScrolls");
160 &SetStyle("WindowShadeLazy");