Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Unified Diff: fpdfsdk/src/fpdftext_embeddertest.cpp

Issue 1559373002: Merge to XFA: Make FPDF_WIDESTRING work regardless of endianness. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/fpdfdoc_embeddertest.cpp ('k') | samples/pdfium_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fpdftext_embeddertest.cpp
diff --git a/fpdfsdk/src/fpdftext_embeddertest.cpp b/fpdfsdk/src/fpdftext_embeddertest.cpp
index 6c1ae4ceb8853591a2e9f67d6798f822f7348142..3772686c889d3387872cf77ff4146d9a8d90b422 100644
--- a/fpdfsdk/src/fpdftext_embeddertest.cpp
+++ b/fpdfsdk/src/fpdftext_embeddertest.cpp
@@ -5,6 +5,7 @@
#include "public/fpdf_text.h"
#include "public/fpdfview.h"
#include "testing/embedder_test.h"
+#include "testing/test_support.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -143,11 +144,10 @@ TEST_F(FPDFTextEmbeddertest, TextSearch) {
FPDF_TEXTPAGE textpage = FPDFText_LoadPage(page);
EXPECT_NE(nullptr, textpage);
- // Avoid issues with system wchar_t width vs. FPDF_WideString.
- const unsigned short nope[] = {'n', 'o', 'p', 'e', '\0'};
- const unsigned short world[] = {'w', 'o', 'r', 'l', 'd', '\0'};
- const unsigned short world_caps[] = {'W', 'O', 'R', 'L', 'D', '\0'};
- const unsigned short world_substr[] = {'o', 'r', 'l', 'd', '\0'};
+ FPDF_WIDESTRING nope = GetFPDFWideString(L"nope");
+ FPDF_WIDESTRING world = GetFPDFWideString(L"world");
+ FPDF_WIDESTRING world_caps = GetFPDFWideString(L"WORLD");
+ FPDF_WIDESTRING world_substr = GetFPDFWideString(L"orld");
// No occurences of "nope" in test page.
FPDF_SCHHANDLE search = FPDFText_FindStart(textpage, nope, 0, 0);
@@ -239,6 +239,12 @@ TEST_F(FPDFTextEmbeddertest, TextSearch) {
FPDFText_ClosePage(textpage);
UnloadPage(page);
+
+ // Alas, the typedef includes the "const".
+ free(const_cast<unsigned short*>(nope));
+ free(const_cast<unsigned short*>(world));
+ free(const_cast<unsigned short*>(world_caps));
+ free(const_cast<unsigned short*>(world_substr));
}
// Test that the page has characters despite a bad stream length.
« no previous file with comments | « fpdfsdk/src/fpdfdoc_embeddertest.cpp ('k') | samples/pdfium_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698