Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mock_image_library_interface.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 #ifndef NET_INSTAWEB_SPRITER_MOCK_IMAGE_LIBRARY_INTERFACE_H_
20 #define NET_INSTAWEB_SPRITER_MOCK_IMAGE_LIBRARY_INTERFACE_H_
21 
27 
28 
29 namespace net_instaweb {
30 namespace spriter {
31 
33  public:
35  public:
36  MockImage() : Image(NULL) {}
37  MOCK_CONST_METHOD2(GetDimensions, bool(int* out_width, int* out_height));
38  virtual ~MockImage() {}
39  private:
40  explicit MockImage(MockImageLibraryInterface* lib) : Image(lib) {}
41  };
42 
44  const FilePath& base_output_path,
45  Delegate* delegate)
46  : ImageLibraryInterface(base_input_path, base_output_path, delegate) {
47  }
48 
51  MOCK_METHOD1(ReadFromFile, Image* (const FilePath& path));
52 
57  public:
58  MockCanvas() : Canvas(NULL) {}
59  virtual ~MockCanvas() {}
60  MOCK_METHOD3(DrawImage, bool(const Image* image, int x, int y));
61  MOCK_METHOD2(WriteToFile, bool(const FilePath& write_path,
62  ImageFormat format));
63  };
64 
65  MOCK_METHOD2(CreateCanvas, Canvas* (int width, int height));
66 
67  virtual ~MockImageLibraryInterface() {}
68 };
69 
70 }
71 }
72 
73 #endif
Definition: image_library_interface.h:41
Definition: mock_image_library_interface.h:32
MOCK_METHOD1(ReadFromFile, Image *(const FilePath &path))
Definition: mock_image_library_interface.h:56
Images are immutable rectangular regions of pixels.
Definition: image_library_interface.h:56
Image(ImageLibraryInterface *lib)
Only methods of ImageLibraryInterface may create images.
Definition: image_library_interface.h:63
virtual Image * ReadFromFile(const FilePath &path)=0
Definition: image_library_interface.h:76
const FilePath & base_input_path()
Used by subclasses:
Definition: image_library_interface.h:108
virtual bool GetDimensions(int *out_width, int *out_height) const =0
Get the width and height of an image.
GoogleString FilePath
Definition: image_library_interface.h:45
Definition: image.h:39
Definition: mock_image_library_interface.h:34
Definition: image_library_interface.h:49