From: Jacob Czekalla <jczekalla(a)codeweavers.com> This is to handle tests where events could be called multiple times. For example, iframes being loaded during a navigate. --- dlls/mshtml/tests/htmldoc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c index c64ed784897..a37d94c48c9 100644 --- a/dlls/mshtml/tests/htmldoc.c +++ b/dlls/mshtml/tests/htmldoc.c @@ -61,19 +61,22 @@ extern const IID IID_IActiveScriptSite; #define SET_EXPECT(func) \ expect_ ## func = TRUE +#define SET_EXPECT_N(func, n) \ + do { called_ ## func = FALSE; expect_ ## func = n; } while(0) + #define SET_CALLED(func) \ called_ ## func = TRUE #define CHECK_EXPECT2(func) \ do { \ ok(expect_ ##func, "unexpected call " #func "\n"); \ - called_ ## func = TRUE; \ + called_ ## func += 1; \ }while(0) #define CHECK_EXPECT(func) \ do { \ CHECK_EXPECT2(func); \ - expect_ ## func = FALSE; \ + if (expect_ ## func > 0) expect_ ## func -= 1; \ }while(0) #define CHECK_CALLED(func) \ @@ -82,6 +85,12 @@ extern const IID IID_IActiveScriptSite; expect_ ## func = called_ ## func = FALSE; \ }while(0) +#define CHECK_CALLED_N(func, n) \ + do { \ + ok(called_ ## func == n, "expected " #func "\n"); \ + expect_ ## func = called_ ## func = FALSE; \ + }while(0) + #define CHECK_NOT_CALLED(func) \ do { \ ok(!called_ ## func, "unexpected " #func "\n"); \ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8761