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

Side by Side Diff: tests/PDFMetadataAttributeTest.cpp

Issue 1823753002: SkPDF: record milestone version in Producer string (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: include Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « src/pdf/SkPDFMetadata.cpp ('k') | tools/milestone.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "SkDocument.h" 7 #include "SkDocument.h"
8 #include "SkStream.h" 8 #include "SkStream.h"
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "Test.h" 10 #include "Test.h"
(...skipping 16 matching lines...) Expand all
27 doc->setMetadata(&info[0], infoCount, &now, &now); 27 doc->setMetadata(&info[0], infoCount, &now, &now);
28 doc->beginPage(612.0f, 792.0f); 28 doc->beginPage(612.0f, 792.0f);
29 doc->close(); 29 doc->close();
30 SkAutoTUnref<SkData> data(pdf.copyToData()); 30 SkAutoTUnref<SkData> data(pdf.copyToData());
31 static const char* expectations[] = { 31 static const char* expectations[] = {
32 "/Title (A1)", 32 "/Title (A1)",
33 "/Author (A2)", 33 "/Author (A2)",
34 "/Subject (A3)", 34 "/Subject (A3)",
35 "/Keywords (A4)", 35 "/Keywords (A4)",
36 "/Creator (A5)", 36 "/Creator (A5)",
37 "/Producer (Skia/PDF)", 37 "/Producer (Skia/PDF ",
38 "/CreationDate (D:", 38 "/CreationDate (D:",
39 "/ModDate (D:" 39 "/ModDate (D:"
40 }; 40 };
41 for (const char* expectation : expectations) { 41 for (const char* expectation : expectations) {
42 bool found = false; 42 bool found = false;
43 size_t N = 1 + data->size() - strlen(expectation); 43 size_t N = 1 + data->size() - strlen(expectation);
44 for (size_t i = 0; i < N; ++i) { 44 for (size_t i = 0; i < N; ++i) {
45 if (0 == memcmp(data->bytes() + i, 45 if (0 == memcmp(data->bytes() + i,
46 expectation, strlen(expectation))) { 46 expectation, strlen(expectation))) {
47 found = true; 47 found = true;
48 break; 48 break;
49 } 49 }
50 } 50 }
51 if (!found) { 51 if (!found) {
52 ERRORF(r, "expectation missing: '%s'.", expectation); 52 ERRORF(r, "expectation missing: '%s'.", expectation);
53 } 53 }
54 } 54 }
55 } 55 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFMetadata.cpp ('k') | tools/milestone.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698