On Mon Oct 16 13:27:21 2023 +0000, Jinoh Kang wrote:
Hm, now I understand what you mean. In the `pass_msg_to_real_class_wndproc = 0` case, we're not really testing NtUserSetRealClassId at all. We're merely testing RealGetWindowClass against *slightly* different (mostly just `cbWndExtra` and `style`) classes, all with the same class name (`"SuperClass Test"`) as well as the same wndproc behavior (simply delegates to `DefWindowProcW()`, except for `WM_NCCREATE`). The `pass_msg_to_real_class_wndproc = 0` case should simply be factored out of `test_real_class_name` and be tested separately, instead of being tested for every built-in class (which doesn't make a difference since its builtin wndproc is being ignored).
In short,
```c test_real_class_name() { for (i = 0; i < 2; i++) { pass_msg_to_real_class_wndproc = i; if (!i) test_hwnd_real_class_name_a_w(hwnd, SUPER_CLASS_NAME_W, SUPER_CLASS_NAME_A); else test_hwnd_real_class_name_a_w(hwnd, class_test->real_class_name_w, class_test->real_class_name_a);
} }
test_real_class_names() { for (i = 0; i < tests_count; i++) test_real_class_name(); } ```
This should be just
```c test_real_class_name() { for (i = 0; i < 2; i++) { test_hwnd_real_class_name_a_w(hwnd, class_test->real_class_name_w, class_test->real_class_name_a);
} }
test_real_class_names() { pass_msg_to_real_class_wndproc = 0; test_hwnd_real_class_name_a_w(hwnd, SUPER_CLASS_NAME_W, SUPER_CLASS_NAME_A);
pass_msg_to_real_class_wndproc = 1; for (i = 0; i < tests_count; i++) { test_real_class_name(); } } ```
Note that the `pass_msg_to_real_class_wndproc = 0` case is being tested only once in the latter code snippet.