@whydoubt @madewokherd Would you like to take a look at this PR? It is line breaking feature, described here: https://learn.microsoft.com/en-us/previous-versions/windows/internet-explore...)
For Unicode, breaking alghoritm is described here: http://unicode.org/reports/tr14/
and it is starting point for resolving bug: https://bugs.winehq.org/show_bug.cgi?id=32126
-- v3: mlang/tests: add test cases for IMLangLineBreakConsole_BreakLineA
From: Bartosz Kosiorek gang65@poczta.onet.pl
--- dlls/mlang/tests/Makefile.in | 3 +- dlls/mlang/tests/linebreakconsole.c | 110 ++++++++++++++++++++++++++++ 2 files changed, 112 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..751387b5579 --- /dev/null +++ b/dlls/mlang/tests/linebreakconsole.c @@ -0,0 +1,110 @@ +/* + * Unit test suite for MLANG APIs. + * + * Copyright 2004 Dmitry Timoshkov + * Copyright 2009 Detlef Riekenberg + * + * 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 = CP_USASCII; + CHAR pszSrc[100]; + LONG cchMax = 20; + LONG cMaxColumns; + LONG cchLine, cchSkip; + HRESULT res; + + // res = StringCchLengthA(pszSrc, cchMax, &cchLength); + uCodePage = CP_USASCII; + cMaxColumns = 10; + pszSrc[100] = "StringWithoutAnySpaces"; + res = IMLangLineBreakConsole_BreakLineA(mlbc, locale, uCodePage, pszSrc, cchMax, cMaxColumns, &cchLine, &cchSkip); + ok(res == S_OK, "got %08lx\n", res); + ok(cchLine == 20, "got %li\n", cchLine); + ok(cchSkip == 0, "got %li\n", cchSkip); + + pszSrc[100] = " String With Spaces"; + 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); + + pszSrc[100] = " First line with spaces"; + 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); + + pszSrc[100] = "\tString \t\tWith\tSpaces\tAndTabs"; + 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); + + pszSrc[100] = ",String, ,With,Commas and Spaces"; + 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); + + pszSrc[100] = " S t r i n g S i n g l e l e t t e r "; + 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); + + uCodePage = 10; // Some random value + pszSrc[100] = "StringWithoutAnySpaces"; + res = IMLangLineBreakConsole_BreakLineA(mlbc, locale, uCodePage, pszSrc, cchMax, cMaxColumns, &cchLine, &cchSkip); + ok(res == S_OK, "got %08lx\n", res); + ok(cchLine == 20, "got %li\n", cchLine); + ok(cchSkip == 0, "got %li\n", cchSkip); + +} + +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(); +}
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=137868
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 3 linebreakconsole.c:57: Test failed: got 3 linebreakconsole.c:63: Test failed: got 3 linebreakconsole.c:69: Test failed: got 3 linebreakconsole.c:75: Test failed: got 3 linebreakconsole.c:81: Test failed: got 3 linebreakconsole.c:87: Test failed: got 80004005 linebreakconsole.c:88: Test failed: got 0
=== w7u_adm (32 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 3 linebreakconsole.c:57: Test failed: got 3 linebreakconsole.c:63: Test failed: got 3 linebreakconsole.c:69: Test failed: got 3 linebreakconsole.c:75: Test failed: got 3 linebreakconsole.c:81: Test failed: got 3 linebreakconsole.c:87: Test failed: got 80004005 linebreakconsole.c:88: Test failed: got 0
=== w7u_el (32 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 3 linebreakconsole.c:57: Test failed: got 3 linebreakconsole.c:63: Test failed: got 3 linebreakconsole.c:69: Test failed: got 3 linebreakconsole.c:75: Test failed: got 3 linebreakconsole.c:81: Test failed: got 3 linebreakconsole.c:87: Test failed: got 80004005 linebreakconsole.c:88: Test failed: got 0
=== w8 (32 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 0 linebreakconsole.c:57: Test failed: got 0 linebreakconsole.c:63: Test failed: got 0 linebreakconsole.c:69: Test failed: got 0 linebreakconsole.c:75: Test failed: got 0 linebreakconsole.c:81: Test failed: got 0 linebreakconsole.c:88: Test failed: got 0
=== w8adm (32 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 0 linebreakconsole.c:57: Test failed: got 0 linebreakconsole.c:63: Test failed: got 0 linebreakconsole.c:69: Test failed: got 0 linebreakconsole.c:75: Test failed: got 0 linebreakconsole.c:81: Test failed: got 0 linebreakconsole.c:88: Test failed: got 0
=== w864 (32 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 0 linebreakconsole.c:57: Test failed: got 0 linebreakconsole.c:63: Test failed: got 0 linebreakconsole.c:69: Test failed: got 0 linebreakconsole.c:75: Test failed: got 0 linebreakconsole.c:81: Test failed: got 0 linebreakconsole.c:88: Test failed: got 0
=== w1064v1507 (32 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 4 linebreakconsole.c:57: Test failed: got 4 linebreakconsole.c:63: Test failed: got 4 linebreakconsole.c:69: Test failed: got 4 linebreakconsole.c:75: Test failed: got 4 linebreakconsole.c:81: Test failed: got 4 linebreakconsole.c:87: Test failed: got 80004005 linebreakconsole.c:88: Test failed: got 0
=== w1064v1809 (32 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 0 linebreakconsole.c:57: Test failed: got 0 linebreakconsole.c:63: Test failed: got 0 linebreakconsole.c:69: Test failed: got 0 linebreakconsole.c:75: Test failed: got 0 linebreakconsole.c:81: Test failed: got 0 linebreakconsole.c:88: Test failed: got 0
=== w1064_tsign (32 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 3 linebreakconsole.c:57: Test failed: got 3 linebreakconsole.c:63: Test failed: got 3 linebreakconsole.c:69: Test failed: got 3 linebreakconsole.c:75: Test failed: got 3 linebreakconsole.c:81: Test failed: got 3 linebreakconsole.c:87: Test failed: got 80004005 linebreakconsole.c:88: Test failed: got 0
=== w10pro64 (32 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 3 linebreakconsole.c:57: Test failed: got 3 linebreakconsole.c:63: Test failed: got 3 linebreakconsole.c:69: Test failed: got 3 linebreakconsole.c:75: Test failed: got 3 linebreakconsole.c:81: Test failed: got 3 linebreakconsole.c:87: Test failed: got 80004005 linebreakconsole.c:88: Test failed: got 0
=== w10pro64_en_AE_u8 (32 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 3 linebreakconsole.c:57: Test failed: got 3 linebreakconsole.c:63: Test failed: got 3 linebreakconsole.c:69: Test failed: got 3 linebreakconsole.c:75: Test failed: got 3 linebreakconsole.c:81: Test failed: got 3 linebreakconsole.c:87: Test failed: got 80004005 linebreakconsole.c:88: Test failed: got 0
=== w11pro64 (32 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 3 linebreakconsole.c:57: Test failed: got 3 linebreakconsole.c:63: Test failed: got 3 linebreakconsole.c:69: Test failed: got 3 linebreakconsole.c:75: Test failed: got 3 linebreakconsole.c:81: Test failed: got 3 linebreakconsole.c:87: Test failed: got 80004005 linebreakconsole.c:88: Test failed: got 0
=== w7pro64 (64 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 0 linebreakconsole.c:57: Test failed: got 0 linebreakconsole.c:63: Test failed: got 0 linebreakconsole.c:69: Test failed: got 0 linebreakconsole.c:75: Test failed: got 0 linebreakconsole.c:81: Test failed: got 0 linebreakconsole.c:88: Test failed: got 0
=== w864 (64 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 0 linebreakconsole.c:57: Test failed: got 0 linebreakconsole.c:63: Test failed: got 0 linebreakconsole.c:69: Test failed: got 0 linebreakconsole.c:75: Test failed: got 0 linebreakconsole.c:81: Test failed: got 0 linebreakconsole.c:88: Test failed: got 0
=== w1064v1507 (64 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 0 linebreakconsole.c:57: Test failed: got 0 linebreakconsole.c:63: Test failed: got 0 linebreakconsole.c:69: Test failed: got 0 linebreakconsole.c:75: Test failed: got 0 linebreakconsole.c:81: Test failed: got 0 linebreakconsole.c:88: Test failed: got 0
=== w1064v1809 (64 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 1 linebreakconsole.c:57: Test failed: got 1 linebreakconsole.c:63: Test failed: got 1 linebreakconsole.c:69: Test failed: got 1 linebreakconsole.c:75: Test failed: got 1 linebreakconsole.c:81: Test failed: got 1 linebreakconsole.c:87: Test failed: got 80004005 linebreakconsole.c:88: Test failed: got 0
=== w1064_2qxl (64 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 1 linebreakconsole.c:57: Test failed: got 1 linebreakconsole.c:63: Test failed: got 1 linebreakconsole.c:69: Test failed: got 1 linebreakconsole.c:75: Test failed: got 1 linebreakconsole.c:81: Test failed: got 1 linebreakconsole.c:87: Test failed: got 80004005 linebreakconsole.c:88: Test failed: got 0
=== w1064_adm (64 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 1 linebreakconsole.c:57: Test failed: got 1 linebreakconsole.c:63: Test failed: got 1 linebreakconsole.c:69: Test failed: got 1 linebreakconsole.c:75: Test failed: got 1 linebreakconsole.c:81: Test failed: got 1 linebreakconsole.c:87: Test failed: got 80004005 linebreakconsole.c:88: Test failed: got 0
=== w1064_tsign (64 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 1 linebreakconsole.c:57: Test failed: got 1 linebreakconsole.c:63: Test failed: got 1 linebreakconsole.c:69: Test failed: got 1 linebreakconsole.c:75: Test failed: got 1 linebreakconsole.c:81: Test failed: got 1 linebreakconsole.c:87: Test failed: got 80004005 linebreakconsole.c:88: Test failed: got 0
=== w10pro64 (64 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 1 linebreakconsole.c:57: Test failed: got 1 linebreakconsole.c:63: Test failed: got 1 linebreakconsole.c:69: Test failed: got 1 linebreakconsole.c:75: Test failed: got 1 linebreakconsole.c:81: Test failed: got 1 linebreakconsole.c:87: Test failed: got 80004005 linebreakconsole.c:88: Test failed: got 0
=== w10pro64_ar (64 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 1 linebreakconsole.c:57: Test failed: got 1 linebreakconsole.c:63: Test failed: got 1 linebreakconsole.c:69: Test failed: got 1 linebreakconsole.c:75: Test failed: got 1 linebreakconsole.c:81: Test failed: got 1 linebreakconsole.c:87: Test failed: got 80004005 linebreakconsole.c:88: Test failed: got 0
=== w10pro64_ja (64 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 1 linebreakconsole.c:57: Test failed: got 1 linebreakconsole.c:63: Test failed: got 1 linebreakconsole.c:69: Test failed: got 1 linebreakconsole.c:75: Test failed: got 1 linebreakconsole.c:81: Test failed: got 1 linebreakconsole.c:87: Test failed: got 80004005 linebreakconsole.c:88: Test failed: got 0
=== w10pro64_zh_CN (64 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 1 linebreakconsole.c:57: Test failed: got 1 linebreakconsole.c:63: Test failed: got 1 linebreakconsole.c:69: Test failed: got 1 linebreakconsole.c:75: Test failed: got 1 linebreakconsole.c:81: Test failed: got 1 linebreakconsole.c:87: Test failed: got 80004005 linebreakconsole.c:88: Test failed: got 0
=== w11pro64_amd (64 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 1 linebreakconsole.c:57: Test failed: got 1 linebreakconsole.c:63: Test failed: got 1 linebreakconsole.c:69: Test failed: got 1 linebreakconsole.c:75: Test failed: got 1 linebreakconsole.c:81: Test failed: got 1 linebreakconsole.c:87: Test failed: got 80004005 linebreakconsole.c:88: Test failed: got 0
=== debian11 (32 bit report) ===
mlang: linebreakconsole.c:51: Test failed: got 10
=== debian11 (32 bit ar:MA report) ===
mlang: linebreakconsole.c:51: Test failed: got 10
=== debian11 (32 bit de report) ===
mlang: linebreakconsole.c:51: Test failed: got 10
=== debian11 (32 bit fr report) ===
mlang: linebreakconsole.c:51: Test failed: got 10
=== debian11 (32 bit he:IL report) ===
mlang: linebreakconsole.c:51: Test failed: got 10
=== debian11 (32 bit hi:IN report) ===
mlang: linebreakconsole.c:51: Test failed: got 10
=== debian11 (32 bit ja:JP report) ===
mlang: linebreakconsole.c:51: Test failed: got 10
=== debian11 (32 bit zh:CN report) ===
mlang: linebreakconsole.c:51: Test failed: got 10
=== debian11b (32 bit WoW report) ===
mlang: linebreakconsole.c:51: Test failed: got 10
=== debian11b (64 bit WoW report) ===
mlang: linebreakconsole.c:51: Test failed: got 10
On Tue Sep 26 21:48:04 2023 +0000, Bartosz Kosiorek wrote:
changed this line in [version 3 of the diff](/wine/wine/-/merge_requests/3629/diffs?diff_id=72088&start_sha=225f205b42550a5ab22dfed9816cab1013d3261c#6600f7d8399779e0ebc6d7a55acde6d13b723210_48_50)
It appears that this test was simply removed. I think it would be better to have a CP_UNICODE test of some sort (refer to my initial comment on this thread).
Jeffrey Smith (@whydoubt) commented about dlls/mlang/tests/linebreakconsole.c:
+#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 = CP_USASCII;
You re-initialize this to the same value on line 46. Please pick one or the other.
Jeffrey Smith (@whydoubt) commented about dlls/mlang/tests/linebreakconsole.c:
+/*
- Unit test suite for MLANG APIs.
It wouldn't hurt to be more specific here.
This does not need another test .c file.
Jeffrey Smith (@whydoubt) commented about dlls/mlang/tests/linebreakconsole.c:
+/*
- Unit test suite for MLANG APIs.
- Copyright 2004 Dmitry Timoshkov
- Copyright 2009 Detlef Riekenberg
Unless these tests were essentially copies from somewhere else, this does not seem accurate. It should be replaced with your name (along with the current year).
On Tue Sep 26 22:30:21 2023 +0000, Nikolay Sivov wrote:
This does not need another test .c file.
I partially agree, as it is a very small set of tests to create a separate test .c file for. On the other hand, it is testing a different interface than the existing test .c file.
On Tue Sep 26 22:30:21 2023 +0000, Jeffrey Smith wrote:
I partially agree, as it is a very small set of tests to create a separate test .c file for. On the other hand, it is testing a different interface than the existing test .c file.
I would like to split tests per interface, to avoid huge files. Current mlang.c test file, already have 2800 lines of code.
I would like to extend these tests (and implementation) with next MR.
I would like to split tests per interface, to avoid huge files. Current mlang.c test file, already have 2800 lines of code. mlang.c implementation have almost 3800 lines of code.
Please don't. Large files are not much of an issue, and splitting by interface will lead to way too many files.
On Wed Sep 27 07:51:19 2023 +0000, Alexandre Julliard wrote:
I would like to split tests per interface, to avoid huge files.
Current mlang.c test file, already have 2800 lines of code. mlang.c implementation have almost 3800 lines of code. Please don't. Large files are not much of an issue, and splitting by interface will lead to way too many files.
I would say large files can be an issue AND too many files can be an issue, so you have to strike a balance. In the context of wine, 2800 lines isn't so bad. For tests I had thought the value of cohesive test modules might shift that balance (and mlang only has four interfaces so it seemed reasonable in the context of the module), but it's ultimately up to the Owner.