Remove the ImageSprite extension

Believed to be unused now.
Esse commit está contido em:
Jordan DeLong
2013-06-15 18:15:55 -07:00
commit de Sara Golemon
commit 4cebdbe47d
10 arquivos alterados com 0 adições e 2179 exclusões
-1
Ver Arquivo
@@ -47,7 +47,6 @@
#include "hphp/runtime/ext/ext_icu_ucsdet.h"
#include "hphp/runtime/ext/ext_icu_uspoof.h"
#include "hphp/runtime/ext/ext_image.h"
#include "hphp/runtime/ext/ext_imagesprite.h"
#include "hphp/runtime/ext/ext_imap.h"
#include "hphp/runtime/ext/ext_intl.h"
#include "hphp/runtime/ext/ext_ipc.h"
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
-76
Ver Arquivo
@@ -1,76 +0,0 @@
/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
| Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#ifndef incl_HPHP_EXT_IMAGESPRITE_H_
#define incl_HPHP_EXT_IMAGESPRITE_H_
// >>>>>> Generated by idl.php. Do NOT modify. <<<<<<
#include "hphp/runtime/base/base_includes.h"
#include <gd.h>
#include "hphp/runtime/ext/ext_imagesprite_include.h"
namespace HPHP {
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// class ImageSprite
FORWARD_DECLARE_CLASS_BUILTIN(ImageSprite);
class c_ImageSprite : public ExtObjectData, public Sweepable {
public:
DECLARE_CLASS(ImageSprite, ImageSprite, ObjectData)
// need to implement
public: c_ImageSprite(Class* cls = c_ImageSprite::s_cls);
public: ~c_ImageSprite();
public: void t___construct();
public: Object t_addfile(CStrRef file, CArrRef options = uninit_null());
public: Object t_addstring(CStrRef id, CStrRef data, CArrRef options = uninit_null());
public: Object t_addurl(CStrRef url, int timeout_ms = 0, CArrRef Options = uninit_null());
public: Object t_clear(CVarRef paths = uninit_null());
public: Object t_loaddims(bool block = false);
public: Object t_loadimages(bool block = false);
public: String t_output(CStrRef output_file = null_string, CStrRef format = "png", int quality = 75);
public: String t_css(CStrRef css_namespace, CStrRef sprite_file = null_string, CStrRef output_file = null_string, bool verbose = false);
public: Array t_geterrors();
public: Array t_mapping();
public: Variant t___destruct();
private:
void map();
public:
hphp_string_map<ImageSprite::ResourceGroup*> m_rsrc_groups;
String m_image_string_buffer;
bool m_current;
hphp_string_map<ImageSprite::Image*> m_image_data;
Array m_mapping;
Array m_img_errors;
Array m_sprite_errors;
gdImagePtr m_image;
int m_width;
int m_height;
};
///////////////////////////////////////////////////////////////////////////////
}
#endif // incl_HPHP_EXT_IMAGESPRITE_H_
-197
Ver Arquivo
@@ -1,197 +0,0 @@
/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
| Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#ifndef incl_HPHP_EXT_IMAGESPRITE_INCLUDE_H_
#define incl_HPHP_EXT_IMAGESPRITE_INCLUDE_H_
#include "hphp/runtime/base/base_includes.h"
#include <evhttp.h>
#include <gd.h>
namespace HPHP {
#define IMAGESPRITE_FLUSH_LEFT 0
#define IMAGESPRITE_FLUSH_RIGHT 1
#define IMAGESPRITE_PAD_TOP 0
#define IMAGESPRITE_PAD_LEFT 1
#define IMAGESPRITE_PAD_BOTTOM 2
#define IMAGESPRITE_PAD_RIGHT 3
class c_ImageSprite;
namespace ImageSprite {
class ResourceGroup {
public:
ResourceGroup(c_ImageSprite* sprite) {
m_sprite = sprite;
}
virtual ~ResourceGroup() {
m_sprite = NULL;
}
protected:
c_ImageSprite* m_sprite;
};
class ResourceGroupEv : public ResourceGroup {
public:
ResourceGroupEv(c_ImageSprite* sprite) : ResourceGroup(sprite) {
m_base = event_base_new();
m_connections = 0;
}
~ResourceGroupEv() {
event_base_free(m_base);
m_base = NULL;
}
void add(evhttp_connection* conn);
void complete(evhttp_connection* conn);
void setTimeout(int milliseconds);
event_base* m_base;
int m_connections;
};
class Image {
public:
Image(String path, c_ImageSprite* sprite) {
m_sprite = sprite;
m_path = path;
m_image = NULL;
m_width = -1;
m_height = -1;
m_area = -1;
m_error = false;
m_error_string = null_string;
m_padding[IMAGESPRITE_PAD_TOP] = 0;
m_padding[IMAGESPRITE_PAD_RIGHT] = 1;
m_padding[IMAGESPRITE_PAD_BOTTOM] = 1;
m_padding[IMAGESPRITE_PAD_LEFT] = 0;
m_flush[IMAGESPRITE_FLUSH_LEFT] = false;
m_flush[IMAGESPRITE_FLUSH_RIGHT] = false;
}
virtual ~Image() {
reset();
}
virtual void loadImage(bool block = false) {
// Implemented by the child
}
virtual void loadDims(bool block = false);
virtual void reset();
void setError(const String& err);
void setOptions(Array options);
protected:
void load_data_to_gd(int size, const void* data);
public:
int m_x;
int m_y;
int m_area;
c_ImageSprite* m_sprite;
String m_path;
gdImagePtr m_image;
int m_width;
int m_height;
bool m_error;
String m_error_string;
int m_padding[4];
bool m_flush[2];
int m_effwidth;
int m_effheight;
int m_effarea;
};
class ImageFromFile : public Image {
public:
ImageFromFile(String path, c_ImageSprite* sprite)
: Image(path, sprite) {
// Do nothing
}
void loadImage(bool block = false);
};
class ImageFromString : public Image {
public:
ImageFromString(String id, String data, c_ImageSprite* sprite)
: Image(id, sprite) {
m_data = data;
}
void loadImage(bool block = false);
private:
String m_data;
};
class ImageFromHTTP : public Image {
public:
ImageFromHTTP(String path, c_ImageSprite* sprite, int timeout);
void loadImage(bool block = false);
void reset();
void completed();
protected:
ResourceGroupEv* m_ev_group;
String m_host;
String m_url;
String m_query;
int m_port;
evhttp_connection *m_conn;
evhttp_request *m_request;
};
class Block {
public:
Block(int x, int y, int width, int height) {
m_x = x;
m_y = y;
m_width = width;
m_height = height;
m_area = width * height;
}
int m_x;
int m_y;
int m_width;
int m_height;
int m_area;
};
} // ImageSprite
} // HPHP
#endif // incl_HPHP_EXT_IMAGESPRITE_INCLUDE_H_
-283
Ver Arquivo
@@ -1,283 +0,0 @@
{
"preamble": "#include <gd.h>\n#include <runtime\/ext\/ext_imagesprite_include.h>\n",
"consts": [
],
"funcs": [
],
"classes": [
{
"name": "ImageSprite",
"bases": [
"Sweepable"
],
"desc": "Represents a set of images sprited into a single image.",
"flags": [
"HasDocComment"
],
"footer": "\n private:\n void map();\n\n public:\n hphp_string_map<ImageSprite::ResourceGroup*> m_rsrc_groups;\n String m_image_string_buffer;\n bool m_current;\n hphp_string_map<ImageSprite::Image*> m_image_data;\n Array m_mapping;\n Array m_img_errors;\n Array m_sprite_errors;\n gdImagePtr m_image;\n int m_width;\n int m_height;",
"funcs": [
{
"name": "__construct",
"desc": "Creates a new ImageSprite object",
"flags": [
"HasDocComment"
],
"return": {
"type": null,
"desc": "TODO"
},
"args": [
]
},
{
"name": "addFile",
"desc": "Adds the image specified by the file path to the sprite.",
"flags": [
"HasDocComment"
],
"return": {
"type": "Object",
"desc": "The ImageSprite object itself (for method chaining)."
},
"args": [
{
"name": "file",
"type": "String",
"desc": "The path to the image. Must be a path to the local filesystem or a a stream format php supports."
},
{
"name": "options",
"type": "StringMap",
"value": "null",
"desc": "Associative array of options for this image. May include the image's 'width' and 'height' (if previously known to the developer), or spacing requirements via the padding_DIRECTION keys, where DIRECTION may be top, bottom, left, or right. May also include flush requirements that will force this image to be 'flush_left' or 'flush_right' within the sprite."
}
]
},
{
"name": "addString",
"desc": "Adds the image defined by the string to the sprite.",
"flags": [
"HasDocComment"
],
"return": {
"type": "Object",
"desc": "The ImageSprite object itself (for method chaining)."
},
"args": [
{
"name": "id",
"type": "String",
"desc": "An identifier for this image. This will be the key to referencing this image in the mapping."
},
{
"name": "data",
"type": "String",
"desc": "The data of this image."
},
{
"name": "options",
"type": "StringMap",
"value": "null",
"desc": "Associative array of options for this image. May include the image's 'width' and 'height' (if previously known to the developer), or spacing requirements via the padding_DIRECTION keys, where DIRECTION may be top, bottom, left, or right. May also include flush requirements that will force this image to be 'flush_left' or 'flush_right' within the sprite."
}
]
},
{
"name": "addUrl",
"desc": "Adds the image located at the specified URL to the sprite.",
"flags": [
"HasDocComment"
],
"return": {
"type": "Object",
"desc": "The ImageSprite object itself (for method chaining)."
},
"args": [
{
"name": "url",
"type": "String",
"desc": "The url of the image. The URL must be using the http protocol; secure connections are not supported."
},
{
"name": "timeout_ms",
"type": "Int32",
"value": "0",
"desc": "The timeout in milliseconds for this request. A value of 0 or lower will disable the timeout."
},
{
"name": "Options",
"type": "StringMap",
"value": "null",
"desc": "Associative array of options for this image. May include the image's 'width' and 'height' (if previously known to the developer), or spacing requirements via the padding_DIRECTION keys, where DIRECTION may be top, bottom, left, or right. May also include flush requirements that will force this image to be 'flush_left' or 'flush_right' within the sprite."
}
]
},
{
"name": "clear",
"desc": "Removes images from the sprite and frees the memory associated with that image.",
"flags": [
"HasDocComment"
],
"return": {
"type": "Object",
"desc": "The ImageSprite object itself (for method chaining)."
},
"args": [
{
"name": "paths",
"type": "Variant",
"value": "null",
"desc": "When passed a string, it will remove the images specified by that path or identifier from the sprite, if they exist. You may also pass an array of strings, and it will remove each. a null value will remove all images from the sprite."
}
]
},
{
"name": "loadDims",
"desc": "Loads the dimensions for the images in the sprite, but not necessarily their data.",
"flags": [
"HasDocComment"
],
"return": {
"type": "Object",
"desc": "The ImageSprite object itself (for method chaining)."
},
"args": [
{
"name": "block",
"type": "Boolean",
"value": "false",
"desc": "Whether this call should block until all the data is loaded or allow them to load in the background."
}
]
},
{
"name": "loadImages",
"desc": "Loads the images in the sprite and sets the correct dimensions.",
"flags": [
"HasDocComment"
],
"return": {
"type": "Object",
"desc": "The ImageSprite object itself (for method chaining)."
},
"args": [
{
"name": "block",
"type": "Boolean",
"value": "false",
"desc": "Whether this call should block until all the data is loaded or allow them to load in the background."
}
]
},
{
"name": "output",
"desc": "Retrieves the resulting sprite image.",
"flags": [
"HasDocComment"
],
"return": {
"type": "String",
"desc": "The image data, if the $output_file is not specified."
},
"args": [
{
"name": "output_file",
"type": "String",
"value": "null_string",
"desc": "Path to where the output image should be saved. If empty or null, the image data is returned as a string."
},
{
"name": "format",
"type": "String",
"value": "\"png\"",
"desc": "The format the output image should be returned in. Defaults to png."
},
{
"name": "quality",
"type": "Int32",
"value": "75",
"desc": "The output quality of the image. Only applies to jpeg output, and defaults to 75."
}
]
},
{
"name": "css",
"desc": "Retrieves css for the sprite, mapping ids to images.",
"flags": [
"HasDocComment"
],
"return": {
"type": "String",
"desc": "The css output, if the $output_file is not specified."
},
"args": [
{
"name": "css_namespace",
"type": "String",
"desc": "The css class namespace of the sprite. Should be unique within your css."
},
{
"name": "sprite_file",
"type": "String",
"value": "null_string",
"desc": "Path to the sprite image relative to wherever this css is being served. The output image may be passed in datauri format to use inlined sprite images. If this is not set, the image location must be specified elsewhere in the css manually."
},
{
"name": "output_file",
"type": "String",
"value": "null_string",
"desc": "Path to where the css should be saved. If empty or null, the css is returned as a string."
},
{
"name": "verbose",
"type": "Boolean",
"value": "false",
"desc": "Determines whether the css should include comments with information about the sprite."
}
]
},
{
"name": "getErrors",
"desc": "Retrieves an associative array of errors encountered while putting together the sprite.",
"flags": [
"HasDocComment"
],
"return": {
"type": "StringVec",
"desc": "Associative array of errors"
},
"args": [
]
},
{
"name": "mapping",
"desc": "Returns an associative array mapping the images in the sprite to their dimensions, placement, and css id.",
"flags": [
"HasDocComment"
],
"return": {
"type": "StringVec",
"desc": "Associative array of mapping"
},
"args": [
]
},
{
"name": "__destruct",
"desc": "Recovers all memory allocated to the sprite.",
"flags": [
"HasDocComment"
],
"return": {
"type": "Variant",
"desc": "null"
},
"args": [
]
}
],
"consts": [
]
}
]
}
-1
Ver Arquivo
@@ -35,7 +35,6 @@
#include "hphp/facebook/extensions/tao/test_ext_tao.h"
#include "hphp/facebook/extensions/urlextraction/test_ext_urlextraction.h"
#include "hphp/test/ext/test_ext_curl.h"
#include "hphp/test/ext/test_ext_imagesprite.h"
#include "hphp/test/ext/test_ext_mailparse.h"
#include "hphp/test/ext/test_ext_math.h"
#include "hphp/test/ext/test_ext_mcrypt.h"
-298
Ver Arquivo
@@ -1,298 +0,0 @@
/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#include "hphp/test/ext/test_ext_imagesprite.h"
#include "hphp/runtime/ext/ext_imagesprite.h"
#include "hphp/runtime/ext/ext_url.h"
IMPLEMENT_SEP_EXTENSION_TEST(Imagesprite);
///////////////////////////////////////////////////////////////////////////////
bool TestExtImagesprite::RunTests(const std::string &which) {
bool ret = true;
DECLARE_TEST_FUNCTIONS("");
RUN_TEST(test_ImageSprite);
RUN_TEST(test_addFile);
RUN_TEST(test_addString);
RUN_TEST(test_addUrl);
RUN_TEST(test_clear);
RUN_TEST(test_loadDims);
RUN_TEST(test_loadImages);
RUN_TEST(test_map);
sprite.reset();
return ret;
}
///////////////////////////////////////////////////////////////////////////////
bool TestExtImagesprite::preTest() {
sprite = p_ImageSprite(NEWOBJ(c_ImageSprite)());
return true;
}
bool TestExtImagesprite::test_ImageSprite() {
VS(sprite->m_img_errors.size(), 0);
VS(sprite->m_sprite_errors.size(), 0);
VS((int) sprite->m_image_data.size(), 0);
return Count(true);
}
bool TestExtImagesprite::test_addFile() {
std::string path = "test/slow/ext_image/images";
sprite->t_addfile(path+"/php.gif");
VS((int) sprite->m_image_data.size(), 1);
VS(sprite->m_image_data[path+"/php.gif"] == nullptr, false);
VS(sprite->m_img_errors.size(), 0);
sprite->t_addfile(path+"/php.gif");
VS((int) sprite->m_image_data.size(), 1);
VS(sprite->m_image_data[path+"/php.gif"] == nullptr, false);
VS(sprite->m_img_errors.size(), 0);
sprite->t_addfile(path+"/246x247.png");
VS((int) sprite->m_image_data.size(), 2);
VS(sprite->m_image_data[path+"/php.gif"] == nullptr, false);
VS(sprite->m_img_errors.size(), 0);
sprite->t_loadimages(true);
VS(sprite->m_img_errors.size(), 0);
sprite->t_addfile("invalid-image");
VS((int) sprite->m_image_data.size(), 3);
VS(sprite->m_image_data["invalid-image"] == nullptr, false);
VS(sprite->m_img_errors.size(), 0);
sprite->t_loadimages(true);
VS(sprite->m_img_errors.size(), 1);
return Count(true);
}
bool TestExtImagesprite::test_addString() {
String img = "R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";
sprite->t_addstring("transparent", f_base64_decode(img));
VS((int) sprite->m_image_data.size(), 1);
VS(sprite->m_image_data["transparent"] == nullptr, false);
VS(sprite->m_img_errors.size(), 0);
sprite->t_addstring("transparent", f_base64_decode(img));
VS((int) sprite->m_image_data.size(), 1);
VS(sprite->m_image_data["transparent"] == nullptr, false);
VS(sprite->m_img_errors.size(), 0);
sprite->t_addstring("image-2", f_base64_decode(img));
VS((int) sprite->m_image_data.size(), 2);
VS(sprite->m_image_data["image-2"] == nullptr, false);
VS(sprite->m_img_errors.size(), 0);
sprite->t_loadimages(true);
VS(sprite->m_img_errors.size(), 0);
sprite->t_addstring("invalid-image", "invalid-image");
VS((int) sprite->m_image_data.size(), 3);
VS(sprite->m_image_data["invalid-image"] == nullptr, false);
VS(sprite->m_img_errors.size(), 0);
sprite->t_loadimages(true);
VS(sprite->m_img_errors.size(), 1);
return Count(true);
}
bool TestExtImagesprite::test_addUrl() {
sprite->t_addurl("http://www.facebook.com/images/icons/like.png");
VS((int) sprite->m_image_data.size(), 1);
VS(
sprite->m_image_data["http://www.facebook.com/images/icons/like.png"]
== nullptr,
false);
VS(sprite->m_img_errors.size(), 0);
sprite->t_addurl("http://www.facebook.com/images/icons/like.png");
VS((int) sprite->m_image_data.size(), 1);
VS(
sprite->m_image_data["http://www.facebook.com/images/icons/like.png"]
== nullptr,
false);
VS(sprite->m_img_errors.size(), 0);
sprite->t_addurl("http://www.facebook.com/images/icons/friend.gif");
VS((int) sprite->m_image_data.size(), 2);
VS(
sprite->m_image_data["http://www.facebook.com/images/icons/friend.gif"]
== nullptr,
false);
VS(sprite->m_img_errors.size(), 0);
sprite->t_loadimages(true);
VS(sprite->m_img_errors.size(), 0);
sprite->t_addurl("http://www.facebook.com/images/invalid-image.txt");
VS((int) sprite->m_image_data.size(), 3);
VS(
sprite->m_image_data["http://www.facebook.com/images/invalid-image.txt"]
== nullptr,
false);
VS(sprite->m_img_errors.size(), 0);
sprite->t_loadimages(true);
VS(sprite->m_img_errors.size(), 1);
return Count(true);
}
bool TestExtImagesprite::test_clear() {
std::string path = "test/slow/ext_image/images";
VS((int) sprite->m_image_data.size(), 0);
sprite->t_addfile(path+"/php.gif");
VS((int) sprite->m_image_data.size(), 1);
sprite->t_clear(path+"/php.gif");
VS((int) sprite->m_image_data.size(), 0);
sprite->t_addfile(path+"/php.gif");
sprite->t_addfile(path+"/246x247.png");
VS((int) sprite->m_image_data.size(), 2);
sprite->t_clear(path+"/php.gif");
VS((int) sprite->m_image_data.size(), 1);
sprite->t_addfile(path+"/php.gif");
sprite->t_clear();
VS((int) sprite->m_image_data.size(), 0);
return Count(true);
}
static const StaticString
s_width("width"),
s_height("height");
bool TestExtImagesprite::test_loadDims() {
std::string path = "test/slow/ext_image/images";
sprite->t_addfile(path+"/php.gif");
sprite->t_loaddims(true);
VS(sprite->m_image_data[path+"/php.gif"]->m_width, 120);
VS(sprite->m_image_data[path+"/php.gif"]->m_height, 67);
VS(sprite->m_image_data[path+"/php.gif"]->m_image == nullptr, false);
sprite->t_clear();
Array dims = Array::Create();
dims.set(s_width, 1);
dims.set(s_height, 1);
sprite->t_addfile(path+"/php.gif", dims);
sprite->t_loaddims(true);
VS(sprite->m_image_data[path+"/php.gif"]->m_width, 1);
VS(sprite->m_image_data[path+"/php.gif"]->m_height, 1);
VS(sprite->m_image_data[path+"/php.gif"]->m_image == nullptr, true);
sprite->t_clear();
sprite->t_addurl("http://www.facebook.com/images/icons/like.png", -1, dims);
sprite->t_loaddims(true);
VS(
sprite->m_image_data["http://www.facebook.com/images/icons/like.png"]
->m_width,
1);
VS(
sprite->m_image_data["http://www.facebook.com/images/icons/like.png"]
->m_height,
1);
VS(
sprite->m_image_data["http://www.facebook.com/images/icons/like.png"]
->m_image == nullptr,
true);
return Count(true);
}
bool TestExtImagesprite::test_loadImages() {
std::string path = "test/slow/ext_image/images";
sprite->t_addfile(path+"/php.gif");
sprite->t_loadimages(true);
VS(sprite->m_image_data[path+"/php.gif"]->m_width, 120);
VS(sprite->m_image_data[path+"/php.gif"]->m_height, 67);
VS(sprite->m_image_data[path+"/php.gif"]->m_image == nullptr, false);
sprite->t_clear();
Array dims = Array::Create();
dims.set(s_width, 1);
dims.set(s_height, 1);
sprite->t_addfile(path+"/php.gif", dims);
sprite->t_loadimages(true);
VS(sprite->m_image_data[path+"/php.gif"]->m_width, 120);
VS(sprite->m_image_data[path+"/php.gif"]->m_height, 67);
VS(sprite->m_image_data[path+"/php.gif"]->m_image == nullptr, false);
// XXX disabled until we work out flaky network issues. t2183444
#if 0
sprite->t_clear();
sprite->t_addurl("http://www.facebook.com/images/icons/like.png", -1, dims);
sprite->t_loadimages(true);
VS(
sprite->m_image_data["http://www.facebook.com/images/icons/like.png"]
->m_width,
16);
VS(
sprite->m_image_data["http://www.facebook.com/images/icons/like.png"]
->m_height,
16);
VS(
sprite->m_image_data["http://www.facebook.com/images/icons/like.png"]
->m_image
== nullptr,
false);
#endif
return Count(true);
}
bool TestExtImagesprite::test_map() {
std::string path = "test/slow/ext_image/images";
static const StaticString
s_images("images"),
s_width("width"),
s_height("height"),
s_x("x"),
s_y("y"),
testpath(path+"/php.gif");
sprite->t_addfile(testpath);
VS(sprite->m_current, false);
Array map = sprite->t_mapping();
VS(map[s_images].toArray()[testpath].toArray()[s_width].toInt32(), 120);
VS(map[s_images].toArray()[testpath].toArray()[s_height].toInt32(), 67);
VS(map[s_images].toArray()[testpath].toArray()[s_x].toInt32(), 0);
VS(map[s_images].toArray()[testpath].toArray()[s_y].toInt32(), 0);
VS(map[s_width].toInt32(), 121);
VS(map[s_height].toInt32(), 68);
VS(sprite->m_current, true);
sprite->t_clear();
Array dims = Array::Create();
dims.set(s_width, 1);
dims.set(s_height, 1);
sprite->t_addfile(testpath, dims);
VS(sprite->m_current, false);
map = sprite->t_mapping();
VS(map[s_images].toArray()[testpath].toArray()[s_width].toInt32(), 1);
VS(map[s_images].toArray()[testpath].toArray()[s_height].toInt32(), 1);
VS(map[s_images].toArray()[testpath].toArray()[s_x].toInt32(), 0);
VS(map[s_images].toArray()[testpath].toArray()[s_y].toInt32(), 0);
VS(map[s_width].toInt32(), 2);
VS(map[s_height].toInt32(), 2);
VS(sprite->m_current, true);
return Count(true);
}
-46
Ver Arquivo
@@ -1,46 +0,0 @@
/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#ifndef incl_HPHP_TEST_EXT_IMAGESPRITE_H_
#define incl_HPHP_TEST_EXT_IMAGESPRITE_H_
// >>>>>> Generated by idl.php. Do NOT modify. <<<<<<
#include "hphp/test/ext/test_cpp_ext.h"
#include "hphp/runtime/ext/ext_imagesprite.h"
///////////////////////////////////////////////////////////////////////////////
class TestExtImagesprite : public TestCppExt {
public:
virtual bool preTest();
virtual bool RunTests(const std::string &which);
bool test_ImageSprite();
bool test_addFile();
bool test_addString();
bool test_addUrl();
bool test_clear();
bool test_loadDims();
bool test_loadImages();
bool test_map();
p_ImageSprite sprite;
};
///////////////////////////////////////////////////////////////////////////////
#endif // incl_HPHP_TEST_EXT_IMAGESPRITE_H_
@@ -1,8 +0,0 @@
<?php
include __DIR__."/builtin_extensions.inc";
class A_ImageSprite extends ImageSprite {
public $___x;
}
test("ImageSprite");
@@ -1,69 +0,0 @@
ImageSprite
object(ImageSprite)#1 (0) {
}
string(23) "O:11:"ImageSprite":0:{}"
object(ImageSprite)#2 (0) {
}
array(12) {
[0]=>
string(11) "__construct"
[1]=>
string(7) "addFile"
[2]=>
string(9) "addString"
[3]=>
string(6) "addUrl"
[4]=>
string(5) "clear"
[5]=>
string(8) "loadDims"
[6]=>
string(10) "loadImages"
[7]=>
string(6) "output"
[8]=>
string(3) "css"
[9]=>
string(9) "getErrors"
[10]=>
string(7) "mapping"
[11]=>
string(10) "__destruct"
}
================
A_ImageSprite
object(A_ImageSprite)#3 (1) {
["___x"]=>
NULL
}
string(38) "O:13:"A_ImageSprite":1:{s:4:"___x";N;}"
object(A_ImageSprite)#4 (1) {
["___x"]=>
NULL
}
array(12) {
[0]=>
string(11) "__construct"
[1]=>
string(7) "addFile"
[2]=>
string(9) "addString"
[3]=>
string(6) "addUrl"
[4]=>
string(5) "clear"
[5]=>
string(8) "loadDims"
[6]=>
string(10) "loadImages"
[7]=>
string(6) "output"
[8]=>
string(3) "css"
[9]=>
string(9) "getErrors"
[10]=>
string(7) "mapping"
[11]=>
string(10) "__destruct"
}