}
use strict;
-use Test::More tests => 227;
+use Test::More tests => 235;
use OS2::Process;
sub SWP_flags ($) {
ok hWindowPos_set({behind => 3}, $k_hwnd), # HWND_TOP
'put kid to the front';
-is((hWindowPos $k_hwnd)->{behind}, 3, 'kis is at front');
+# After Alt-Tab a WS_TOPMOST, WS_DISABLED window of class 'AltTabWindow' exists
+my $top = (hWindowPos $k_hwnd)->{behind};
+ok(($top == 3 or WindowStyle($top) & 0x200000), # HWND_TOP, WS_TOPMOST
+ 'kid is at front');
+# is((hWindowPos $k_hwnd)->{behind}, 3, 'kid is at front');
-my ($enum_handle, $first_zorder);
+my ($enum_handle, $first_zorder, $first_non_TOPMOST);
{ my $force_PM = OS2::localMorphPM->new(0);
ok $force_PM, 'morphed to PM locally again';
$enum_handle = BeginEnumWindows 1; # HWND_DESKTOP
ok $enum_handle, 'start enumeration';
- $first_zorder = GetNextWindow $enum_handle;
+ $first_non_TOPMOST = $first_zorder = GetNextWindow $enum_handle;
ok $first_zorder, 'GetNextWindow works';
+ my $f = WindowStyle $first_non_TOPMOST;
+ ok $f, 'WindowStyle works';
+ $f = WindowStyle($first_non_TOPMOST = GetNextWindow $enum_handle)
+ while $f & 0x200000; # WS_TOPMOST
+ ok($first_non_TOPMOST, 'There is non-TOPMOST window');
+ ok(!(WindowStyle($first_non_TOPMOST) & 0x200000), 'Indeed non-TOPMOST');
ok EndEnumWindows($enum_handle), 'end enumeration';
}
-is ($first_zorder, $k_hwnd, 'kid is the first in z-order enumeration');
+is ($first_non_TOPMOST, $k_hwnd, 'kid is the first in z-order enumeration');
ok hWindowPos_set({behind => 4}, $k_hwnd), # HWND_BOTTOM
'put kid to the back';
# This does not work, the result is the handle of "Window List"
# is((hWindowPos $k_hwnd)->{behind}, 4, 'kis is at back');
-my (@list, $next);
+my (@list, $next, @list1);
{ my $force_PM = OS2::localMorphPM->new(0);
ok $force_PM, 'morphed to PM locally again';
$enum_handle = BeginEnumWindows 1; # HWND_DESKTOP
ok $enum_handle, 'start enumeration';
push @list, $next while $next = GetNextWindow $enum_handle;
+ @list1 = ChildWindows;
+ ok 1, 'embedded ChildWindows()';
ok EndEnumWindows($enum_handle), 'end enumeration';
+ is_deeply \@list, \@list1, 'Manual list same as by ChildWindows()';
# Apparently, the 'Desktop' window is still behind us;
# Note that this window is *not* what is returned by DesktopWindow
pop @list if WindowText($list[-1]) eq 'Desktop';
}
is ($list[-1], $k_hwnd, 'kid is the last in z-order enumeration');
# print "# kid=$k_hwnd in @list\n";
-@list = ChildWindows; # HWND_DESKTOP
+@list = ChildWindows;
+is_deeply \@list, \@list1, 'Other ChildWindows(), same result';
ok scalar @list, 'ChildWindows works';
is $list[-2], $k_hwnd, 'kid is the last but one in ChildWindows';
ok hWindowPos_set({behind => 3}, $k_hwnd), # HWND_TOP
'put kid to the front again';
-is((hWindowPos $k_hwnd)->{behind}, 3, 'kis is at front again');
+$top = (hWindowPos $k_hwnd)->{behind};
+ok(($top == 3 or WindowStyle($top) & 0x200000), # WS_TOPMOST
+ 'kid is at front again');
sleep 5 if $interactive_wait;
ok IsWindow($k_hwnd), 'IsWindow works';
ok IsWindowShowing $k_hwnd, 'kid is showing';
ok IsWindowVisible $k_hwnd, 'kid is flaged as visible';
ok IsWindowEnabled $k_hwnd, 'kid is flaged as enabled';
+ SKIP: {
+ skip 'if defaultVIO=MAXIMIZED, new windows are shifted, but maximize to UL corner', 1 unless $fl & 0x800;
+ ok hWindowPos_set({x => $ppos[0], y => $ppos[1]}, $k_hwnd), 'x,y-restore for de-minimization of MAXIMIZED';
+ }
@nkpos = WindowPos $k_hwnd;
is_deeply([@ppos[0..5]], [@nkpos[0..5]], 'position restored');
+
# Now the other way
ok hWindowPos_set( {flags => 0x400}, $k_hwnd), 'set to minimized';
ok !IsWindowShowing $k_hwnd, 'kid is not showing';
ok IsWindowShowing $k_hwnd, 'kid is showing';
ok IsWindowVisible $k_hwnd, 'kid is flaged as visible';
ok IsWindowEnabled $k_hwnd, 'kid is flaged as enabled';
+ SKIP: {
+ skip 'if defaultVIO=MAXIMIZED, new windows are shifted, but maximize to UL corner', 1 unless $fl & 0x800;
+ ok hWindowPos_set({x => $ppos[0], y => $ppos[1]}, $k_hwnd), 'x,y-restore for de-minimization of MAXIMIZED';
+ }
@nkpos = WindowPos $k_hwnd;
is_deeply([@ppos[0..5]], [@nkpos[0..5]], 'position restored');