From a37f2f1128f1167e858b605c51dfe98308919ea6 Mon Sep 17 00:00:00 2001 From: Diana Gage Date: Tue, 25 Jul 2017 17:39:50 -0700 Subject: Add another check for GetSelectedText(). This CL adds another check to previously existing tests for GetSelectedText(). The case this new check handles is when the first index passed to SetEditSelection() is valid, but the second goes off the end of the text in the form text area. BUG=chromium:59266 Change-Id: I99bc3f72cba4ee7c5281ddf696ac4c0bded736eb Reviewed-on: https://pdfium-review.googlesource.com/9030 Reviewed-by: Lei Zhang Reviewed-by: dsinclair Commit-Queue: dsinclair --- fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp | 3 +++ fpdfsdk/pwl/cpwl_edit_embeddertest.cpp | 3 +++ 2 files changed, 6 insertions(+) (limited to 'fpdfsdk') diff --git a/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp b/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp index afca67fd62..c6bc1b250b 100644 --- a/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp +++ b/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp @@ -193,6 +193,9 @@ TEST_F(CPWLComboBoxEditEmbeddertest, GetSelectedTextFragmentsEditable) { GetCPWLComboBox()->SetEditSelection(49, 50); EXPECT_STREQ(L"r", GetCPWLComboBox()->GetSelectedText().c_str()); + + GetCPWLComboBox()->SetEditSelection(49, 55); + EXPECT_STREQ(L"r", GetCPWLComboBox()->GetSelectedText().c_str()); } TEST_F(CPWLComboBoxEditEmbeddertest, DeleteEntireTextSelection) { diff --git a/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp b/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp index e41d9b0636..6ab0ae4792 100644 --- a/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp +++ b/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp @@ -122,6 +122,9 @@ TEST_F(CPWLEditEmbeddertest, GetSelectedTextFragments) { GetCPWLEdit()->SetSelection(49, 50); EXPECT_STREQ(L"r", GetCPWLEdit()->GetSelectedText().c_str()); + + GetCPWLEdit()->SetSelection(49, 55); + EXPECT_STREQ(L"r", GetCPWLEdit()->GetSelectedText().c_str()); } TEST_F(CPWLEditEmbeddertest, DeleteEntireTextSelection) { -- cgit v1.2.3