diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-03-28 19:23:25 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-03-28 19:23:25 +0000 |
commit | 971a674ef17526ad37ce55ba90110830b94889d0 (patch) | |
tree | d99fabf665cc63825b48dd087daadf664bb80ee8 /fpdfsdk/fpdf_editpath_embeddertest.cpp | |
parent | 7d12532362545273e0ceac93fae2154661323fd1 (diff) | |
download | pdfium-971a674ef17526ad37ce55ba90110830b94889d0.tar.xz |
Rename fpdfsdk/fpdf* files to be consistent
This CL makes the fpdfsdk/fpdf* files to be consistently prefixed with
fpdf_ instead of randomly dropping the _.
Change-Id: I23e3c8a0831b56bcd17c788d9fe874b2ab8b24fc
Reviewed-on: https://pdfium-review.googlesource.com/29390
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_editpath_embeddertest.cpp')
-rw-r--r-- | fpdfsdk/fpdf_editpath_embeddertest.cpp | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_editpath_embeddertest.cpp b/fpdfsdk/fpdf_editpath_embeddertest.cpp new file mode 100644 index 0000000000..59e5dbbabf --- /dev/null +++ b/fpdfsdk/fpdf_editpath_embeddertest.cpp @@ -0,0 +1,63 @@ +// Copyright 2017 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "core/fxcrt/fx_system.h" +#include "public/fpdf_edit.h" +#include "testing/embedder_test.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "testing/test_support.h" + +class FPDFEditPathEmbedderTest : public EmbedderTest {}; + +TEST_F(FPDFEditPathEmbedderTest, VerifyCorrectColoursReturned) { + CreateEmptyDocument(); + FPDF_PAGE page = FPDFPage_New(document(), 0, 612, 792); + + for (size_t i = 0; i < 256; ++i) { + FPDF_PAGEOBJECT path = FPDFPageObj_CreateNewPath(400, 100); + EXPECT_TRUE(FPDFPath_SetFillColor(path, i, i, i, i)); + EXPECT_TRUE(FPDFPath_SetStrokeColor(path, i, i, i, i)); + EXPECT_TRUE(FPDFPath_SetDrawMode(path, FPDF_FILLMODE_ALTERNATE, 0)); + EXPECT_TRUE(FPDFPath_LineTo(path, 400, 200)); + EXPECT_TRUE(FPDFPath_LineTo(path, 300, 100)); + EXPECT_TRUE(FPDFPath_Close(path)); + + FPDFPage_InsertObject(page, path); + } + + EXPECT_TRUE(FPDFPage_GenerateContent(page)); + EXPECT_TRUE(FPDF_SaveAsCopy(document(), this, 0)); + FPDF_ClosePage(page); + page = nullptr; + + OpenSavedDocument(); + page = LoadSavedPage(0); + ASSERT(page); + + for (size_t i = 0; i < 256; ++i) { + FPDF_PAGEOBJECT path = FPDFPage_GetObject(page, i); + ASSERT(path); + + EXPECT_EQ(FPDF_PAGEOBJ_PATH, FPDFPageObj_GetType(path)); + + unsigned int r; + unsigned int g; + unsigned int b; + unsigned int a; + FPDFPath_GetFillColor(path, &r, &g, &b, &a); + EXPECT_EQ(i, r); + EXPECT_EQ(i, g); + EXPECT_EQ(i, b); + EXPECT_EQ(i, a); + + FPDFPath_GetStrokeColor(path, &r, &g, &b, &a); + EXPECT_EQ(i, r); + EXPECT_EQ(i, g); + EXPECT_EQ(i, b); + EXPECT_EQ(i, a); + } + + CloseSavedPage(page); + CloseSavedDocument(); +} |