diff options
Diffstat (limited to 'xfa/fde/cfde_texteditengine_unittest.cpp')
-rw-r--r-- | xfa/fde/cfde_texteditengine_unittest.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/xfa/fde/cfde_texteditengine_unittest.cpp b/xfa/fde/cfde_texteditengine_unittest.cpp index 522e61a011..e279f8eb34 100644 --- a/xfa/fde/cfde_texteditengine_unittest.cpp +++ b/xfa/fde/cfde_texteditengine_unittest.cpp @@ -415,6 +415,18 @@ TEST_F(CFDE_TextEditEngineTest, GetIndexForPoint) { engine()->Insert(0, L"Hello World"); EXPECT_EQ(0U, engine()->GetIndexForPoint({0.0f, 0.0f})); EXPECT_EQ(11U, engine()->GetIndexForPoint({999999.0f, 9999999.0f})); + EXPECT_EQ(11U, engine()->GetIndexForPoint({999999.0f, 0.0f})); + EXPECT_EQ(1U, engine()->GetIndexForPoint({10.0f, 5.0f})); +} + +TEST_F(CFDE_TextEditEngineTest, GetIndexForPointMultiline) { + engine()->SetFontSize(10.0f); + engine()->Insert(0, + L"A text long enough to span multiple lines and test " + L"getting indexes on multi-line edits."); + EXPECT_EQ(0U, engine()->GetIndexForPoint({0.0f, 0.0f})); + EXPECT_EQ(87U, engine()->GetIndexForPoint({999999.0f, 9999999.0f})); + EXPECT_EQ(12U, engine()->GetIndexForPoint({999999.0f, 0.0f})); EXPECT_EQ(1U, engine()->GetIndexForPoint({10.0f, 5.0f})); } |