summaryrefslogtreecommitdiffstats
path: root/printing/pdf_ps_metafile_linux_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'printing/pdf_ps_metafile_linux_unittest.cc')
-rw-r--r--printing/pdf_ps_metafile_linux_unittest.cc48
1 files changed, 14 insertions, 34 deletions
diff --git a/printing/pdf_ps_metafile_linux_unittest.cc b/printing/pdf_ps_metafile_linux_unittest.cc
index 8728ba3..3ef0822 100644
--- a/printing/pdf_ps_metafile_linux_unittest.cc
+++ b/printing/pdf_ps_metafile_linux_unittest.cc
@@ -15,31 +15,22 @@ typedef struct _cairo cairo_t;
TEST(PdfTest, Basic) {
// Tests in-renderer constructor.
printing::PdfPsMetafile pdf(printing::PdfPsMetafile::PDF);
- cairo_t* context = pdf.GetPageContext();
- EXPECT_TRUE(context == NULL);
+ EXPECT_TRUE(pdf.Init());
// Renders page 1.
- EXPECT_TRUE(pdf.StartPage(72, 72));
- context = pdf.GetPageContext();
+ cairo_t* context = pdf.StartPage(72, 72);
EXPECT_TRUE(context != NULL);
// In theory, we should use Cairo to draw something on |context|.
- pdf.FinishPage(1.5);
- context = pdf.GetPageContext();
- EXPECT_TRUE(context == NULL);
+ EXPECT_TRUE(pdf.FinishPage(1.5));
// Renders page 2.
- EXPECT_TRUE(pdf.StartPage(64, 64));
- context = pdf.GetPageContext();
+ context = pdf.StartPage(64, 64);
EXPECT_TRUE(context != NULL);
// In theory, we should use Cairo to draw something on |context|.
- pdf.FinishPage(0.5);
- context = pdf.GetPageContext();
- EXPECT_TRUE(context == NULL);
+ EXPECT_TRUE(pdf.FinishPage(0.5));
// Closes the file.
pdf.Close();
- context = pdf.GetPageContext();
- EXPECT_TRUE(context == NULL);
// Checks data size.
unsigned int size = pdf.GetDataSize();
@@ -50,9 +41,8 @@ TEST(PdfTest, Basic) {
pdf.GetData(&buffer.front(), size);
// Tests another constructor.
- printing::PdfPsMetafile pdf2(printing::PdfPsMetafile::PDF,
- &buffer.front(),
- size);
+ printing::PdfPsMetafile pdf2(printing::PdfPsMetafile::PDF);
+ EXPECT_TRUE(pdf2.Init(&buffer.front(), size));
// Tries to get the first 4 characters from pdf2.
std::vector<char> buffer2(4, 0x00);
@@ -69,31 +59,22 @@ TEST(PdfTest, Basic) {
TEST(PsTest, Basic) {
// Tests in-renderer constructor.
printing::PdfPsMetafile ps(printing::PdfPsMetafile::PS);
- cairo_t* context = ps.GetPageContext();
- EXPECT_TRUE(context == NULL);
+ EXPECT_TRUE(ps.Init());
// Renders page 1.
- EXPECT_TRUE(ps.StartPage(72, 72));
- context = ps.GetPageContext();
+ cairo_t* context = ps.StartPage(72, 72);
EXPECT_TRUE(context != NULL);
// In theory, we should use Cairo to draw something on |context|.
- ps.FinishPage(1.5);
- context = ps.GetPageContext();
- EXPECT_TRUE(context == NULL);
+ EXPECT_TRUE(ps.FinishPage(1.5));
// Renders page 2.
- EXPECT_TRUE(ps.StartPage(64, 64));
- context = ps.GetPageContext();
+ context = ps.StartPage(64, 64);
EXPECT_TRUE(context != NULL);
// In theory, we should use Cairo to draw something on |context|.
- ps.FinishPage(0.5);
- context = ps.GetPageContext();
- EXPECT_TRUE(context == NULL);
+ EXPECT_TRUE(ps.FinishPage(0.5));
// Closes the file.
ps.Close();
- context = ps.GetPageContext();
- EXPECT_TRUE(context == NULL);
// Checks data size.
unsigned int size = ps.GetDataSize();
@@ -104,9 +85,8 @@ TEST(PsTest, Basic) {
ps.GetData(&buffer.front(), size);
// Tests another constructor.
- printing::PdfPsMetafile ps2(printing::PdfPsMetafile::PS,
- &buffer.front(),
- size);
+ printing::PdfPsMetafile ps2(printing::PdfPsMetafile::PS);
+ EXPECT_TRUE(ps2.Init(&buffer.front(), size));
// Tries to get the first 4 characters from ps2.
std::vector<char> buffer2(4, 0x00);