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

Side by Side Diff: core/fxge/dib/fx_dib_engine_unittest.cpp

Issue 2520493002: Make CPDF_Stream() take unique_ptr's to its dictionary. (Closed)
Patch Set: rebase, lint, fix new test. Created 4 years 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 | « core/fpdfapi/parser/cpdf_syntax_parser.cpp ('k') | fpdfsdk/cpdfsdk_baannot.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium 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 <memory> 5 #include <memory>
6 #include <utility>
6 7
7 #include "core/fpdfapi/parser/cpdf_dictionary.h" 8 #include "core/fpdfapi/parser/cpdf_dictionary.h"
8 #include "core/fpdfapi/parser/cpdf_number.h" 9 #include "core/fpdfapi/parser/cpdf_number.h"
9 #include "core/fpdfapi/parser/cpdf_stream.h" 10 #include "core/fpdfapi/parser/cpdf_stream.h"
10 #include "core/fpdfapi/render/render_int.h" 11 #include "core/fpdfapi/render/render_int.h"
11 #include "core/fxcrt/fx_memory.h" 12 #include "core/fxcrt/fx_memory.h"
12 #include "core/fxge/dib/dib_int.h" 13 #include "core/fxge/dib/dib_int.h"
13 #include "core/fxge/fx_dib.h" 14 #include "core/fxge/fx_dib.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 #include "third_party/base/ptr_util.h" 16 #include "third_party/base/ptr_util.h"
16 17
17 TEST(CStretchEngine, OverflowInCtor) { 18 TEST(CStretchEngine, OverflowInCtor) {
18 FX_RECT clip_rect; 19 FX_RECT clip_rect;
19 std::unique_ptr<CPDF_Dictionary> dict_obj = 20 std::unique_ptr<CPDF_Dictionary> dict_obj =
20 pdfium::MakeUnique<CPDF_Dictionary>(); 21 pdfium::MakeUnique<CPDF_Dictionary>();
21 dict_obj->SetNewFor<CPDF_Number>("Width", 71000); 22 dict_obj->SetNewFor<CPDF_Number>("Width", 71000);
22 dict_obj->SetNewFor<CPDF_Number>("Height", 12500); 23 dict_obj->SetNewFor<CPDF_Number>("Height", 12500);
23 std::unique_ptr<CPDF_Stream> stream = 24 std::unique_ptr<CPDF_Stream> stream =
24 pdfium::MakeUnique<CPDF_Stream>(nullptr, 0, dict_obj.release()); 25 pdfium::MakeUnique<CPDF_Stream>(nullptr, 0, std::move(dict_obj));
25 CPDF_DIBSource dib_source; 26 CPDF_DIBSource dib_source;
26 dib_source.Load(nullptr, stream.get(), nullptr, nullptr, nullptr, nullptr, 27 dib_source.Load(nullptr, stream.get(), nullptr, nullptr, nullptr, nullptr,
27 false, 0, false); 28 false, 0, false);
28 CStretchEngine engine(nullptr, FXDIB_8bppRgb, 500, 500, clip_rect, 29 CStretchEngine engine(nullptr, FXDIB_8bppRgb, 500, 500, clip_rect,
29 &dib_source, 0); 30 &dib_source, 0);
30 EXPECT_EQ(FXDIB_INTERPOL, engine.m_Flags); 31 EXPECT_EQ(FXDIB_INTERPOL, engine.m_Flags);
31 } 32 }
OLDNEW
« no previous file with comments | « core/fpdfapi/parser/cpdf_syntax_parser.cpp ('k') | fpdfsdk/cpdfsdk_baannot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698