[COMCTL32_WINETEST] Sync with Wine Staging 4.0. CORE-15682
[reactos.git] / modules / rostests / winetests / comctl32 / pager.c
index 0da396c..f48dc03 100644 (file)
 #define PAGER_SEQ_INDEX     0
 
 static HWND parent_wnd, child1_wnd, child2_wnd;
+static INT notify_format;
+static BOOL notify_query_received;
+static WCHAR test_w[] = {'t', 'e', 's', 't', 0};
+static CHAR test_a[] = {'t', 'e', 's', 't', 0};
+/* Double zero so that it's safe to cast it to WCHAR * */
+static CHAR te_a[] = {'t', 'e', 0, 0};
+static WCHAR empty_w[] = {0};
+static CHAR empty_a[] = {0};
+static CHAR large_a[] = "You should have received a copy of the GNU Lesser General Public License along with this ...";
+static WCHAR large_w[] =
+{
+    'Y', 'o', 'u', ' ', 's', 'h', 'o', 'u', 'l', 'd', ' ', 'h', 'a', 'v', 'e', ' ', 'r', 'e', 'c', 'e', 'i', 'v', 'e',
+    'd', ' ', 'a', ' ', 'c', 'o', 'p', 'y', ' ', 'o', 'f', ' ', 't', 'h', 'e', ' ', 'G', 'N', 'U', ' ', 'L', 'e', 's',
+    's', 'e', 'r', ' ', 'G', 'e', 'n', 'e', 'r', 'a', 'l', ' ', 'P', 'u', 'b', 'l', 'i', 'c', ' ', 'L', 'i', 'c', 'e',
+    'n', 's', 'e', ' ', 'a', 'l', 'o', 'n', 'g', ' ', 'w', 'i', 't', 'h', ' ', 't', 'h', 'i', 's', ' ', '.', '.', '.', 0
+};
+static WCHAR large_truncated_65_w[65] =
+{
+    'Y', 'o', 'u', ' ', 's', 'h', 'o', 'u', 'l', 'd', ' ', 'h', 'a', 'v', 'e', ' ', 'r', 'e', 'c', 'e', 'i', 'v',
+    'e', 'd', ' ', 'a', ' ', 'c', 'o', 'p', 'y', ' ', 'o', 'f', ' ', 't', 'h', 'e', ' ', 'G', 'N', 'U', ' ', 'L',
+    'e', 's', 's', 'e', 'r', ' ', 'G', 'e', 'n', 'e', 'r', 'a', 'l', ' ', 'P', 'u', 'b', 'l', 'i', 'c', 0
+};
+static WCHAR large_truncated_80_w[80] =
+{
+    'Y', 'o', 'u', ' ', 's', 'h', 'o', 'u', 'l', 'd', ' ', 'h', 'a', 'v', 'e', ' ', 'r', 'e', 'c', 'e',
+    'i', 'v', 'e', 'd', ' ', 'a', ' ', 'c', 'o', 'p', 'y', ' ', 'o', 'f', ' ', 't', 'h', 'e', ' ', 'G',
+    'N', 'U', ' ', 'L', 'e', 's', 's', 'e', 'r', ' ', 'G', 'e', 'n', 'e', 'r', 'a', 'l', ' ', 'P', 'u',
+    'b', 'l', 'i', 'c', ' ', 'L', 'i', 'c', 'e', 'n', 's', 'e', ' ', 'a', 'l', 'o', 'n', 'g', ' ', 'w'
+};
+static WCHAR buffer[64];
+
+/* Text field conversion test behavior flags. */
+enum test_conversion_flags
+{
+    CONVERT_SEND = 0x01,
+    DONT_CONVERT_SEND = 0x02,
+    CONVERT_RECEIVE = 0x04,
+    DONT_CONVERT_RECEIVE = 0x08,
+    SEND_EMPTY_IF_NULL = 0x10,
+    DONT_SEND_EMPTY_IF_NULL = 0x20,
+    SET_NULL_IF_NO_MASK = 0x40,
+    ZERO_SEND = 0x80
+};
+
+enum handler_ids
+{
+    TVITEM_NEW_HANDLER,
+    TVITEM_OLD_HANDLER
+};
+
+static struct notify_test_info
+{
+    UINT unicode;
+    UINT ansi;
+    UINT_PTR id_from;
+    HWND hwnd_from;
+    /* Whether parent received notification */
+    BOOL received;
+    UINT test_id;
+    UINT sub_test_id;
+    UINT handler_id;
+    /* Text field conversion test behavior flag */
+    DWORD flags;
+} notify_test_info;
+
+struct notify_test_send
+{
+    /* Data sent to pager */
+    WCHAR *send_text;
+    INT send_text_size;
+    INT send_text_max;
+    /* Data expected by parent of pager */
+    void *expect_text;
+};
+
+struct notify_test_receive
+{
+    /* Data sent to pager */
+    WCHAR *send_text;
+    INT send_text_size;
+    INT send_text_max;
+    /* Data for parent to write */
+    CHAR *write_pointer;
+    CHAR *write_text;
+    INT write_text_size;
+    INT write_text_max;
+    /* Data when message returned */
+    void *return_text;
+    INT return_text_max;
+};
+
+struct generic_text_helper_para
+{
+    void *ptr;
+    size_t size;
+    UINT *mask;
+    UINT required_mask;
+    WCHAR **text;
+    INT *text_max;
+    UINT code_unicode;
+    UINT code_ansi;
+    DWORD flags;
+    UINT handler_id;
+};
+
+static const struct notify_test_send test_convert_send_data[] =
+{
+    {test_w, sizeof(test_w), ARRAY_SIZE(buffer), test_a}
+};
+
+static const struct notify_test_send test_dont_convert_send_data[] =
+{
+    {test_w, sizeof(test_w), ARRAY_SIZE(buffer), test_w}
+};
+
+static const struct notify_test_receive test_convert_receive_data[] =
+{
+    {empty_w, sizeof(empty_w), ARRAY_SIZE(buffer), NULL, test_a, sizeof(test_a), -1, test_w, ARRAY_SIZE(buffer)},
+    {empty_w, sizeof(empty_w), ARRAY_SIZE(buffer), test_a, NULL, 0, -1, test_w, ARRAY_SIZE(buffer)},
+    {NULL, sizeof(empty_w), ARRAY_SIZE(buffer), test_a, NULL, 0, -1, NULL, ARRAY_SIZE(buffer)},
+    {empty_w, sizeof(empty_w), ARRAY_SIZE(buffer), large_a, NULL, 0, -1, large_truncated_65_w, ARRAY_SIZE(buffer)},
+    {empty_w, sizeof(empty_w), ARRAY_SIZE(buffer), empty_a, 0, 0, 1, empty_w, 1},
+};
+
+static const struct notify_test_receive test_dont_convert_receive_data[] =
+{
+    {empty_w, sizeof(empty_w), ARRAY_SIZE(buffer), NULL, test_a, sizeof(test_a), -1, test_a, ARRAY_SIZE(buffer)},
+    {empty_w, sizeof(empty_w), ARRAY_SIZE(buffer), test_a, NULL, 0, -1, test_a, ARRAY_SIZE(buffer)},
+};
+
+static const struct notify_test_tooltip
+{
+    /* Data for parent to write */
+    CHAR *write_sztext;
+    INT write_sztext_size;
+    CHAR *write_lpsztext;
+    HMODULE write_hinst;
+    /* Data when message returned */
+    WCHAR *return_sztext;
+    INT return_sztext_size;
+    WCHAR *return_lpsztext;
+    HMODULE return_hinst;
+    /* Data expected by parent */
+    CHAR *expect_sztext;
+    /* Data send to parent */
+    WCHAR *send_sztext;
+    INT send_sztext_size;
+    WCHAR *send_lpsztext;
+} test_tooltip_data[] =
+{
+    {NULL, 0, NULL, NULL, empty_w, -1, empty_w},
+    {test_a, sizeof(test_a), NULL, NULL, test_w, -1, test_w},
+    {test_a, sizeof(test_a), test_a, NULL, test_w, -1, test_w},
+    {test_a, sizeof(test_a), (CHAR *)1, (HMODULE)0xdeadbeef, empty_w, -1, (WCHAR *)1, (HMODULE)0xdeadbeef},
+    {test_a, sizeof(test_a), test_a, (HMODULE)0xdeadbeef, test_w, -1, test_w, (HMODULE)0xdeadbeef},
+    {NULL, 0, test_a, NULL, test_w, -1, test_w},
+    {test_a, 2, test_a, NULL, test_w, -1, test_w},
+    {NULL, 0, NULL, NULL, test_w, -1, test_w, NULL, test_a, test_w, sizeof(test_w)},
+    {NULL, 0, NULL, NULL, empty_w, -1, empty_w, NULL, empty_a, NULL, 0, test_w},
+    {NULL, 0, large_a, NULL, large_truncated_80_w, sizeof(large_truncated_80_w), large_w}
+};
+
+static const struct notify_test_datetime_format
+{
+    /* Data send to parent */
+    WCHAR *send_pszformat;
+    /* Data expected by parent */
+    CHAR *expect_pszformat;
+    /* Data for parent to write */
+    CHAR *write_szdisplay;
+    INT write_szdisplay_size;
+    CHAR *write_pszdisplay;
+    /* Data when message returned */
+    WCHAR *return_szdisplay;
+    INT return_szdisplay_size;
+    WCHAR *return_pszdisplay;
+} test_datetime_format_data[] =
+{
+    {test_w, test_a},
+    {NULL, NULL, NULL, 0, test_a, empty_w, -1, test_w},
+    {NULL, NULL, test_a, sizeof(test_a), NULL, test_w, -1, test_w},
+    {NULL, NULL, test_a, 2, test_a, (WCHAR *)te_a, -1, test_w},
+    {NULL, NULL, NULL, 0, large_a, NULL, 0, large_w}
+};
 
 #define CHILD1_ID 1
 #define CHILD2_ID 2
 
