summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Gage <drgage@google.com>2017-07-25 17:39:50 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-07-26 17:54:20 +0000
commita37f2f1128f1167e858b605c51dfe98308919ea6 (patch)
tree05679190136436e19310fd783684cd4b751352e3
parent605fb604ae9c868f840523db6a65d5088fbec07c (diff)
downloadpdfium-a37f2f1128f1167e858b605c51dfe98308919ea6.tar.xz
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 <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r--fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp3
-rw-r--r--fpdfsdk/pwl/cpwl_edit_embeddertest.cpp3
2 files changed, 6 insertions, 0 deletions
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) {