summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdftext_embeddertest.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-11-29 19:22:20 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-29 19:22:20 +0000
commit0839a8ef2a7ac7ae6e7474ca8978b6c2fbd5a776 (patch)
treea5078dba17754f0e5642dd36ae227c51f5875bf2 /fpdfsdk/fpdftext_embeddertest.cpp
parentb3eb4ac763bbeb4744f4c8411d280abda6f17644 (diff)
downloadpdfium-0839a8ef2a7ac7ae6e7474ca8978b6c2fbd5a776.tar.xz
Fix some nits in FPDFText_GetText().
Use more variables to avoid redundant calculations. Add one more edge test case. Change-Id: I6c8a0aca9de3bdd1a394c39304fd9a75009f9489 Reviewed-on: https://pdfium-review.googlesource.com/19690 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdftext_embeddertest.cpp')
-rw-r--r--fpdfsdk/fpdftext_embeddertest.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/fpdfsdk/fpdftext_embeddertest.cpp b/fpdfsdk/fpdftext_embeddertest.cpp
index 4b82dc081e..51216b9818 100644
--- a/fpdfsdk/fpdftext_embeddertest.cpp
+++ b/fpdfsdk/fpdftext_embeddertest.cpp
@@ -49,6 +49,12 @@ TEST_F(FPDFTextEmbeddertest, Text) {
EXPECT_EQ(1, FPDFText_GetText(textpage, 0, 0, fixed_buffer));
EXPECT_EQ(0, fixed_buffer[0]);
+ // Keep going and check the next case.
+ memset(fixed_buffer, 0xbd, sizeof(fixed_buffer));
+ EXPECT_EQ(2, FPDFText_GetText(textpage, 0, 1, fixed_buffer));
+ EXPECT_EQ(expected[0], fixed_buffer[0]);
+ EXPECT_EQ(0, fixed_buffer[1]);
+
// Check includes the terminating NUL that is provided.
int num_chars = FPDFText_GetText(textpage, 0, 128, fixed_buffer);
ASSERT_GE(num_chars, 0);