summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_edit_unittest.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-24 17:27:39 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-24 17:27:39 +0000
commit57360839a2eeecc8e32e326994f8853099ccd2fa (patch)
tree9c72c9282dc08f09947faa7cbd4e87e58ab2b546 /fpdfsdk/fpdf_edit_unittest.cpp
parent2237541071da7f309c16b3033daa4c6be170dca4 (diff)
downloadpdfium-57360839a2eeecc8e32e326994f8853099ccd2fa.tar.xz
Implement FPDFPageObj_GetLineJoin().
Add unit tests for FPDFPageObj_[GS]etLineJoin(). BUG=pdfium:1185 Change-Id: I10c6f0ad5cc06b2b0ac11c1142353e7a275fc79e Reviewed-on: https://pdfium-review.googlesource.com/c/44515 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_edit_unittest.cpp')
-rw-r--r--fpdfsdk/fpdf_edit_unittest.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_edit_unittest.cpp b/fpdfsdk/fpdf_edit_unittest.cpp
new file mode 100644
index 0000000000..7171f306dc
--- /dev/null
+++ b/fpdfsdk/fpdf_edit_unittest.cpp
@@ -0,0 +1,41 @@
+// Copyright 2018 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 "public/fpdf_edit.h"
+
+#include "core/fpdfapi/cpdf_modulemgr.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+class PDFEditTest : public testing::Test {
+ void SetUp() override { CPDF_ModuleMgr::Get()->Init(); }
+
+ void TearDown() override { CPDF_ModuleMgr::Destroy(); }
+};
+
+TEST_F(PDFEditTest, LineJoin) {
+ EXPECT_FALSE(FPDFPageObj_SetLineJoin(nullptr, -1));
+ EXPECT_FALSE(FPDFPageObj_SetLineJoin(nullptr, FPDF_LINEJOIN_MITER));
+ EXPECT_FALSE(FPDFPageObj_SetLineJoin(nullptr, FPDF_LINEJOIN_ROUND));
+ EXPECT_FALSE(FPDFPageObj_SetLineJoin(nullptr, FPDF_LINEJOIN_BEVEL));
+ EXPECT_FALSE(FPDFPageObj_SetLineJoin(nullptr, 3));
+ EXPECT_FALSE(FPDFPageObj_SetLineJoin(nullptr, 1000));
+
+ FPDF_PAGEOBJECT path = FPDFPageObj_CreateNewPath(0, 0);
+ EXPECT_EQ(FPDF_LINEJOIN_MITER, FPDFPageObj_GetLineJoin(path));
+
+ EXPECT_FALSE(FPDFPageObj_SetLineJoin(path, -1));
+ EXPECT_FALSE(FPDFPageObj_SetLineJoin(path, 3));
+ EXPECT_FALSE(FPDFPageObj_SetLineJoin(path, 1000));
+
+ EXPECT_TRUE(FPDFPageObj_SetLineJoin(path, FPDF_LINEJOIN_BEVEL));
+ EXPECT_EQ(FPDF_LINEJOIN_BEVEL, FPDFPageObj_GetLineJoin(path));
+
+ EXPECT_TRUE(FPDFPageObj_SetLineJoin(path, FPDF_LINEJOIN_ROUND));
+ EXPECT_EQ(FPDF_LINEJOIN_ROUND, FPDFPageObj_GetLineJoin(path));
+
+ EXPECT_TRUE(FPDFPageObj_SetLineJoin(path, FPDF_LINEJOIN_MITER));
+ EXPECT_EQ(FPDF_LINEJOIN_MITER, FPDFPageObj_GetLineJoin(path));
+
+ FPDFPageObj_Destroy(path);
+}