Files
msime-windows/server/tests/src/test_system_font_family.cpp
T
fanlusky 54e5c68f94 refactor(server): clear the Server and test /W4 warnings
Most of them come from logging that is compiled out. The disabled DIAG_LOGF /
FANY_IPC_LOG* macros expanded to `((void)0)`, so every HRESULT and parameter
that exists only to be logged looked unreferenced (C4189/C4100). They now
expand to `((void)sizeof(DiscardLogArgs(__VA_ARGS__)))`: the arguments stay in
an unevaluated context, so nothing is computed and no side effect runs, but the
names count as used.

The rest:

- C4100: commented out the parameter names that are genuinely unused
  (WinMain's hPrevInstance/nCmdShow, AdjustWndPosition's hwnd/height, the
  WebView2 callbacks' sender, and the no-op logging sinks).
- C4189/C4101: removed the dead locals and the unused catch bindings left over
  with the log statements.
- C4244: made the DIP-to-pixel and int-to-float conversions explicit in
  globals.h, ime_windows.cpp and the menu placement.
- C4456: renamed the shadowing `hwnd` and `lock` locals.
- C4005: guarded the tests' `#define NOMINMAX` with #ifndef; the test targets
  already define it on the command line.

Release builds clean and ctest passes for the server, the tests and msimeui.
Warnings under vendor/ are untouched: those are submodules with their own
repositories.
2026-09-12 00:55:57 +08:00

25 lines
837 B
C++

#ifndef NOMINMAX
#define NOMINMAX
#endif
#include "config/ime_config.h"
#include "tests/includes/test_framework.h"
#include <algorithm>
TEST_CASE(system_font_dropdown_uses_directwrite_family_names)
{
const auto &families = GetSystemFontFamilies();
REQUIRE(!families.empty());
REQUIRE(std::is_sorted(families.begin(), families.end()));
}
TEST_CASE(legacy_tsanger_face_name_resolves_to_css_family_when_installed)
{
const auto &families = GetSystemFontFamilies();
const auto installed = std::find(families.begin(), families.end(), std::string("仓耳今楷05"));
if (installed != families.end())
{
REQUIRE_EQ(ResolveSystemFontFamilyForCss("仓耳今楷05 W03"), std::string("仓耳今楷05"));
REQUIRE_EQ(ResolveSystemFontFamilyForCss("仓耳今楷05"), std::string("仓耳今楷05"));
}
}