[PATCH v6 0/1] MR3628: mlang/tests: add test cases for IMLangLineBreakConsole_BreakLineA
-- v6: mlang/tests: add test cases for IMLangLineBreakConsole_BreakLineA https://gitlab.winehq.org/wine/wine/-/merge_requests/3628
From: Bartosz Kosiorek <gang65(a)poczta.onet.pl> --- dlls/mlang/tests/Makefile.in | 3 +- dlls/mlang/tests/linebreakconsole.c | 136 ++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 dlls/mlang/tests/linebreakconsole.c diff --git a/dlls/mlang/tests/Makefile.in b/dlls/mlang/tests/Makefile.in index 21ec4b2465f..255a9d3ff33 100644 --- a/dlls/mlang/tests/Makefile.in +++ b/dlls/mlang/tests/Makefile.in @@ -2,4 +2,5 @@ TESTDLL = mlang.dll IMPORTS = mlang oleaut32 ole32 user32 gdi32 C_SRCS = \ - mlang.c + mlang.c \ + linebreakconsole.c diff --git a/dlls/mlang/tests/linebreakconsole.c b/dlls/mlang/tests/linebreakconsole.c new file mode 100644 index 00000000000..3f07234ec8a --- /dev/null +++ b/dlls/mlang/tests/linebreakconsole.c @@ -0,0 +1,136 @@ +/* + * Unit test suite for IMLangLineBreakConsole interface API. + * + * Copyright 2023 Bartosz Kosiorek + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS + +#include <stdarg.h> +#include <stdio.h> + +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "mlang.h" +#include "mimeole.h" + +#include "wine/test.h" + +static void test_BreakLineA(IMLangLineBreakConsole *mlbc) +{ + LCID locale = 1024; + UINT uCodePage; + CHAR *pszSrc = malloc(100); + LONG cchMax = 20; + LONG cMaxColumns; + LONG cchLine, cchSkip; + HRESULT res; + + cMaxColumns = 10; + uCodePage = CP_UNICODE; + strcpy(pszSrc, "چrińg Wi†h Póliśh ćharacterś"); + res = IMLangLineBreakConsole_BreakLineA(mlbc, locale, uCodePage, pszSrc, cchMax, cMaxColumns, &cchLine, &cchSkip); + todo_wine ok(res == E_FAIL, "got %08lx\n", res); + todo_wine ok(cchLine == 0, "got %li\n", cchLine); + ok(cchSkip == 0, "got %li\n", cchSkip); + + uCodePage = 10; // Some random value + strcpy(pszSrc, "String With strange codepage"); + res = IMLangLineBreakConsole_BreakLineA(mlbc, locale, uCodePage, pszSrc, cchMax, cMaxColumns, &cchLine, &cchSkip); + todo_wine ok(res == E_FAIL, "got %08lx\n", res); + todo_wine ok(cchLine == 0, "got %li\n", cchLine); + ok(cchSkip == 0, "got %li\n", cchSkip); + + uCodePage = CP_USASCII; + strcpy(pszSrc, "StringWithoutAnySpaces"); + res = IMLangLineBreakConsole_BreakLineA(mlbc, locale, uCodePage, pszSrc, cchMax, cMaxColumns, &cchLine, &cchSkip); + ok(res == S_OK, "got %08lx\n", res); + ok(cchLine == 10, "got %li\n", cchLine); + ok(cchSkip == 0, "got %li\n", cchSkip); + + /* Unicode characters */ + strcpy(pszSrc, "چrińg Wi†h Póliśh ćharacterś"); + res = IMLangLineBreakConsole_BreakLineA(mlbc, locale, uCodePage, pszSrc, cchMax, cMaxColumns, &cchLine, &cchSkip); + ok(res == S_OK, "got %08lx\n", res); + ok(cchLine == 10, "got %li\n", cchLine); + todo_wine ok((cchSkip == 0) || /* on machine with zh_CN Simplified Chinese Localization */ + (cchSkip == 1), "got %li\n", cchSkip); + + strcpy(pszSrc, " String With Many Spaces"); + res = IMLangLineBreakConsole_BreakLineA(mlbc, locale, uCodePage, pszSrc, cchMax, cMaxColumns, &cchLine, &cchSkip); + ok(res == S_OK, "got %08lx\n", res); + todo_wine ok(cchLine == 10, "got %li\n", cchLine); + todo_wine ok(cchSkip == 10, "got %li\n", cchSkip); + + strcpy(pszSrc, " Whole line with spaces"); + res = IMLangLineBreakConsole_BreakLineA(mlbc, locale, uCodePage, pszSrc, cchMax, cMaxColumns, &cchLine, &cchSkip); + ok(res == S_OK, "got %08lx\n", res); + ok(cchLine == 0, "got %li\n", cchLine); + todo_wine ok(cchSkip == 20, "got %li\n", cchSkip); + + strcpy(pszSrc, "\tString\t\t\tWith\tTabs"); + res = IMLangLineBreakConsole_BreakLineA(mlbc, locale, uCodePage, pszSrc, cchMax, cMaxColumns, &cchLine, &cchSkip); + ok(res == S_OK, "got %08lx\n", res); + todo_wine ok(cchLine == 7, "got %li\n", cchLine); + todo_wine ok(cchSkip == 3, "got %li\n", cchSkip); + + strcpy(pszSrc, "\tString \t\t With\tSpaces And Tabs"); + res = IMLangLineBreakConsole_BreakLineA(mlbc, locale, uCodePage, pszSrc, cchMax, cMaxColumns, &cchLine, &cchSkip); + ok(res == S_OK, "got %08lx\n", res); + todo_wine ok(cchLine == 7, "got %li\n", cchLine); + todo_wine ok(cchSkip == 4, "got %li\n", cchSkip); + + strcpy(pszSrc, "String\nWith\nNew\nLines"); + res = IMLangLineBreakConsole_BreakLineA(mlbc, locale, uCodePage, pszSrc, cchMax, cMaxColumns, &cchLine, &cchSkip); + ok(res == S_OK, "got %08lx\n", res); + todo_wine ok(cchLine == 6, "got %li\n", cchLine); + todo_wine ok(cchSkip == 1, "got %li\n", cchSkip); + + strcpy(pszSrc, "\nString\nWith\nNew\nLine at Beginning"); + res = IMLangLineBreakConsole_BreakLineA(mlbc, locale, uCodePage, pszSrc, cchMax, cMaxColumns, &cchLine, &cchSkip); + ok(res == S_OK, "got %08lx\n", res); + todo_wine ok(cchLine == 0, "got %li\n", cchLine); + todo_wine ok(cchSkip == 1, "got %li\n", cchSkip); + + strcpy(pszSrc, " S t r i n g S i n g l e L e t t e r s "); + res = IMLangLineBreakConsole_BreakLineA(mlbc, locale, uCodePage, pszSrc, cchMax, cMaxColumns, &cchLine, &cchSkip); + ok(res == S_OK, "got %08lx\n", res); + todo_wine ok(cchLine == 10, "got %li\n", cchLine); + ok(cchSkip == 1, "got %li\n", cchSkip); + + free(pszSrc); +} + +START_TEST(linebreakconsole) +{ + IMLangLineBreakConsole* pMLangLineBreakConsole = NULL; + HRESULT res; + + CoInitialize(NULL); + + trace("IMLangLineBreakConsole\n"); + res = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER, + &IID_IMLangLineBreakConsole, (void **)&pMLangLineBreakConsole); + if (res == S_OK) + { + test_BreakLineA(pMLangLineBreakConsole); + IMLangLineBreakConsole_Release(pMLangLineBreakConsole); + } + + CoUninitialize(); +} -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3628
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=136557 Your paranoid android. === debian11 (32 bit report) === mlang: linebreakconsole.c:71: Test succeeded inside todo block: got 0 === debian11 (32 bit ar:MA report) === mlang: linebreakconsole.c:71: Test succeeded inside todo block: got 0 === debian11 (32 bit de report) === mlang: linebreakconsole.c:71: Test succeeded inside todo block: got 0 === debian11 (32 bit fr report) === mlang: linebreakconsole.c:71: Test succeeded inside todo block: got 0 === debian11 (32 bit he:IL report) === mlang: linebreakconsole.c:71: Test succeeded inside todo block: got 0 === debian11 (32 bit hi:IN report) === mlang: linebreakconsole.c:71: Test succeeded inside todo block: got 0 === debian11 (32 bit ja:JP report) === mlang: linebreakconsole.c:71: Test succeeded inside todo block: got 0 === debian11 (32 bit zh:CN report) === mlang: linebreakconsole.c:71: Test succeeded inside todo block: got 0 === debian11b (32 bit WoW report) === mlang: linebreakconsole.c:71: Test succeeded inside todo block: got 0 === debian11b (64 bit WoW report) === mlang: linebreakconsole.c:71: Test succeeded inside todo block: got 0
This merge request was closed by Bartosz Kosiorek. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3628
participants (3)
-
Bartosz Kosiorek -
Bartosz Kosiorek (@gang65) -
Marvin