Skip to content

Commit

Permalink
6829250: Reg test: java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest…
Browse files Browse the repository at this point in the history
….java fails in Windows

Reviewed-by: phh
Backport-of: f56396f1689ea7e13dea78dcb1d14dcce94da898
  • Loading branch information
caojoshua authored and Paul Hohensee committed Dec 5, 2022
1 parent 4388fa8 commit a983a00
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions jdk/test/java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -50,7 +50,6 @@ public static void main(String[] args)
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gds = ge.getScreenDevices();
for (GraphicsDevice gd : gds) {

GraphicsConfiguration gc = gd.getDefaultConfiguration();
Rectangle gcBounds = gc.getBounds();
Insets gcInsets = Toolkit.getDefaultToolkit().getScreenInsets(gc);
Expand Down Expand Up @@ -99,7 +98,13 @@ public static void main(String[] args)
gcBounds.y + gcBounds.height - fBounds.y - fBounds.height,
gcBounds.x + gcBounds.width - fBounds.x - fBounds.width);

if (!expected.equals(gcInsets))
// On Windows 10 and up system allows undecorated maximized windows
// to be placed over the taskbar so calculated insets might
// be smaller than reported ones depending on the taskbar position
if (gcInsets.top < expected.top
|| gcInsets.bottom < expected.bottom
|| gcInsets.left < expected.left
|| gcInsets.right < expected.right)
{
passed = false;
System.err.println("Wrong insets for GraphicsConfig: " + gc);
Expand Down

1 comment on commit a983a00

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.