Use macro definitions for charsets in CFX_FolderFontInfoTest.

The value of |m_Charsets| in CFX_FolderFontInfo::FontFaceInfo doesn't
always equals to the CFX_FolderFontInfo::FindFont()'s parameter
|charset|'s value. This CL uses the macro definitions for charsets
instead of numbers in CFX_FolderFontInfoTest to improve readability.

Change-Id: I7e2922158f85a7831888c4faebd06cdf387924c9
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/75291
Commit-Queue: Hui Yingst <nigi@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/cfx_folderfontinfo.cpp b/core/fxge/cfx_folderfontinfo.cpp
index 75c4de9..b1aefdb 100644
--- a/core/fxge/cfx_folderfontinfo.cpp
+++ b/core/fxge/cfx_folderfontinfo.cpp
@@ -18,13 +18,6 @@
 #include "core/fxge/fx_font.h"
 #include "third_party/base/stl_util.h"
 
-#define CHARSET_FLAG_ANSI (1 << 0)
-#define CHARSET_FLAG_SYMBOL (1 << 1)
-#define CHARSET_FLAG_SHIFTJIS (1 << 2)
-#define CHARSET_FLAG_BIG5 (1 << 3)
-#define CHARSET_FLAG_GB (1 << 4)
-#define CHARSET_FLAG_KOREAN (1 << 5)
-
 namespace {
 
 const struct {
diff --git a/core/fxge/cfx_folderfontinfo.h b/core/fxge/cfx_folderfontinfo.h
index a8da990..e05dae2 100644
--- a/core/fxge/cfx_folderfontinfo.h
+++ b/core/fxge/cfx_folderfontinfo.h
@@ -15,6 +15,13 @@
 #include "core/fxge/cfx_fontmapper.h"
 #include "core/fxge/systemfontinfo_iface.h"
 
+#define CHARSET_FLAG_ANSI (1 << 0)
+#define CHARSET_FLAG_SYMBOL (1 << 1)
+#define CHARSET_FLAG_SHIFTJIS (1 << 2)
+#define CHARSET_FLAG_BIG5 (1 << 3)
+#define CHARSET_FLAG_GB (1 << 4)
+#define CHARSET_FLAG_KOREAN (1 << 5)
+
 class CFX_FolderFontInfo : public SystemFontInfoIface {
  public:
   CFX_FolderFontInfo();
diff --git a/core/fxge/cfx_folderfontinfo_unittest.cpp b/core/fxge/cfx_folderfontinfo_unittest.cpp
index 30739fe..c6b2629 100644
--- a/core/fxge/cfx_folderfontinfo_unittest.cpp
+++ b/core/fxge/cfx_folderfontinfo_unittest.cpp
@@ -6,6 +6,7 @@
 
 #include <utility>
 
+#include "core/fxcrt/fx_codepage.h"
 #include "core/fxge/fx_font.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/base/stl_util.h"
@@ -27,7 +28,7 @@
     auto arial_info = std::make_unique<CFX_FolderFontInfo::FontFaceInfo>(
         /*filePath=*/"", kArial, /*fontTables=*/"",
         /*fontOffset=*/0, /*fileSize=*/0);
-    arial_info->m_Charsets = 2;
+    arial_info->m_Charsets = CHARSET_FLAG_SYMBOL;
     auto times_new_roman_info =
         std::make_unique<CFX_FolderFontInfo::FontFaceInfo>(
             /*filePath=*/"", kTimesNewRoman, /*fontTables=*/"",
@@ -36,11 +37,11 @@
         std::make_unique<CFX_FolderFontInfo::FontFaceInfo>(
             /*filePath=*/"", kBookshelfSymbol7, /*fontTables=*/"",
             /*fontOffset=*/0, /*fileSize=*/0);
-    bookshelf_symbol7_info->m_Charsets = 2;
+    bookshelf_symbol7_info->m_Charsets = CHARSET_FLAG_SYMBOL;
     auto symbol_info = std::make_unique<CFX_FolderFontInfo::FontFaceInfo>(
         /*filePath=*/"", kSymbol, /*fontTables=*/"",
         /*fontOffset=*/0, /*fileSize=*/0);
-    symbol_info->m_Charsets = 2;
+    symbol_info->m_Charsets = CHARSET_FLAG_SYMBOL;
 
     font_info_.m_FontList[kArial] = std::move(arial_info);
     font_info_.m_FontList[kTimesNewRoman] = std::move(times_new_roman_info);
@@ -69,24 +70,24 @@
 
 TEST_F(CFX_FolderFontInfoTest, TestFindFont) {
   // Find "Symbol" font
-  void* font = FindFont(/*weight=*/0, /*bItalic=*/false, /*charset=*/2,
+  void* font = FindFont(/*weight=*/0, /*bItalic=*/false, FX_CHARSET_Symbol,
                         FXFONT_FF_ROMAN, kSymbol, /*bMatchName=*/true);
   ASSERT_TRUE(font);
   EXPECT_EQ(GetFaceName(font), kSymbol);
 
   // Find "Calibri" font that is not present in the installed fonts
-  EXPECT_FALSE(FindFont(/*weight=*/0, /*bItalic=*/false, /*charset=*/2,
+  EXPECT_FALSE(FindFont(/*weight=*/0, /*bItalic=*/false, FX_CHARSET_Symbol,
                         FXFONT_FF_ROMAN, kCalibri, /*bMatchName=*/true));
 
   // Find the closest matching font to "Bookself" font that is present in the
   // installed fonts
-  font = FindFont(/*weight=*/0, /*bItalic=*/false, /*charset=*/2,
+  font = FindFont(/*weight=*/0, /*bItalic=*/false, FX_CHARSET_Symbol,
                   FXFONT_FF_ROMAN, kBookshelf, /*bMatchName=*/true);
   ASSERT_TRUE(font);
   EXPECT_EQ(GetFaceName(font), kBookshelfSymbol7);
 
   // Find "Symbol" font when name matching is false
-  font = FindFont(/*weight=*/0, /*bItalic=*/false, /*charset=*/2,
+  font = FindFont(/*weight=*/0, /*bItalic=*/false, FX_CHARSET_Symbol,
                   FXFONT_FF_ROMAN, kSymbol, /*bMatchName=*/false);
   ASSERT_TRUE(font);
   EXPECT_EQ(GetFaceName(font), kArial);