public void KillFocusAndGetFocusInActivateInKeyDown() { // Similate a Keydown, inside which we get an MdiActivate, inside which we get a kill focus and a GetFocus. // Since activate is not being sequenced, but the other two are, we expect the sequence // start of keydown, start of activate, end of activate, end of keydown, start of killfocus, end of killfocus, start of get focus, end of get focus. Message msgKeyDown = Message.Create(IntPtr.Zero, (int)Win32.WinMsgs.WM_KEYDOWN, new IntPtr(101), new IntPtr(1001)); Message msgActivate = Message.Create(IntPtr.Zero, (int)Win32.WinMsgs.WM_MDIACTIVATE, new IntPtr(201), new IntPtr(2001)); Message msgKillFocus = Message.Create(IntPtr.Zero, (int)Win32.WinMsgs.WM_KILLFOCUS, new IntPtr(201), new IntPtr(2001)); Message msgSetFocus = Message.Create(IntPtr.Zero, (int)Win32.WinMsgs.WM_SETFOCUS, new IntPtr(301), new IntPtr(3001)); TestControl2 tc2 = new TestControl2(msgKeyDown, msgActivate, msgKillFocus, msgSetFocus); tc2.CallWndProc(ref msgKeyDown); object[] expected = { msgKeyDown, msgActivate, msgActivate, msgKeyDown, msgKillFocus, msgKillFocus, msgSetFocus, msgSetFocus }; VerifyArray(expected, tc2); }
public void KillFocusAndGetFocusInActivateInKeyDown() { // Similate a Keydown, inside which we get an MdiActivate, inside which we get a kill focus and a GetFocus. // Since activate is not being sequenced, but the other two are, we expect the sequence // start of keydown, start of activate, end of activate, end of keydown, start of killfocus, end of killfocus, start of get focus, end of get focus. Message msgKeyDown = Message.Create(IntPtr.Zero, (int)Win32.WinMsgs.WM_KEYDOWN, new IntPtr(101), new IntPtr(1001)); Message msgActivate = Message.Create(IntPtr.Zero, (int)Win32.WinMsgs.WM_MDIACTIVATE, new IntPtr(201), new IntPtr(2001)); Message msgKillFocus = Message.Create(IntPtr.Zero, (int)Win32.WinMsgs.WM_KILLFOCUS, new IntPtr(201), new IntPtr(2001)); Message msgSetFocus = Message.Create(IntPtr.Zero, (int)Win32.WinMsgs.WM_SETFOCUS, new IntPtr(301), new IntPtr(3001)); TestControl2 tc2 = new TestControl2(msgKeyDown, msgActivate, msgKillFocus, msgSetFocus); tc2.CallWndProc(ref msgKeyDown); object[] expected = {msgKeyDown, msgActivate, msgActivate, msgKeyDown, msgKillFocus, msgKillFocus, msgSetFocus, msgSetFocus}; VerifyArray(expected, tc2); }