https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7334567211b921220ef82…
commit 7334567211b921220ef82f168ef8e4bc7d5b2724
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sun Apr 14 01:17:15 2019 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Apr 14 01:17:15 2019 +0200
[GDI32] Do not 'hard-assert' during the font-unit-test.
---
win32ss/gdi/gdi32/objects/font.c | 34 +++++++++++++++++++++++-----------
1 file changed, 23 insertions(+), 11 deletions(-)
diff --git a/win32ss/gdi/gdi32/objects/font.c b/win32ss/gdi/gdi32/objects/font.c
index 1b6cfa7296..7a7c23b0b5 100644
--- a/win32ss/gdi/gdi32/objects/font.c
+++ b/win32ss/gdi/gdi32/objects/font.c
@@ -1340,7 +1340,7 @@ GetOutlineTextMetricsA(
else
output->otmpFullName = 0;
- assert(left == 0);
+ ASSERT(left == 0);
if(output != lpOTM)
{
@@ -1730,6 +1730,13 @@ VOID DumpFamilyInfo(const FONTFAMILYINFO *Info, LONG Count)
VOID DoFontSystemUnittest(VOID)
{
+#ifndef RTL_SOFT_ASSERT
+#define RTL_SOFT_ASSERT(exp) \
+ (void)((!(exp)) ? \
+ DbgPrint("%s(%d): Soft assertion failed\n Expression: %s\n", __FILE__,
__LINE__, #exp), FALSE : TRUE)
+#define RTL_SOFT_ASSERT_defined
+#endif
+
LOGFONTW LogFont;
FONTFAMILYINFO Info[4];
UNICODE_STRING Str1, Str2;
@@ -1744,8 +1751,8 @@ VOID DoFontSystemUnittest(VOID)
ret = NtGdiGetFontFamilyInfo(NULL, &LogFont, Info, &InfoCount);
DPRINT1("ret: %ld, InfoCount: %ld\n", ret, InfoCount);
DumpFamilyInfo(Info, ret);
- ASSERT(ret == RTL_NUMBER_OF(Info));
- ASSERT(InfoCount > 32);
+ RTL_SOFT_ASSERT(ret == RTL_NUMBER_OF(Info));
+ RTL_SOFT_ASSERT(InfoCount > 32);
/* L"Microsoft Sans Serif" ANSI_CHARSET */
RtlZeroMemory(&LogFont, sizeof(LogFont));
@@ -1755,19 +1762,19 @@ VOID DoFontSystemUnittest(VOID)
ret = NtGdiGetFontFamilyInfo(NULL, &LogFont, Info, &InfoCount);
DPRINT1("ret: %ld, InfoCount: %ld\n", ret, InfoCount);
DumpFamilyInfo(Info, ret);
- ASSERT(ret != -1);
- ASSERT(InfoCount > 0);
- ASSERT(InfoCount < 16);
+ RTL_SOFT_ASSERT(ret != -1);
+ RTL_SOFT_ASSERT(InfoCount > 0);
+ RTL_SOFT_ASSERT(InfoCount < 16);
RtlInitUnicodeString(&Str1, Info[0].EnumLogFontEx.elfLogFont.lfFaceName);
RtlInitUnicodeString(&Str2, L"Microsoft Sans Serif");
ret = RtlCompareUnicodeString(&Str1, &Str2, TRUE);
- ASSERT(ret == 0);
+ RTL_SOFT_ASSERT(ret == 0);
RtlInitUnicodeString(&Str1, Info[0].EnumLogFontEx.elfFullName);
RtlInitUnicodeString(&Str2, L"Tahoma");
ret = RtlCompareUnicodeString(&Str1, &Str2, TRUE);
- ASSERT(ret == 0);
+ RTL_SOFT_ASSERT(ret == 0);
/* L"Non-Existent" DEFAULT_CHARSET */
RtlZeroMemory(&LogFont, sizeof(LogFont));
@@ -1777,8 +1784,13 @@ VOID DoFontSystemUnittest(VOID)
ret = NtGdiGetFontFamilyInfo(NULL, &LogFont, Info, &InfoCount);
DPRINT1("ret: %ld, InfoCount: %ld\n", ret, InfoCount);
DumpFamilyInfo(Info, ret);
- ASSERT(ret == 0);
- ASSERT(InfoCount == 0);
+ RTL_SOFT_ASSERT(ret == 0);
+ RTL_SOFT_ASSERT(InfoCount == 0);
+
+#ifdef RTL_SOFT_ASSERT_defined
+#undef RTL_SOFT_ASSERT_defined
+#undef RTL_SOFT_ASSERT
+#endif
}
#endif
@@ -1796,8 +1808,8 @@ CreateFontIndirectW(
static BOOL bDidTest = FALSE;
if (!bDidTest)
{
- DoFontSystemUnittest();
bDidTest = TRUE;
+ DoFontSystemUnittest();
}
#endif
if (lplf)