Skip to content

Commit

Permalink
IsVariationSelectorのテストを追加する
Browse files Browse the repository at this point in the history
  • Loading branch information
suconbu committed May 11, 2024
1 parent dd0c526 commit fe2e51b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions tests/unittests/test-codechecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,26 @@ TEST(ConvertToUtf32, BinaryOnSurrogate)
const auto& s = L"\xdcff";
EXPECT_EQ(0, ConvertToUtf32(s));
}

TEST(IsVariationSelector, VariationSelectorCheck)
{
// IVS開始
const auto& ivs1 = L"\U000E0100";
EXPECT_TRUE(IsVariationSelector(ivs1, 2));

// IVS終了
const auto& ivs2 = L"\U000E01EF";
EXPECT_TRUE(IsVariationSelector(ivs2, 2));

// 長さ不足
EXPECT_FALSE(IsVariationSelector(ivs1, 0));
EXPECT_FALSE(IsVariationSelector(ivs1, 1));

// IVS開始-1
const auto& notivs1 = L"\U000E00FF";
EXPECT_FALSE(IsVariationSelector(notivs1, 2));

// IVS終了+1
const auto& notivs2 = L"\U000E01F0";
EXPECT_FALSE(IsVariationSelector(notivs2, 2));
}
2 changes: 1 addition & 1 deletion tests/unittests/test-ctextmetrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ TEST(CTextMetrics, GenerateDxArray8)
// IVSのVariantSelectorが続く文字列は先頭1文字 + 幅0×2で生成する
std::vector<int> v;
FakeCache1 cache;
CTextMetrics::GenerateDxArray(&v, L"葛󠄀", 2, 0, 0, 0, 10, cache);
CTextMetrics::GenerateDxArray(&v, L"葛󠄀", 3, 0, 0, 0, 10, cache);
EXPECT_TRUE(v[0]);
EXPECT_FALSE(v[1]);
EXPECT_FALSE(v[2]);
Expand Down

0 comments on commit fe2e51b

Please sign in to comment.