1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "printing/printing_context_win.h"
7 #include "printing/printing_test.h"
8 #include "printing/print_settings.h"
9 #include "testing/gtest/include/gtest/gtest.h"
13 // This test is automatically disabled if no printer is available.
14 class PrintingContextTest
: public PrintingTest
<testing::Test
>,
15 public PrintingContext::Delegate
{
17 void PrintSettingsCallback(PrintingContext::Result result
) {
21 // PrintingContext::Delegate methods.
22 virtual gfx::NativeView
GetParentView() OVERRIDE
{ return NULL
; }
23 virtual std::string
GetAppLocale() OVERRIDE
{ return std::string(); }
26 PrintingContext::Result
result() const { return result_
; }
29 PrintingContext::Result result_
;
32 TEST_F(PrintingContextTest
, Base
) {
33 if (IsTestCaseDisabled())
36 PrintSettings settings
;
37 settings
.set_device_name(GetDefaultPrinter());
39 scoped_ptr
<PrintingContext
> context(PrintingContext::Create(this));
40 EXPECT_EQ(PrintingContext::OK
, context
->InitWithSettings(settings
));
42 // The print may lie to use and may not support world transformation.
44 XFORM random_matrix
= { 1, 0.1f
, 0, 1.5f
, 0, 1 };
45 EXPECT_TRUE(SetWorldTransform(context
->context(), &random_matrix
));
46 EXPECT_TRUE(ModifyWorldTransform(context
->context(), NULL
, MWT_IDENTITY
));
49 } // namespace printing