OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/sha1.h" | 7 #include "base/sha1.h" |
8 #include "chrome/utility/cloud_print/bitmap_image.h" | 8 #include "chrome/utility/cloud_print/bitmap_image.h" |
9 #include "chrome/utility/cloud_print/pwg_encoder.h" | 9 #include "chrome/utility/cloud_print/pwg_encoder.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 bitmap_data[row_start + i] = 255 << 16; | 56 bitmap_data[row_start + i] = 255 << 16; |
57 } | 57 } |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 return bitmap_image.Pass(); | 61 return bitmap_image.Pass(); |
62 } | 62 } |
63 | 63 |
64 } // namespace | 64 } // namespace |
65 | 65 |
| 66 // TODO(noamsml): Add tests for rotated cases. |
66 TEST(PwgRasterTest, CompareWithMaster) { | 67 TEST(PwgRasterTest, CompareWithMaster) { |
67 std::string output; | 68 std::string output; |
68 PwgEncoder encoder; | 69 PwgEncoder encoder; |
69 scoped_ptr<BitmapImage> image = MakeSampleBitmap(); | 70 scoped_ptr<BitmapImage> image = MakeSampleBitmap(); |
70 | 71 |
71 encoder.EncodeDocumentHeader(&output); | 72 encoder.EncodeDocumentHeader(&output); |
72 encoder.EncodePage(*image, kRasterDPI, 1, &output); | 73 encoder.EncodePage(*image, kRasterDPI, 1, &output, false); |
73 | 74 |
74 EXPECT_EQ(kPWGFileSha1, base::SHA1HashString(output)); | 75 EXPECT_EQ(kPWGFileSha1, base::SHA1HashString(output)); |
75 } | 76 } |
76 | 77 |
77 } // namespace cloud_print | 78 } // namespace cloud_print |
78 | |
OLD | NEW |