+static BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
 static BOOL (WINAPI *pSetWindowSubclass)(HWND, SUBCLASSPROC, UINT_PTR, DWORD_PTR);
 
 static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
@@ -97,6 +282,14 @@ static const struct message set_pos_empty_seq[] = {
     { 0 }
 };
 
+static CHAR *heap_strdup(const CHAR *str)
+{
+    int len = lstrlenA(str) + 1;
+    CHAR *ret = heap_alloc(len * sizeof(CHAR));
+    lstrcpyA(ret, str);
+    return ret;
+}
+
 static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
     static LONG defwndproc_counter = 0;
@@ -257,11 +450,7 @@ static void test_pager(void)
     RECT rect, rect2;
 
     pager = create_pager_control( PGS_HORZ );
-    if (!pager)
-    {
-        win_skip( "Pager control not supported\n" );
-        return;
-    }
+    ok(pager != NULL, "Fail to create pager\n");
 
     register_child_wnd_class();
 
@@ -333,11 +522,809 @@ static void test_pager(void)
     DestroyWindow( pager );
 }
 
-START_TEST(pager)
+static LRESULT WINAPI test_notifyformat_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
-    HMODULE mod = GetModuleHandleA("comctl32.dll");
+    switch (message)
+    {
+    case WM_NOTIFYFORMAT:
+        if (lParam == NF_QUERY)
+        {
+            notify_query_received = TRUE;
+            return notify_format;
+        }
+        else if (lParam == NF_REQUERY)
+            return SendMessageA(GetParent(hwnd), WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
+        else
+            return 0;
+    default:
+        return notify_format == NFR_UNICODE ? DefWindowProcW(hwnd, message, wParam, lParam)
+                                            : DefWindowProcA(hwnd, message, wParam, lParam);
+    }
+}
+
+static BOOL register_notifyformat_class(void)
+{
+    static const WCHAR class_w[] = {'P', 'a', 'g', 'e', 'r', ' ', 'n', 'o', 't', 'i', 'f', 'y', 'f',
+                                   'o', 'r', 'm', 'a', 't', ' ', 'c', 'l', 'a', 's', 's', 0};
+    WNDCLASSW cls = {0};
+
+    cls.lpfnWndProc = test_notifyformat_proc;
+    cls.hInstance = GetModuleHandleW(NULL);
+    cls.lpszClassName = class_w;
+    return RegisterClassW(&cls);
+}
+
+static void test_wm_notifyformat(void)
+{
+    static const WCHAR class_w[] = {'P', 'a', 'g', 'e', 'r', ' ', 'n', 'o', 't', 'i', 'f', 'y', 'f',
+                                    'o', 'r', 'm', 'a', 't', ' ', 'c', 'l', 'a', 's', 's', 0};
+    static const WCHAR parent_w[] = {'p', 'a', 'r', 'e', 'n', 't', 0};
+    static const WCHAR pager_w[] = {'p', 'a', 'g', 'e', 'r', 0};
+    static const WCHAR child_w[] = {'c', 'h', 'i', 'l', 'd', 0};
+    static const INT formats[] = {NFR_UNICODE, NFR_ANSI};
+    HWND parent, pager, child;
+    LRESULT ret;
+    INT i;
+
+    ok(register_notifyformat_class(), "Register test class failed, error 0x%08x\n", GetLastError());
+
+    for (i = 0; i < ARRAY_SIZE(formats); i++)
+    {
+        notify_format = formats[i];
+        parent = CreateWindowW(class_w, parent_w, WS_OVERLAPPED, 0, 0, 100, 100, 0, 0, GetModuleHandleW(0), 0);
+        ok(parent != NULL, "CreateWindow failed\n");
+        pager = CreateWindowW(WC_PAGESCROLLERW, pager_w, WS_CHILD, 0, 0, 100, 100, parent, 0, GetModuleHandleW(0), 0);
+        ok(pager != NULL, "CreateWindow failed\n");
+        child = CreateWindowW(class_w, child_w, WS_CHILD, 0, 0, 100, 100, pager, 0, GetModuleHandleW(0), 0);
+        ok(child != NULL, "CreateWindow failed\n");
+        SendMessageW(pager, PGM_SETCHILD, 0, (LPARAM)child);
+
+        /* Test parent */
+        notify_query_received = FALSE;
+        ret = SendMessageW(pager, WM_NOTIFYFORMAT, (WPARAM)parent, NF_REQUERY);
+        ok(ret == notify_format, "Expect %d, got %ld\n", notify_format, ret);
+        ok(notify_query_received, "Didn't receive notify\n");
+
+        /* Send NF_QUERY directly to parent */
+        notify_query_received = FALSE;
+        ret = SendMessageW(parent, WM_NOTIFYFORMAT, (WPARAM)pager, NF_QUERY);
+        ok(ret == notify_format, "Expect %d, got %ld\n", notify_format, ret);
+        ok(notify_query_received, "Didn't receive notify\n");
+
+        /* Pager send notifications to its parent regardless of wParam */
+        notify_query_received = FALSE;
+        ret = SendMessageW(pager, WM_NOTIFYFORMAT, (WPARAM)parent_wnd, NF_REQUERY);
+        ok(ret == notify_format, "Expect %d, got %ld\n", notify_format, ret);
+        ok(notify_query_received, "Didn't receive notify\n");
+
+        /* Pager always wants Unicode notifications from children */
+        ret = SendMessageW(child, WM_NOTIFYFORMAT, (WPARAM)pager, NF_REQUERY);
+        ok(ret == NFR_UNICODE, "Expect %d, got %ld\n", NFR_UNICODE, ret);
+        ret = SendMessageW(pager, WM_NOTIFYFORMAT, (WPARAM)child, NF_QUERY);
+        ok(ret == NFR_UNICODE, "Expect %d, got %ld\n", NFR_UNICODE, ret);
+
+        DestroyWindow(parent);
+    }
+
+    UnregisterClassW(class_w, GetModuleHandleW(NULL));
+}
+
+static void notify_generic_text_handler(CHAR **text, INT *text_max)
+{
+    const struct notify_test_send *send_data;
+    const struct notify_test_receive *receive_data;
+
+    switch (notify_test_info.test_id)
+    {
+    case CONVERT_SEND:
+    case DONT_CONVERT_SEND:
+    {
+        send_data = (notify_test_info.test_id == CONVERT_SEND ? test_convert_send_data : test_dont_convert_send_data)
+                    + notify_test_info.sub_test_id;
+        if (notify_test_info.flags & ZERO_SEND)
+            ok(!lstrcmpA(*text, empty_a), "Code 0x%08x test 0x%08x sub test %d expect empty text, got %s\n",
+               notify_test_info.unicode, notify_test_info.test_id, notify_test_info.sub_test_id, *text);
+        else if (notify_test_info.flags & CONVERT_SEND)
+            ok(!lstrcmpA(send_data->expect_text, *text), "Code 0x%08x test 0x%08x sub test %d expect %s, got %s\n",
+               notify_test_info.unicode, notify_test_info.test_id, notify_test_info.sub_test_id,
+               (CHAR *)send_data->expect_text, *text);
+        else
+            ok(!lstrcmpW((WCHAR *)send_data->expect_text, (WCHAR *)*text),
+               "Code 0x%08x test 0x%08x sub test %d expect %s, got %s\n", notify_test_info.unicode,
+               notify_test_info.test_id, notify_test_info.sub_test_id, wine_dbgstr_w((WCHAR *)send_data->expect_text),
+               wine_dbgstr_w((WCHAR *)*text));
+        if (text_max)
+            ok(*text_max == send_data->send_text_max, "Code 0x%08x test 0x%08x sub test %d expect %d, got %d\n",
+               notify_test_info.unicode, notify_test_info.test_id, notify_test_info.sub_test_id,
+               send_data->send_text_max, *text_max);
+        break;
+    }
+    case CONVERT_RECEIVE:
+    case DONT_CONVERT_RECEIVE:
+    {
+        receive_data = (notify_test_info.test_id == CONVERT_RECEIVE ? test_convert_receive_data : test_dont_convert_receive_data)
+                       + notify_test_info.sub_test_id;
+        if (text_max)
+            ok(*text_max == receive_data->send_text_max, "Code 0x%08x test 0x%08x sub test %d expect %d, got %d\n",
+               notify_test_info.unicode, notify_test_info.test_id, notify_test_info.sub_test_id,
+               receive_data->send_text_max, *text_max);
+
+        if (receive_data->write_text)
+            memcpy(*text, receive_data->write_text, receive_data->write_text_size);
+        /* 64bit Windows will try to free the text pointer even if it's application provided when handling
+         * HDN_GETDISPINFOW. Deliberate leak here. */
+        else if(notify_test_info.unicode == HDN_GETDISPINFOW)
+            *text = heap_strdup(receive_data->write_pointer);
+        else
+            *text = receive_data->write_pointer;
+        if (text_max && receive_data->write_text_max != -1) *text_max = receive_data->write_text_max;
+        break;
+    }
+    case SEND_EMPTY_IF_NULL:
+        ok(!lstrcmpA(*text, empty_a), "Code 0x%08x test 0x%08x sub test %d expect empty text, got %s\n",
+           notify_test_info.unicode, notify_test_info.test_id, notify_test_info.sub_test_id, *text);
+        break;
+    case DONT_SEND_EMPTY_IF_NULL:
+        ok(!*text, "Code 0x%08x test 0x%08x sub test %d expect null text\n", notify_test_info.unicode,
+           notify_test_info.test_id, notify_test_info.sub_test_id);
+        break;
+    }
+}
+
+static void notify_tooltip_handler(NMTTDISPINFOA *nm)
+{
+    const struct notify_test_tooltip *data = test_tooltip_data + notify_test_info.sub_test_id;
+    ok(nm->lpszText == nm->szText, "Sub test %d expect %p, got %p\n", notify_test_info.sub_test_id, nm->szText,
+       nm->lpszText);
+    if (data->expect_sztext)
+        ok(!lstrcmpA(data->expect_sztext, nm->szText), "Sub test %d expect %s, got %s\n", notify_test_info.sub_test_id,
+           data->expect_sztext, nm->szText);
+    if (data->write_sztext) memcpy(nm->szText, data->write_sztext, data->write_sztext_size);
+    if (data->write_lpsztext) nm->lpszText = data->write_lpsztext;
+    if (data->write_hinst) nm->hinst = data->write_hinst;
+}
+
+static void notify_datetime_handler(NMDATETIMEFORMATA *nm)
+{
+    const struct notify_test_datetime_format *data = test_datetime_format_data + notify_test_info.sub_test_id;
+    if (data->expect_pszformat)
+        ok(!lstrcmpA(data->expect_pszformat, nm->pszFormat), "Sub test %d expect %s, got %s\n",
+           notify_test_info.sub_test_id, data->expect_pszformat, nm->pszFormat);
+    ok(nm->pszDisplay == nm->szDisplay, "Test %d expect %p, got %p\n", notify_test_info.sub_test_id, nm->szDisplay,
+       nm->pszDisplay);
+    if (data->write_szdisplay) memcpy(nm->szDisplay, data->write_szdisplay, data->write_szdisplay_size);
+    if (data->write_pszdisplay) nm->pszDisplay = data->write_pszdisplay;
+}
+
+static LRESULT WINAPI test_notify_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    static const WCHAR test[] = {'t', 'e', 's', 't', 0};
+    switch (message)
+    {
+    case WM_NOTIFY:
+    {
+        NMHDR *hdr = (NMHDR *)lParam;
+
+        /* Not notifications we want to test */
+        if (!notify_test_info.unicode) break;
+        ok(!notify_test_info.received, "Extra notification received\n");
+
+        ok(wParam == notify_test_info.id_from, "Expect %ld, got %ld\n", notify_test_info.id_from, wParam);
+        ok(hdr->code == notify_test_info.ansi, "Expect 0x%08x, got 0x%08x\n", notify_test_info.ansi, hdr->code);
+        ok(hdr->idFrom == notify_test_info.id_from, "Expect %ld, got %ld\n", notify_test_info.id_from, wParam);
+        ok(hdr->hwndFrom == notify_test_info.hwnd_from, "Expect %p, got %p\n", notify_test_info.hwnd_from, hdr->hwndFrom);
+
+        if (hdr->code != notify_test_info.ansi)
+        {
+            skip("Notification code mismatch, skipping lParam check\n");
+            return 0;
+        }
+        switch (hdr->code)
+        {
+        /* ComboBoxEx */
+        case CBEN_INSERTITEM:
+        case CBEN_DELETEITEM:
+        {
+            NMCOMBOBOXEXW *nmcbe = (NMCOMBOBOXEXW *)hdr;
+            notify_generic_text_handler((CHAR **)&nmcbe->ceItem.pszText, NULL);
+            break;
+        }
+        case CBEN_DRAGBEGINA:
+        {
+            NMCBEDRAGBEGINA *nmcbedb = (NMCBEDRAGBEGINA *)hdr;
+            ok(!lstrcmpA(nmcbedb->szText, test_a), "Expect %s, got %s\n", nmcbedb->szText, test_a);
+            break;
+        }
+        case CBEN_ENDEDITA:
+        {
+            NMCBEENDEDITA *nmcbeed = (NMCBEENDEDITA *)hdr;
+            ok(!lstrcmpA(nmcbeed->szText, test_a), "Expect %s, got %s\n", nmcbeed->szText, test_a);
+            break;
+        }
+        case CBEN_GETDISPINFOA:
+        {
+            NMCOMBOBOXEXA *nmcbe = (NMCOMBOBOXEXA *)hdr;
+            notify_generic_text_handler(&nmcbe->ceItem.pszText, &nmcbe->ceItem.cchTextMax);
+            break;
+        }
+        /* Date and Time Picker */
+        case DTN_FORMATA:
+        {
+            notify_datetime_handler((NMDATETIMEFORMATA *)hdr);
+            break;
+        }
+        case DTN_FORMATQUERYA:
+        {
+            NMDATETIMEFORMATQUERYA *nmdtfq = (NMDATETIMEFORMATQUERYA *)hdr;
+            notify_generic_text_handler((CHAR **)&nmdtfq->pszFormat, NULL);
+            break;
+        }
+        case DTN_WMKEYDOWNA:
+        {
+            NMDATETIMEWMKEYDOWNA *nmdtkd = (NMDATETIMEWMKEYDOWNA *)hdr;
+            notify_generic_text_handler((CHAR **)&nmdtkd->pszFormat, NULL);
+            break;
+        }
+        case DTN_USERSTRINGA:
+        {
+            NMDATETIMESTRINGA *nmdts = (NMDATETIMESTRINGA *)hdr;
+            notify_generic_text_handler((CHAR **)&nmdts->pszUserString, NULL);
+            break;
+        }
+        /* Header */
+        case HDN_BEGINDRAG:
+        case HDN_ENDDRAG:
+        case HDN_BEGINFILTEREDIT:
+        case HDN_ENDFILTEREDIT:
+        case HDN_DROPDOWN:
+        case HDN_FILTERCHANGE:
+        case HDN_ITEMKEYDOWN:
+        case HDN_ITEMSTATEICONCLICK:
+        case HDN_OVERFLOWCLICK:
+        {
+            NMHEADERW *nmhd = (NMHEADERW *)hdr;
+            ok(!lstrcmpW(nmhd->pitem->pszText, test_w), "Expect %s, got %s\n", wine_dbgstr_w(test_w),
+               wine_dbgstr_w(nmhd->pitem->pszText));
+            ok(!lstrcmpW(((HD_TEXTFILTERW *)nmhd->pitem->pvFilter)->pszText, test_w), "Expect %s, got %s\n",
+               wine_dbgstr_w(test_w), wine_dbgstr_w(((HD_TEXTFILTERW *)nmhd->pitem->pvFilter)->pszText));
+            break;
+        }
+        case HDN_BEGINTRACKA:
+        case HDN_DIVIDERDBLCLICKA:
+        case HDN_ENDTRACKA:
+        case HDN_ITEMCHANGEDA:
+        case HDN_ITEMCHANGINGA:
+        case HDN_ITEMCLICKA:
+        case HDN_ITEMDBLCLICKA:
+        case HDN_TRACKA:
+        {
+            NMHEADERA *nmhd = (NMHEADERA *)hdr;
+            ok(!lstrcmpA(nmhd->pitem->pszText, test_a), "Expect %s, got %s\n", test_a, nmhd->pitem->pszText);
+            ok(!lstrcmpA(((HD_TEXTFILTERA *)nmhd->pitem->pvFilter)->pszText, test_a), "Expect %s, got %s\n", test_a,
+               ((HD_TEXTFILTERA *)nmhd->pitem->pvFilter)->pszText);
+            break;
+        }
+        case HDN_GETDISPINFOA:
+        {
+            NMHDDISPINFOA *nmhddi = (NMHDDISPINFOA *)hdr;
+            notify_generic_text_handler(&nmhddi->pszText, &nmhddi->cchTextMax);
+            break;
+        }
+        /* List View */
+        case LVN_BEGINLABELEDITA:
+        case LVN_ENDLABELEDITA:
+        case LVN_GETDISPINFOA:
+        case LVN_SETDISPINFOA:
+        {
+            NMLVDISPINFOA *nmlvdi = (NMLVDISPINFOA *)hdr;
+            notify_generic_text_handler(&nmlvdi->item.pszText, &nmlvdi->item.cchTextMax);
+            break;
+        }
+        case LVN_GETINFOTIPA:
+        {
+            NMLVGETINFOTIPA *nmlvgit = (NMLVGETINFOTIPA *)hdr;
+            notify_generic_text_handler(&nmlvgit->pszText, &nmlvgit->cchTextMax);
+            break;
+        }
+        case LVN_INCREMENTALSEARCHA:
+        case LVN_ODFINDITEMA:
+        {
+            NMLVFINDITEMA *nmlvfi = (NMLVFINDITEMA *)hdr;
+            notify_generic_text_handler((CHAR **)&nmlvfi->lvfi.psz, NULL);
+            break;
+        }
+        /* Toolbar */
+        case TBN_SAVE:
+        {
+            NMTBSAVE *nmtbs = (NMTBSAVE *)hdr;
+            notify_generic_text_handler((CHAR **)&nmtbs->tbButton.iString, NULL);
+            break;
+        }
+        case TBN_RESTORE:
+        {
+            NMTBRESTORE *nmtbr = (NMTBRESTORE *)hdr;
+            notify_generic_text_handler((CHAR **)&nmtbr->tbButton.iString, NULL);
+            break;
+        }
+        case TBN_GETBUTTONINFOA:
+        {
+            NMTOOLBARA *nmtb = (NMTOOLBARA *)hdr;
+            notify_generic_text_handler(&nmtb->pszText, &nmtb->cchText);
+            break;
+        }
+        case TBN_GETDISPINFOW:
+        {
+            NMTBDISPINFOW *nmtbdi = (NMTBDISPINFOW *)hdr;
+            notify_generic_text_handler((CHAR **)&nmtbdi->pszText, &nmtbdi->cchText);
+            break;
+        }
+        case TBN_GETINFOTIPA:
+        {
+            NMTBGETINFOTIPA *nmtbgit = (NMTBGETINFOTIPA *)hdr;
+            notify_generic_text_handler(&nmtbgit->pszText, &nmtbgit->cchTextMax);
+            break;
+        }
+        /* Tooltip */
+        case TTN_GETDISPINFOA:
+        {
+            notify_tooltip_handler((NMTTDISPINFOA *)hdr);
+            break;
+        }
+        /* Tree View */
+        case TVN_BEGINLABELEDITA:
+        case TVN_ENDLABELEDITA:
+        case TVN_GETDISPINFOA:
+        case TVN_SETDISPINFOA:
+        {
+            NMTVDISPINFOA *nmtvdi = (NMTVDISPINFOA *)hdr;
+            notify_generic_text_handler(&nmtvdi->item.pszText, &nmtvdi->item.cchTextMax);
+            break;
+        }
+        case TVN_GETINFOTIPA:
+        {
+            NMTVGETINFOTIPA *nmtvgit = (NMTVGETINFOTIPA *)hdr;
+            notify_generic_text_handler(&nmtvgit->pszText, &nmtvgit->cchTextMax);
+            break;
+        }
+        case TVN_SINGLEEXPAND:
+        case TVN_BEGINDRAGA:
+        case TVN_BEGINRDRAGA:
+        case TVN_ITEMEXPANDEDA:
+        case TVN_ITEMEXPANDINGA:
+        case TVN_DELETEITEMA:
+        case TVN_SELCHANGINGA:
+        case TVN_SELCHANGEDA:
+        {
+            NMTREEVIEWA *nmtv = (NMTREEVIEWA *)hdr;
+            if (notify_test_info.handler_id == TVITEM_NEW_HANDLER)
+                notify_generic_text_handler((CHAR **)&nmtv->itemNew.pszText, &nmtv->itemNew.cchTextMax);
+            else
+                notify_generic_text_handler((CHAR **)&nmtv->itemOld.pszText, &nmtv->itemOld.cchTextMax);
+            break;
+        }
+
+        default:
+            ok(0, "Unexpected message 0x%08x\n", hdr->code);
+        }
+        notify_test_info.received = TRUE;
+        ok(!lstrcmpA(test_a, "test"), "test_a got modified\n");
+        ok(!lstrcmpW(test_w, test), "test_w got modified\n");
+        return 0;
+    }
+    case WM_NOTIFYFORMAT:
+        if (lParam == NF_QUERY) return NFR_ANSI;
+        break;
+    }
+    return DefWindowProcA(hwnd, message, wParam, lParam);
+}
+
+static BOOL register_test_notify_class(void)
+{
+    WNDCLASSA cls = {0};
+
+    cls.lpfnWndProc = test_notify_proc;
+    cls.hInstance = GetModuleHandleA(NULL);
+    cls.lpszClassName = "Pager notify class";
+    return RegisterClassA(&cls);
+}
+
+static void send_notify(HWND pager, UINT unicode, UINT ansi, LPARAM lParam, BOOL code_change)
+{
+    NMHDR *hdr = (NMHDR *)lParam;
+
+    notify_test_info.unicode = unicode;
+    notify_test_info.id_from = 1;
+    notify_test_info.hwnd_from = child1_wnd;
+    notify_test_info.ansi = ansi;
+    notify_test_info.received = FALSE;
+
+    hdr->code = unicode;
+    hdr->idFrom = 1;
+    hdr->hwndFrom = child1_wnd;
+
+    SendMessageW(pager, WM_NOTIFY, hdr->idFrom, lParam);
+    ok(notify_test_info.received, "Expect notification received\n");
+    ok(hdr->code == code_change ? ansi : unicode, "Expect 0x%08x, got 0x%08x\n", hdr->code,
+       code_change ? ansi : unicode);
+}
+
+/* Send notify to test text field conversion. In parent proc notify_generic_text_handler() handles these messages */
+static void test_notify_generic_text_helper(HWND pager, const struct generic_text_helper_para *para)
+{
+    const struct notify_test_send *send_data;
+    const struct notify_test_receive *receive_data;
+    INT array_size;
+    INT i;
+
+    notify_test_info.flags = para->flags;
+    notify_test_info.handler_id = para->handler_id;
+
+    if (para->flags & (CONVERT_SEND | DONT_CONVERT_SEND))
+    {
+        if (para->flags & CONVERT_SEND)
+        {
+            notify_test_info.test_id = CONVERT_SEND;
+            send_data = test_convert_send_data;
+            array_size = ARRAY_SIZE(test_convert_send_data);
+        }
+        else
+        {
+            notify_test_info.test_id = DONT_CONVERT_SEND;
+            send_data = test_dont_convert_send_data;
+            array_size = ARRAY_SIZE(test_dont_convert_send_data);
+        }
+
+        for (i = 0; i < array_size; i++)
+        {
+            const struct notify_test_send *data = send_data + i;
+            notify_test_info.sub_test_id = i;
+
+            memset(para->ptr, 0, para->size);
+            if (para->mask) *para->mask = para->required_mask;
+            if (data->send_text)
+            {
+                memcpy(buffer, data->send_text, data->send_text_size);
+                *para->text = buffer;
+            }
+            if (para->text_max) *para->text_max = data->send_text_max;
+            send_notify(pager, para->code_unicode, para->code_ansi, (LPARAM)para->ptr, TRUE);
+        }
+    }
+
+    if (para->flags & (CONVERT_RECEIVE | DONT_CONVERT_RECEIVE))
+    {
+        if (para->flags & CONVERT_RECEIVE)
+        {
+            notify_test_info.test_id = CONVERT_RECEIVE;
+            receive_data = test_convert_receive_data;
+            array_size = ARRAY_SIZE(test_convert_receive_data);
+        }
+        else
+        {
+            notify_test_info.test_id = DONT_CONVERT_RECEIVE;
+            receive_data = test_dont_convert_receive_data;
+            array_size = ARRAY_SIZE(test_dont_convert_receive_data);
+        }
+
+        for (i = 0; i < array_size; i++)
+        {
+            const struct notify_test_receive *data = receive_data + i;
+            notify_test_info.sub_test_id = i;
+
+            memset(para->ptr, 0, para->size);
+            if (para->mask) *para->mask = para->required_mask;
+            if (data->send_text)
+            {
+                memcpy(buffer, data->send_text, data->send_text_size);
+                *para->text = buffer;
+            }
+            if (para->text_max) *para->text_max = data->send_text_max;
+            send_notify(pager, para->code_unicode, para->code_ansi, (LPARAM)para->ptr, TRUE);
+            if (data->return_text)
+            {
+                if (para->flags & CONVERT_RECEIVE)
+                    ok(!lstrcmpW(data->return_text, *para->text), "Code 0x%08x sub test %d expect %s, got %s\n",
+                       para->code_unicode, i, wine_dbgstr_w((WCHAR *)data->return_text), wine_dbgstr_w(*para->text));
+                else
+                    ok(!lstrcmpA(data->return_text, (CHAR *)*para->text), "Code 0x%08x sub test %d expect %s, got %s\n",
+                       para->code_unicode, i, (CHAR *)data->return_text, (CHAR *)*para->text);
+            }
+            if (para->text_max)
+                ok(data->return_text_max == *para->text_max, "Code 0x%08x sub test %d expect %d, got %d\n",
+                   para->code_unicode, i, data->return_text_max, *para->text_max);
+        }
+    }
+
+    /* Extra tests for other behavior flags that are not worth it to create their own test arrays */
+    memset(para->ptr, 0, para->size);
+    if (para->mask) *para->mask = para->required_mask;
+    if (para->text_max) *para->text_max = 1;
+    if (para->flags & SEND_EMPTY_IF_NULL)
+        notify_test_info.test_id = SEND_EMPTY_IF_NULL;
+    else
+        notify_test_info.test_id = DONT_SEND_EMPTY_IF_NULL;
+    send_notify(pager, para->code_unicode, para->code_ansi, (LPARAM)para->ptr, TRUE);
+
+    notify_test_info.test_id = SET_NULL_IF_NO_MASK;
+    memset(para->ptr, 0, para->size);
+    memset(buffer, 0, sizeof(buffer));
+    *para->text = buffer;
+    if (para->text_max) *para->text_max = ARRAY_SIZE(buffer);
+    send_notify(pager, para->code_unicode, para->code_ansi, (LPARAM)para->ptr, TRUE);
+    if(para->flags & SET_NULL_IF_NO_MASK)
+        ok(!*para->text, "Expect null text\n");
+}
+
+static void test_wm_notify_comboboxex(HWND pager)
+{
+    static NMCBEDRAGBEGINW nmcbedb;
+    static NMCBEENDEDITW nmcbeed;
+
+    /* CBEN_DRAGBEGIN */
+    memset(&nmcbedb, 0, sizeof(nmcbedb));
+    memcpy(nmcbedb.szText, test_w, sizeof(test_w));
+    send_notify(pager, CBEN_DRAGBEGINW, CBEN_DRAGBEGINA, (LPARAM)&nmcbedb, FALSE);
+    ok(!lstrcmpW(nmcbedb.szText, test_w), "Expect %s, got %s\n", wine_dbgstr_w(test_w), wine_dbgstr_w(nmcbedb.szText));
+
+    /* CBEN_ENDEDIT */
+    memset(&nmcbeed, 0, sizeof(nmcbeed));
+    memcpy(nmcbeed.szText, test_w, sizeof(test_w));
+    send_notify(pager, CBEN_ENDEDITW, CBEN_ENDEDITA, (LPARAM)&nmcbeed, FALSE);
+    ok(!lstrcmpW(nmcbeed.szText, test_w), "Expect %s, got %s\n", wine_dbgstr_w(test_w), wine_dbgstr_w(nmcbeed.szText));
+}
+
+static void test_wm_notify_datetime(HWND pager)
+{
+    const struct notify_test_datetime_format *data;
+    NMDATETIMEFORMATW nmdtf;
+    INT i;
+
+    for (i = 0; i < ARRAY_SIZE(test_datetime_format_data); i++)
+    {
+        data = test_datetime_format_data + i;
+        notify_test_info.sub_test_id = i;
+
+        memset(&nmdtf, 0, sizeof(nmdtf));
+        if(data->send_pszformat) nmdtf.pszFormat = data->send_pszformat;
+        nmdtf.pszDisplay = nmdtf.szDisplay;
+        send_notify(pager, DTN_FORMATW, DTN_FORMATA, (LPARAM)&nmdtf, TRUE);
+        if (data->return_szdisplay)
+            ok(!lstrcmpW(nmdtf.szDisplay, data->return_szdisplay), "Sub test %d expect %s, got %s\n", i,
+               wine_dbgstr_w(data->return_szdisplay), wine_dbgstr_w(nmdtf.szDisplay));
+        if (data->return_pszdisplay)
+            ok(!lstrcmpW(nmdtf.pszDisplay, data->return_pszdisplay), "Sub test %d expect %s, got %s\n", i,
+               wine_dbgstr_w(data->return_pszdisplay), wine_dbgstr_w(nmdtf.pszDisplay));
+    }
+}
+
+static void test_wm_notify_header(HWND pager)
+{
+    NMHEADERW nmh = {{0}};
+    HDITEMW hdi = {0};
+    HD_TEXTFILTERW hdtf = {0};
+
+    hdi.mask = HDI_TEXT | HDI_FILTER;
+    hdi.pszText = test_w;
+    hdtf.pszText = test_w;
+    nmh.pitem = &hdi;
+    nmh.pitem->pvFilter = &hdtf;
+    send_notify(pager, HDN_BEGINDRAG, HDN_BEGINDRAG, (LPARAM)&nmh, TRUE);
+    send_notify(pager, HDN_ENDDRAG, HDN_ENDDRAG, (LPARAM)&nmh, TRUE);
+    send_notify(pager, HDN_BEGINFILTEREDIT, HDN_BEGINFILTEREDIT, (LPARAM)&nmh, TRUE);
+    send_notify(pager, HDN_ENDFILTEREDIT, HDN_ENDFILTEREDIT, (LPARAM)&nmh, TRUE);
+    send_notify(pager, HDN_DROPDOWN, HDN_DROPDOWN, (LPARAM)&nmh, TRUE);
+    send_notify(pager, HDN_FILTERCHANGE, HDN_FILTERCHANGE, (LPARAM)&nmh, TRUE);
+    send_notify(pager, HDN_ITEMKEYDOWN, HDN_ITEMKEYDOWN, (LPARAM)&nmh, TRUE);
+    send_notify(pager, HDN_ITEMSTATEICONCLICK, HDN_ITEMSTATEICONCLICK, (LPARAM)&nmh, TRUE);
+    send_notify(pager, HDN_OVERFLOWCLICK, HDN_OVERFLOWCLICK, (LPARAM)&nmh, TRUE);
+    send_notify(pager, HDN_BEGINTRACKW, HDN_BEGINTRACKA, (LPARAM)&nmh, TRUE);
+    send_notify(pager, HDN_DIVIDERDBLCLICKW, HDN_DIVIDERDBLCLICKA, (LPARAM)&nmh, TRUE);
+    send_notify(pager, HDN_ENDTRACKW, HDN_ENDTRACKA, (LPARAM)&nmh, TRUE);
+    send_notify(pager, HDN_ITEMCHANGEDW, HDN_ITEMCHANGEDA, (LPARAM)&nmh, TRUE);
+    send_notify(pager, HDN_ITEMCHANGINGW, HDN_ITEMCHANGINGA, (LPARAM)&nmh, TRUE);
+    send_notify(pager, HDN_ITEMCLICKW, HDN_ITEMCLICKA, (LPARAM)&nmh, TRUE);
+    send_notify(pager, HDN_ITEMDBLCLICKW, HDN_ITEMDBLCLICKA, (LPARAM)&nmh, TRUE);
+    send_notify(pager, HDN_TRACKW, HDN_TRACKA, (LPARAM)&nmh, TRUE);
+}
+
+static void test_wm_notify_tooltip(HWND pager)
+{
+    NMTTDISPINFOW nmttdi;
+    const struct notify_test_tooltip *data;
+    INT i;
+
+    for (i = 0; i < ARRAY_SIZE(test_tooltip_data); i++)
+    {
+        data = test_tooltip_data + i;
+        notify_test_info.sub_test_id = i;
+
+        memset(&nmttdi, 0, sizeof(nmttdi));
+        if (data->send_sztext) memcpy(nmttdi.szText, data->send_sztext, data->send_sztext_size);
+        if (data->send_lpsztext) nmttdi.lpszText = data->send_lpsztext;
+        send_notify(pager, TTN_GETDISPINFOW, TTN_GETDISPINFOA, (LPARAM)&nmttdi, FALSE);
+        if (data->return_sztext)
+        {
+            if (data->return_sztext_size == -1)
+                ok(!lstrcmpW(nmttdi.szText, data->return_sztext), "Sub test %d expect %s, got %s\n", i,
+                   wine_dbgstr_w(data->return_sztext), wine_dbgstr_w(nmttdi.szText));
+            else
+                ok(!memcmp(nmttdi.szText, data->return_sztext, data->return_sztext_size), "Wrong szText content\n");
+        }
+        if (data->return_lpsztext)
+        {
+            if (IS_INTRESOURCE(data->return_lpsztext))
+                ok(nmttdi.lpszText == data->return_lpsztext, "Sub test %d expect %s, got %s\n", i,
+                   wine_dbgstr_w(data->return_lpsztext), wine_dbgstr_w(nmttdi.lpszText));
+            else
+                ok(!lstrcmpW(nmttdi.lpszText, data->return_lpsztext), "Test %d expect %s, got %s\n", i,
+                   wine_dbgstr_w(data->return_lpsztext), wine_dbgstr_w(nmttdi.lpszText));
+        }
+        if (data->return_hinst)
+            ok(nmttdi.hinst == data->return_hinst, "Sub test %d expect %p, got %p\n", i, data->return_hinst,
+               nmttdi.hinst);
+    }
+}
+
+static void test_wm_notify(void)
+{
+    static const CHAR *class = "Pager notify class";
+    HWND parent, pager;
+    /* Combo Box Ex */
+    static NMCOMBOBOXEXW nmcbe;
+    /* Date and Time Picker */
+    static NMDATETIMEFORMATQUERYW nmdtfq;
+    static NMDATETIMEWMKEYDOWNW nmdtkd;
+    static NMDATETIMESTRINGW nmdts;
+    /* Header */
+    static NMHDDISPINFOW nmhddi;
+    /* List View */
+    static NMLVDISPINFOW nmlvdi;
+    static NMLVGETINFOTIPW nmlvgit;
+    static NMLVFINDITEMW nmlvfi;
+    /* Tool Bar */
+    static NMTBRESTORE nmtbr;
+    static NMTBSAVE nmtbs;
+    static NMTOOLBARW nmtb;
+    static NMTBDISPINFOW nmtbdi;
+    static NMTBGETINFOTIPW nmtbgit;
+    /* Tree View */
+    static NMTVDISPINFOW nmtvdi;
+    static NMTVGETINFOTIPW nmtvgit;
+    static NMTREEVIEWW nmtv;
+    static const struct generic_text_helper_para paras[] =
+    {
+        /* Combo Box Ex */
+        {&nmcbe, sizeof(nmcbe), &nmcbe.ceItem.mask, CBEIF_TEXT, &nmcbe.ceItem.pszText, &nmcbe.ceItem.cchTextMax,
+         CBEN_INSERTITEM, CBEN_INSERTITEM, DONT_CONVERT_SEND | DONT_CONVERT_RECEIVE},
+        {&nmcbe, sizeof(nmcbe), &nmcbe.ceItem.mask, CBEIF_TEXT, &nmcbe.ceItem.pszText, &nmcbe.ceItem.cchTextMax,
+         CBEN_DELETEITEM, CBEN_DELETEITEM, DONT_CONVERT_SEND | DONT_CONVERT_RECEIVE},
+        {&nmcbe, sizeof(nmcbe), &nmcbe.ceItem.mask, CBEIF_TEXT, &nmcbe.ceItem.pszText, &nmcbe.ceItem.cchTextMax,
+         CBEN_GETDISPINFOW, CBEN_GETDISPINFOA, ZERO_SEND | SET_NULL_IF_NO_MASK | DONT_CONVERT_SEND | CONVERT_RECEIVE},
+        /* Date and Time Picker */
+        {&nmdtfq, sizeof(nmdtfq), NULL, 0, (WCHAR **)&nmdtfq.pszFormat, NULL, DTN_FORMATQUERYW, DTN_FORMATQUERYA,
+         CONVERT_SEND},
+        {&nmdtkd, sizeof(nmdtkd), NULL, 0, (WCHAR **)&nmdtkd.pszFormat, NULL, DTN_WMKEYDOWNW, DTN_WMKEYDOWNA,
+         CONVERT_SEND},
+        {&nmdts, sizeof(nmdts), NULL, 0, (WCHAR **)&nmdts.pszUserString, NULL, DTN_USERSTRINGW, DTN_USERSTRINGA,
+         CONVERT_SEND},
+        /* Header */
+        {&nmhddi, sizeof(nmhddi), &nmhddi.mask, HDI_TEXT, &nmhddi.pszText, &nmhddi.cchTextMax, HDN_GETDISPINFOW,
+         HDN_GETDISPINFOA, SEND_EMPTY_IF_NULL | CONVERT_SEND | CONVERT_RECEIVE},
+        /* List View */
+        {&nmlvfi, sizeof(nmlvfi), &nmlvfi.lvfi.flags, LVFI_STRING, (WCHAR **)&nmlvfi.lvfi.psz, NULL,
+         LVN_INCREMENTALSEARCHW, LVN_INCREMENTALSEARCHA, CONVERT_SEND},
+        {&nmlvfi, sizeof(nmlvfi), &nmlvfi.lvfi.flags, LVFI_SUBSTRING, (WCHAR **)&nmlvfi.lvfi.psz, NULL, LVN_ODFINDITEMW,
+         LVN_ODFINDITEMA, CONVERT_SEND},
+        {&nmlvdi, sizeof(nmlvdi), &nmlvdi.item.mask, LVIF_TEXT, &nmlvdi.item.pszText, &nmlvdi.item.cchTextMax,
+         LVN_BEGINLABELEDITW, LVN_BEGINLABELEDITA, SET_NULL_IF_NO_MASK | CONVERT_SEND | CONVERT_RECEIVE},
+        {&nmlvdi, sizeof(nmlvdi), &nmlvdi.item.mask, LVIF_TEXT, &nmlvdi.item.pszText, &nmlvdi.item.cchTextMax,
+         LVN_ENDLABELEDITW, LVN_ENDLABELEDITA, SET_NULL_IF_NO_MASK | CONVERT_SEND | CONVERT_RECEIVE},
+        {&nmlvdi, sizeof(nmlvdi), &nmlvdi.item.mask, LVIF_TEXT, &nmlvdi.item.pszText, &nmlvdi.item.cchTextMax,
+         LVN_GETDISPINFOW, LVN_GETDISPINFOA, DONT_CONVERT_SEND | CONVERT_RECEIVE},
+        {&nmlvdi, sizeof(nmlvdi), &nmlvdi.item.mask, LVIF_TEXT, &nmlvdi.item.pszText, &nmlvdi.item.cchTextMax,
+         LVN_SETDISPINFOW, LVN_SETDISPINFOA, SET_NULL_IF_NO_MASK | CONVERT_SEND | CONVERT_RECEIVE},
+        {&nmlvgit, sizeof(nmlvgit), NULL, 0, &nmlvgit.pszText, &nmlvgit.cchTextMax, LVN_GETINFOTIPW, LVN_GETINFOTIPA,
+         CONVERT_SEND | CONVERT_RECEIVE},
+        /* Tool Bar */
+        {&nmtbs, sizeof(nmtbs), NULL, 0, (WCHAR **)&nmtbs.tbButton.iString, NULL, TBN_SAVE, TBN_SAVE,
+         DONT_CONVERT_SEND | DONT_CONVERT_RECEIVE},
+        {&nmtbr, sizeof(nmtbr), NULL, 0, (WCHAR **)&nmtbr.tbButton.iString, NULL, TBN_RESTORE, TBN_RESTORE,
+         DONT_CONVERT_SEND | DONT_CONVERT_RECEIVE},
+        {&nmtbdi, sizeof(nmtbdi), &nmtbdi.dwMask, TBNF_TEXT, &nmtbdi.pszText, &nmtbdi.cchText, TBN_GETDISPINFOW,
+         TBN_GETDISPINFOW, DONT_CONVERT_SEND | DONT_CONVERT_RECEIVE},
+        {&nmtb, sizeof(nmtb), NULL, 0, &nmtb.pszText, &nmtb.cchText, TBN_GETBUTTONINFOW, TBN_GETBUTTONINFOA,
+         SEND_EMPTY_IF_NULL | CONVERT_SEND | CONVERT_RECEIVE},
+        {&nmtbgit, sizeof(nmtbgit), NULL, 0, &nmtbgit.pszText, &nmtbgit.cchTextMax, TBN_GETINFOTIPW, TBN_GETINFOTIPA,
+         DONT_CONVERT_SEND | CONVERT_RECEIVE},
+        /* Tree View */
+        {&nmtvdi, sizeof(nmtvdi), &nmtvdi.item.mask, TVIF_TEXT, &nmtvdi.item.pszText, &nmtvdi.item.cchTextMax,
+         TVN_BEGINLABELEDITW, TVN_BEGINLABELEDITA, SET_NULL_IF_NO_MASK | CONVERT_SEND | CONVERT_RECEIVE},
+        {&nmtvdi, sizeof(nmtvdi), &nmtvdi.item.mask, TVIF_TEXT, &nmtvdi.item.pszText, &nmtvdi.item.cchTextMax,
+         TVN_ENDLABELEDITW, TVN_ENDLABELEDITA, SET_NULL_IF_NO_MASK | CONVERT_SEND | CONVERT_RECEIVE},
+        {&nmtvdi, sizeof(nmtvdi), &nmtvdi.item.mask, TVIF_TEXT, &nmtvdi.item.pszText, &nmtvdi.item.cchTextMax,
+         TVN_GETDISPINFOW, TVN_GETDISPINFOA, ZERO_SEND | DONT_CONVERT_SEND| CONVERT_RECEIVE},
+        {&nmtvdi, sizeof(nmtvdi), &nmtvdi.item.mask, TVIF_TEXT, &nmtvdi.item.pszText, &nmtvdi.item.cchTextMax,
+         TVN_SETDISPINFOW, TVN_SETDISPINFOA, SET_NULL_IF_NO_MASK | CONVERT_SEND | CONVERT_RECEIVE},
+        {&nmtvgit, sizeof(nmtvgit), NULL, 0, &nmtvgit.pszText, &nmtvgit.cchTextMax, TVN_GETINFOTIPW, TVN_GETINFOTIPA,
+         DONT_CONVERT_SEND | CONVERT_RECEIVE},
+        {&nmtv, sizeof(nmtv), &nmtv.itemNew.mask, TVIF_TEXT, &nmtv.itemNew.pszText, &nmtv.itemNew.cchTextMax,
+         TVN_SINGLEEXPAND, TVN_SINGLEEXPAND, DONT_CONVERT_SEND | DONT_CONVERT_RECEIVE, TVITEM_NEW_HANDLER},
+        {&nmtv, sizeof(nmtv), &nmtv.itemOld.mask, TVIF_TEXT, &nmtv.itemOld.pszText, &nmtv.itemOld.cchTextMax,
+         TVN_SINGLEEXPAND, TVN_SINGLEEXPAND, DONT_CONVERT_SEND | DONT_CONVERT_RECEIVE, TVITEM_OLD_HANDLER},
+        {&nmtv, sizeof(nmtv), &nmtv.itemNew.mask, TVIF_TEXT, &nmtv.itemNew.pszText, &nmtv.itemNew.cchTextMax,
+         TVN_BEGINDRAGW, TVN_BEGINDRAGA, CONVERT_SEND, TVITEM_NEW_HANDLER},
+        {&nmtv, sizeof(nmtv), &nmtv.itemOld.mask, TVIF_TEXT, &nmtv.itemOld.pszText, &nmtv.itemOld.cchTextMax,
+         TVN_BEGINDRAGW, TVN_BEGINDRAGA, DONT_CONVERT_SEND, TVITEM_OLD_HANDLER},
+        {&nmtv, sizeof(nmtv), &nmtv.itemNew.mask, TVIF_TEXT, &nmtv.itemNew.pszText, &nmtv.itemNew.cchTextMax,
+         TVN_BEGINRDRAGW, TVN_BEGINRDRAGA, CONVERT_SEND, TVITEM_NEW_HANDLER},
+        {&nmtv, sizeof(nmtv), &nmtv.itemOld.mask, TVIF_TEXT, &nmtv.itemOld.pszText, &nmtv.itemOld.cchTextMax,
+         TVN_BEGINRDRAGW, TVN_BEGINRDRAGA, DONT_CONVERT_SEND, TVITEM_OLD_HANDLER},
+        {&nmtv, sizeof(nmtv), &nmtv.itemNew.mask, TVIF_TEXT, &nmtv.itemNew.pszText, &nmtv.itemNew.cchTextMax,
+         TVN_ITEMEXPANDEDW, TVN_ITEMEXPANDEDA, CONVERT_SEND, TVITEM_NEW_HANDLER},
+        {&nmtv, sizeof(nmtv), &nmtv.itemOld.mask, TVIF_TEXT, &nmtv.itemOld.pszText, &nmtv.itemOld.cchTextMax,
+         TVN_ITEMEXPANDEDW, TVN_ITEMEXPANDEDA, DONT_CONVERT_SEND, TVITEM_OLD_HANDLER},
+        {&nmtv, sizeof(nmtv), &nmtv.itemNew.mask, TVIF_TEXT, &nmtv.itemNew.pszText, &nmtv.itemNew.cchTextMax,
+         TVN_ITEMEXPANDINGW, TVN_ITEMEXPANDINGA, CONVERT_SEND, TVITEM_NEW_HANDLER},
+        {&nmtv, sizeof(nmtv), &nmtv.itemOld.mask, TVIF_TEXT, &nmtv.itemOld.pszText, &nmtv.itemOld.cchTextMax,
+         TVN_ITEMEXPANDINGW, TVN_ITEMEXPANDINGA, DONT_CONVERT_SEND, TVITEM_OLD_HANDLER},
+        {&nmtv, sizeof(nmtv), &nmtv.itemNew.mask, TVIF_TEXT, &nmtv.itemNew.pszText, &nmtv.itemNew.cchTextMax,
+         TVN_DELETEITEMW, TVN_DELETEITEMA, DONT_CONVERT_SEND, TVITEM_NEW_HANDLER},
+        {&nmtv, sizeof(nmtv), &nmtv.itemOld.mask, TVIF_TEXT, &nmtv.itemOld.pszText, &nmtv.itemOld.cchTextMax,
+         TVN_DELETEITEMW, TVN_DELETEITEMA, CONVERT_SEND, TVITEM_OLD_HANDLER},
+        {&nmtv, sizeof(nmtv), &nmtv.itemNew.mask, TVIF_TEXT, &nmtv.itemNew.pszText, &nmtv.itemNew.cchTextMax,
+         TVN_SELCHANGINGW, TVN_SELCHANGINGA, CONVERT_SEND, TVITEM_NEW_HANDLER},
+        {&nmtv, sizeof(nmtv), &nmtv.itemOld.mask, TVIF_TEXT, &nmtv.itemOld.pszText, &nmtv.itemOld.cchTextMax,
+         TVN_SELCHANGINGW, TVN_SELCHANGINGA, CONVERT_SEND, TVITEM_OLD_HANDLER},
+        {&nmtv, sizeof(nmtv), &nmtv.itemNew.mask, TVIF_TEXT, &nmtv.itemNew.pszText, &nmtv.itemNew.cchTextMax,
+         TVN_SELCHANGEDW, TVN_SELCHANGEDA, CONVERT_SEND, TVITEM_NEW_HANDLER},
+        {&nmtv, sizeof(nmtv), &nmtv.itemOld.mask, TVIF_TEXT, &nmtv.itemOld.pszText, &nmtv.itemOld.cchTextMax,
+         TVN_SELCHANGEDW, TVN_SELCHANGEDA, CONVERT_SEND, TVITEM_OLD_HANDLER}
+    };
+    INT i;
+
+    ok(register_test_notify_class(), "Register test class failed, error 0x%08x\n", GetLastError());
+
+    parent = CreateWindowA(class, "parent", WS_OVERLAPPED, 0, 0, 100, 100, 0, 0, GetModuleHandleA(0), 0);
+    ok(parent != NULL, "CreateWindow failed\n");
+    pager = CreateWindowA(WC_PAGESCROLLERA, "pager", WS_CHILD, 0, 0, 100, 100, parent, 0, GetModuleHandleA(0), 0);
+    ok(pager != NULL, "CreateWindow failed\n");
+    child1_wnd = CreateWindowA(class, "child", WS_CHILD, 0, 0, 100, 100, pager, (HMENU)1, GetModuleHandleA(0), 0);
+    ok(child1_wnd != NULL, "CreateWindow failed\n");
+    SendMessageW(pager, PGM_SETCHILD, 0, (LPARAM)child1_wnd);
+
+    for (i = 0; i < ARRAY_SIZE(paras); i++)
+        test_notify_generic_text_helper(pager, paras + i);
+
+    /* Tests for those that can't be covered by generic text test helper */
+    test_wm_notify_comboboxex(pager);
+    test_wm_notify_datetime(pager);
+    test_wm_notify_header(pager);
+    test_wm_notify_tooltip(pager);
+
+    DestroyWindow(parent);
+    UnregisterClassA(class, GetModuleHandleA(NULL));
+}
+
+static void init_functions(void)
+{
+    HMODULE mod = LoadLibraryA("comctl32.dll");
+
+#define X(f) p##f = (void*)GetProcAddress(mod, #f);
+    X(InitCommonControlsEx);
+#undef X
 
     pSetWindowSubclass = (void*)GetProcAddress(mod, (LPSTR)410);
+}
+
+START_TEST(pager)
+{
+    INITCOMMONCONTROLSEX iccex;
+
+    init_functions();
+
+    iccex.dwSize = sizeof(iccex);
+    iccex.dwICC = ICC_PAGESCROLLER_CLASS;
+    pInitCommonControlsEx(&iccex);
 
     init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
 
@@ -345,4 +1332,8 @@ START_TEST(pager)
     ok(parent_wnd != NULL, "Failed to create parent window!\n");
 
     test_pager();
+    test_wm_notifyformat();
+    test_wm_notify();
+
+    DestroyWindow(parent_wnd);
 }