View Javadoc
1   /*
2    * Copyright 2022 The OSHI Project Contributors
3    * SPDX-License-Identifier: MIT
4    */
5   package oshi.driver.windows;
6   
7   import static org.hamcrest.MatcherAssert.assertThat;
8   import static org.hamcrest.Matchers.greaterThanOrEqualTo;
9   
10  import java.util.List;
11  
12  import org.junit.jupiter.api.Test;
13  import org.junit.jupiter.api.condition.EnabledOnOs;
14  import org.junit.jupiter.api.condition.OS;
15  
16  import oshi.software.os.OSDesktopWindow;
17  
18  @EnabledOnOs(OS.WINDOWS)
19  class EnumWindowsTest {
20      @Test
21      void testQueryDesktopWindows() {
22          List<OSDesktopWindow> allWindows = EnumWindows.queryDesktopWindows(false);
23          List<OSDesktopWindow> visibleWindows = EnumWindows.queryDesktopWindows(true);
24          assertThat("All windows should be no smaller than visible windows", allWindows.size(),
25                  greaterThanOrEqualTo(visibleWindows.size()));
26      }
27  }