Skip to content

Commit f9b5138

Browse files
HBeluscaJoachimHenze
authored andcommitted
[0.4.12][GDI32] Do not 'hard-assert' during the font-unit-test
The goal of this is to revive the VBox-testbot that failed miserably like the VBox-one in https://build.reactos.org/#/builders/9/builds/24947 all the way through the 0.4.12RCs, because 0.4.12-dev was in a poor state upon branching. cherry picked from commit 0.4.13-dev-23-g 7334567
1 parent 27da885 commit f9b5138

File tree

1 file changed

+23
-11
lines changed
  • win32ss/gdi/gdi32/objects

1 file changed

+23
-11
lines changed

win32ss/gdi/gdi32/objects/font.c

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,7 +1311,7 @@ GetOutlineTextMetricsA(
13111311
else
13121312
output->otmpFullName = 0;
13131313

1314-
assert(left == 0);
1314+
ASSERT(left == 0);
13151315

13161316
if(output != lpOTM)
13171317
{
@@ -1701,6 +1701,13 @@ VOID DumpFamilyInfo(const FONTFAMILYINFO *Info, LONG Count)
17011701

17021702
VOID DoFontSystemUnittest(VOID)
17031703
{
1704+
#ifndef RTL_SOFT_ASSERT
1705+
#define RTL_SOFT_ASSERT(exp) \
1706+
(void)((!(exp)) ? \
1707+
DbgPrint("%s(%d): Soft assertion failed\n Expression: %s\n", __FILE__, __LINE__, #exp), FALSE : TRUE)
1708+
#define RTL_SOFT_ASSERT_defined
1709+
#endif
1710+
17041711
LOGFONTW LogFont;
17051712
FONTFAMILYINFO Info[4];
17061713
UNICODE_STRING Str1, Str2;
@@ -1715,8 +1722,8 @@ VOID DoFontSystemUnittest(VOID)
17151722
ret = NtGdiGetFontFamilyInfo(NULL, &LogFont, Info, &InfoCount);
17161723
DPRINT1("ret: %ld, InfoCount: %ld\n", ret, InfoCount);
17171724
DumpFamilyInfo(Info, ret);
1718-
ASSERT(ret == RTL_NUMBER_OF(Info));
1719-
ASSERT(InfoCount > 32);
1725+
RTL_SOFT_ASSERT(ret == RTL_NUMBER_OF(Info));
1726+
RTL_SOFT_ASSERT(InfoCount > 32);
17201727

17211728
/* L"Microsoft Sans Serif" ANSI_CHARSET */
17221729
RtlZeroMemory(&LogFont, sizeof(LogFont));
@@ -1726,19 +1733,19 @@ VOID DoFontSystemUnittest(VOID)
17261733
ret = NtGdiGetFontFamilyInfo(NULL, &LogFont, Info, &InfoCount);
17271734
DPRINT1("ret: %ld, InfoCount: %ld\n", ret, InfoCount);
17281735
DumpFamilyInfo(Info, ret);
1729-
ASSERT(ret != -1);
1730-
ASSERT(InfoCount > 0);
1731-
ASSERT(InfoCount < 16);
1736+
RTL_SOFT_ASSERT(ret != -1);
1737+
RTL_SOFT_ASSERT(InfoCount > 0);
1738+
RTL_SOFT_ASSERT(InfoCount < 16);
17321739

17331740
RtlInitUnicodeString(&Str1, Info[0].EnumLogFontEx.elfLogFont.lfFaceName);
17341741
RtlInitUnicodeString(&Str2, L"Microsoft Sans Serif");
17351742
ret = RtlCompareUnicodeString(&Str1, &Str2, TRUE);
1736-
ASSERT(ret == 0);
1743+
RTL_SOFT_ASSERT(ret == 0);
17371744

17381745
RtlInitUnicodeString(&Str1, Info[0].EnumLogFontEx.elfFullName);
17391746
RtlInitUnicodeString(&Str2, L"Tahoma");
17401747
ret = RtlCompareUnicodeString(&Str1, &Str2, TRUE);
1741-
ASSERT(ret == 0);
1748+
RTL_SOFT_ASSERT(ret == 0);
17421749

17431750
/* L"Non-Existent" DEFAULT_CHARSET */
17441751
RtlZeroMemory(&LogFont, sizeof(LogFont));
@@ -1748,8 +1755,13 @@ VOID DoFontSystemUnittest(VOID)
17481755
ret = NtGdiGetFontFamilyInfo(NULL, &LogFont, Info, &InfoCount);
17491756
DPRINT1("ret: %ld, InfoCount: %ld\n", ret, InfoCount);
17501757
DumpFamilyInfo(Info, ret);
1751-
ASSERT(ret == 0);
1752-
ASSERT(InfoCount == 0);
1758+
RTL_SOFT_ASSERT(ret == 0);
1759+
RTL_SOFT_ASSERT(InfoCount == 0);
1760+
1761+
#ifdef RTL_SOFT_ASSERT_defined
1762+
#undef RTL_SOFT_ASSERT_defined
1763+
#undef RTL_SOFT_ASSERT
1764+
#endif
17531765
}
17541766
#endif
17551767

@@ -1767,8 +1779,8 @@ CreateFontIndirectW(
17671779
static BOOL bDidTest = FALSE;
17681780
if (!bDidTest)
17691781
{
1770-
DoFontSystemUnittest();
17711782
bDidTest = TRUE;
1783+
DoFontSystemUnittest();
17721784
}
17731785
#endif
17741786
if (lplf)

0 commit comments

Comments
 (0)