[1/4] comctl32/listview: EN_KILLFOCUS handling test

Nikolay Sivov bunglehead at gmail.com
Wed Jun 3 05:37:14 CDT 2009


Test shows that text is actually saved in EN_KILLFOCUS notification
handler. But we currently use WM_KILLFOCUS in subclass proc for Edit box.

Changelog:
    - EN_KILLFOCUS handling test

>From c4280a667f330cac3400be6b22f7d90616e944cc Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Tue, 2 Jun 2009 23:46:43 +0400
Subject: EN_KILLFOCUS handling test

---
 dlls/comctl32/tests/listview.c |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index fa110cd..21697c6 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -2892,6 +2892,42 @@ static void test_editbox(void)
     hwndedit = (HWND)SendMessage(hwnd, LVM_EDITLABEL, 0, 0);
     ok(hwndedit == NULL, "Expected Edit window not to be created\n");
 
+    /* check EN_KILLFOCUS handling */
+    memset(&item, 0, sizeof(item));
+    item.pszText = testitemA;
+    item.iItem = 0;
+    item.iSubItem = 0;
+    r = SendMessage(hwnd, LVM_SETITEMTEXTA, 0, (LPARAM)&item);
+    expect(TRUE, r);
+
+    SetFocus(hwnd);
+    hwndedit = (HWND)SendMessage(hwnd, LVM_EDITLABEL, 0, 0);
+    ok(IsWindow(hwndedit), "Expected Edit window to be created\n");
+    /* modify edit and notify control that it lost focus */
+    r = SendMessage(hwndedit, WM_SETTEXT, 0, (LPARAM)testitem1A);
+    expect(TRUE, r);
+    r = SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), (LPARAM)hwndedit);
+    expect(0, r);
+    memset(&item, 0, sizeof(item));
+    item.pszText = buffer;
+    item.cchTextMax = 10;
+    item.iItem = 0;
+    item.iSubItem = 0;
+    r = SendMessage(hwnd, LVM_GETITEMTEXTA, 0, (LPARAM)&item);
+    expect(strlen(item.pszText), r);
+    todo_wine ok(strcmp(buffer, testitem1A) == 0, "Expected item text to change\n");
+    /* end edit without saving */
+    r = SendMessage(hwndedit, WM_KEYDOWN, VK_ESCAPE, 0);
+    expect(0, r);
+    memset(&item, 0, sizeof(item));
+    item.pszText = buffer;
+    item.cchTextMax = 10;
+    item.iItem = 0;
+    item.iSubItem = 0;
+    r = SendMessage(hwnd, LVM_GETITEMTEXTA, 0, (LPARAM)&item);
+    expect(strlen(item.pszText), r);
+    todo_wine ok(strcmp(buffer, testitem1A) == 0, "Expected item text to change\n");
+
     DestroyWindow(hwnd);
 }
 
-- 
1.5.6.5







More information about the wine-patches mailing list