00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00018
00019 #ifndef NET_INSTAWEB_SPRITER_MOCK_IMAGE_LIBRARY_INTERFACE_H_
00020 #define NET_INSTAWEB_SPRITER_MOCK_IMAGE_LIBRARY_INTERFACE_H_
00021
00022 #include "net/instaweb/util/public/basictypes.h"
00023 #include "net/instaweb/util/public/gmock.h"
00024 #include "net/instaweb/util/public/gtest.h"
00025 #include "net/instaweb/util/public/string.h"
00026 #include "net/instaweb/spriter/image_library_interface.h"
00027
00028
00029 namespace net_instaweb {
00030 namespace spriter {
00031
00032 class MockImageLibraryInterface : public ImageLibraryInterface {
00033 public:
00034 class MockImage : public ImageLibraryInterface::Image {
00035 public:
00036 MockImage() : Image(NULL) {}
00037 MOCK_CONST_METHOD2(GetDimensions, bool(int* out_width, int* out_height));
00038 virtual ~MockImage() {}
00039 private:
00040 explicit MockImage(MockImageLibraryInterface* lib) : Image(lib) {}
00041 };
00042
00043 MockImageLibraryInterface(const FilePath& base_input_path,
00044 const FilePath& base_output_path,
00045 Delegate* delegate)
00046 : ImageLibraryInterface(base_input_path, base_output_path, delegate) {
00047 }
00048
00051 MOCK_METHOD1(ReadFromFile, Image* (const FilePath& path));
00052
00056 class MockCanvas : public ImageLibraryInterface::Canvas {
00057 public:
00058 MockCanvas() : Canvas(NULL) {}
00059 virtual ~MockCanvas() {}
00060 MOCK_METHOD3(DrawImage, bool(const Image* image, int x, int y));
00061 MOCK_METHOD2(WriteToFile, bool(const FilePath& write_path,
00062 ImageFormat format));
00063 };
00064
00065 MOCK_METHOD2(CreateCanvas, Canvas* (int width, int height));
00066
00067 virtual ~MockImageLibraryInterface() {}
00068 };
00069
00070 }
00071 }
00072
00073 #endif ///< NET_INSTAWEB_SPRITER_MOCK_IMAGE_LIBRARY_INTERFACE_H_