// Path: src/cn/com/jautoitx/Win.java
// public static enum WinState {
// 	/* Window exists */
// 	EXISTS(WIN_STATE_EXISTS),
// 
// 	/* Window is visible */
// 	VISIBLE(WIN_STATE_VISIBLE),
// 
// 	/* Windows is enabled */
// 	ENABLED(WIN_STATE_ENABLED),
// 
// 	/* Window is active */
// 	ACTIVE(WIN_STATE_ACTIVE),
// 
// 	/* Window is minimized */
// 	MINIMIZED(WIN_STATE_MINIMIZED),
// 
// 	/* Windows is maximized */
// 	MAXIMIZED(WIN_STATE_MAXIMIZED);
// 
// 	private final int state;
// 
// 	private WinState(final int state) {
// 		this.state = state;
// 	}
// 
// 	public int getState() {
// 		return state;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		switch (this) {
// 		case EXISTS:
// 			return "exists";
// 		case VISIBLE:
// 			return "visible";
// 		case ENABLED:
// 			return "enabled";
// 		case ACTIVE:
// 			return "active";
// 		case MINIMIZED:
// 			return "minimized";
// 		case MAXIMIZED:
// 			return "maximized";
// 		default:
// 			return "Unknown state";
// 		}
// 	}
// 
// 	public static boolean isExists(final int state) {
// 		return (state & WIN_STATE_EXISTS) != 0;
// 	}
// 
// 	public static boolean isVisible(final int state) {
// 		return (state & WIN_STATE_VISIBLE) != 0;
// 	}
// 
// 	public static boolean isEnabled(final int state) {
// 		return (state & WIN_STATE_ENABLED) != 0;
// 	}
// 
// 	public static boolean isActive(final int state) {
// 		return (state & WIN_STATE_ACTIVE) != 0;
// 	}
// 
// 	public static boolean isMinimized(final int state) {
// 		return (state & WIN_STATE_MINIMIZED) != 0;
// 	}
// 
// 	public static boolean isMaximized(final int state) {
// 		return (state & WIN_STATE_MAXIMIZED) != 0;
// 	}
// }


import java.awt.Button;
import java.awt.Frame;
import java.awt.Toolkit;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import cn.com.jautoitx.Win.WinState;
import com.sun.jna.platform.win32.User32;
import com.sun.jna.platform.win32.WinDef.HWND;
import com.sun.jna.platform.win32.WinUser;

		Assert.assertTrue(Win.restore(NOTEPAD_TITLE));
		assertEquals(Win.WIN_STATE_EXISTS + Win.WIN_STATE_VISIBLE
				+ Win.WIN_STATE_ENABLED, Win.getState(NOTEPAD_TITLE));

		// active notepad
		Win.activate(NOTEPAD_TITLE);
		assertEquals(Win.WIN_STATE_EXISTS + Win.WIN_STATE_VISIBLE
				+ Win.WIN_STATE_ENABLED + Win.WIN_STATE_ACTIVE,
				Win.getState(NOTEPAD_TITLE));

		// hide notepad
		Assert.assertTrue(Win.hide(NOTEPAD_TITLE));
		assertEquals(Win.WIN_STATE_EXISTS + Win.WIN_STATE_ENABLED
				+ Win.WIN_STATE_ACTIVE, Win.getState(NOTEPAD_TITLE));

		// close notepad
		Process.close(pid);
		sleep(500);
		Assert.assertFalse(Process.exists(pid));

		// If the window title "Program Manager" is used, the function will
		// return the size of the desktop
		Assert.assertNull(Win.getState(NOTEPAD_TITLE));
	}

	@Test
	public void getState_() {
		// run notepad
		int pid = runNotepad();


// Path: src/cn/com/jautoitx/Win.java
// public static enum WinState {
// 	/* Window exists */
// 	EXISTS(WIN_STATE_EXISTS),
// 
// 	/* Window is visible */
// 	VISIBLE(WIN_STATE_VISIBLE),
// 
// 	/* Windows is enabled */
// 	ENABLED(WIN_STATE_ENABLED),
// 
// 	/* Window is active */
// 	ACTIVE(WIN_STATE_ACTIVE),
// 
// 	/* Window is minimized */
// 	MINIMIZED(WIN_STATE_MINIMIZED),
// 
// 	/* Windows is maximized */
// 	MAXIMIZED(WIN_STATE_MAXIMIZED);
// 
// 	private final int state;
// 
// 	private WinState(final int state) {
// 		this.state = state;
// 	}
// 
// 	public int getState() {
// 		return state;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		switch (this) {
// 		case EXISTS:
// 			return "exists";
// 		case VISIBLE:
// 			return "visible";
// 		case ENABLED:
// 			return "enabled";
// 		case ACTIVE:
// 			return "active";
// 		case MINIMIZED:
// 			return "minimized";
// 		case MAXIMIZED:
// 			return "maximized";
// 		default:
// 			return "Unknown state";
// 		}
// 	}
// 
// 	public static boolean isExists(final int state) {
// 		return (state & WIN_STATE_EXISTS) != 0;
// 	}
// 
// 	public static boolean isVisible(final int state) {
// 		return (state & WIN_STATE_VISIBLE) != 0;
// 	}
// 
// 	public static boolean isEnabled(final int state) {
// 		return (state & WIN_STATE_ENABLED) != 0;
// 	}
// 
// 	public static boolean isActive(final int state) {
// 		return (state & WIN_STATE_ACTIVE) != 0;
// 	}
// 
// 	public static boolean isMinimized(final int state) {
// 		return (state & WIN_STATE_MINIMIZED) != 0;
// 	}
// 
// 	public static boolean isMaximized(final int state) {
// 		return (state & WIN_STATE_MAXIMIZED) != 0;
// 	}
// }


// Path: test/cn/com/jautoitx/WinTest.java
import java.awt.Button;
import java.awt.Frame;
import java.awt.Toolkit;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import cn.com.jautoitx.Win.WinState;
import com.sun.jna.platform.win32.User32;
import com.sun.jna.platform.win32.WinDef.HWND;
import com.sun.jna.platform.win32.WinUser;

		Assert.assertTrue(Win.restore(NOTEPAD_TITLE));
		assertEquals(Win.WIN_STATE_EXISTS + Win.WIN_STATE_VISIBLE
				+ Win.WIN_STATE_ENABLED, Win.getState(NOTEPAD_TITLE));

		// active notepad
		Win.activate(NOTEPAD_TITLE);
		assertEquals(Win.WIN_STATE_EXISTS + Win.WIN_STATE_VISIBLE
				+ Win.WIN_STATE_ENABLED + Win.WIN_STATE_ACTIVE,
				Win.getState(NOTEPAD_TITLE));

		// hide notepad
		Assert.assertTrue(Win.hide(NOTEPAD_TITLE));
		assertEquals(Win.WIN_STATE_EXISTS + Win.WIN_STATE_ENABLED
				+ Win.WIN_STATE_ACTIVE, Win.getState(NOTEPAD_TITLE));

		// close notepad
		Process.close(pid);
		sleep(500);
		Assert.assertFalse(Process.exists(pid));

		// If the window title "Program Manager" is used, the function will
		// return the size of the desktop
		Assert.assertNull(Win.getState(NOTEPAD_TITLE));
	}

	@Test
	public void getState_() {
		// run notepad
		int pid = runNotepad();


		List<WinState> winStates = Win.getState_(NOTEPAD_TITLE);
