// 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.assertNull(Win.getWidth(NOTEPAD_TITLE));

		// If the window title "Program Manager" is used, the function will
		// return the size of the desktop
		assertEquals(Toolkit.getDefaultToolkit().getScreenSize().width,
				Win.getWidth(Win.PROGRAM_MANAGER));
	}

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

		assertEquals(pid, Win.getProcess(NOTEPAD_TITLE));
		assertEquals(pid, Win.getProcess((String) null));
		assertEquals(pid, Win.getProcess(""));

		// close notepad
		closeNotepad(pid);

		Assert.assertNull(Win.getProcess(NOTEPAD_TITLE));
	}

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

		assertEquals(Win.WIN_STATE_EXISTS + Win.WIN_STATE_VISIBLE
				+ Win.WIN_STATE_ENABLED + Win.WIN_STATE_ACTIVE,

// 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.assertNull(Win.getWidth(NOTEPAD_TITLE));

		// If the window title "Program Manager" is used, the function will
		// return the size of the desktop
		assertEquals(Toolkit.getDefaultToolkit().getScreenSize().width,
				Win.getWidth(Win.PROGRAM_MANAGER));
	}

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

		assertEquals(pid, Win.getProcess(NOTEPAD_TITLE));
		assertEquals(pid, Win.getProcess((String) null));
		assertEquals(pid, Win.getProcess(""));

		// close notepad
		closeNotepad(pid);

		Assert.assertNull(Win.getProcess(NOTEPAD_TITLE));
	}

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

		assertEquals(Win.WIN_STATE_EXISTS + Win.WIN_STATE_VISIBLE
				+ Win.WIN_STATE_ENABLED + Win.WIN_STATE_ACTIVE,

				Win.getState(NOTEPAD_TITLE));
