#include <dali/public-api/dali-core.h>
// INTERNAL INCLUDES
+#include <dali-test-suite-utils.h>
#include "mesh-builder.h"
namespace Dali
{
Texture texture = Texture::New(type, format, width, height);
- int bufferSize = width * height * 2;
+ int bufferSize = width * height * GetBytesPerPixel(format);
uint8_t* buffer = reinterpret_cast<uint8_t*>(malloc(bufferSize));
PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, format, PixelData::FREE);
texture.Upload(pixelData, 0u, 0u, 0u, 0u, width, height);
return textureSet;
}
+void DirtyRectChecker(const std::vector<Rect<int>>& damagedRects, std::multiset<Rect<int>, RectSorter> expectedRectList, bool checkRectsExact, const char* testLocation)
+{
+ // Just check damagedRect contain all expectRectList.
+ DALI_TEST_GREATER(damagedRects.size() + 1u, expectedRectList.size(), testLocation);
+
+ for(auto& rect : damagedRects)
+ {
+ auto iter = expectedRectList.find(rect);
+ if(iter != expectedRectList.end())
+ {
+ expectedRectList.erase(iter);
+ }
+ else if(checkRectsExact)
+ {
+ std::ostringstream o;
+ o << rect << " exist in expectRectList" << std::endl;
+ fprintf(stderr, "Test failed in %s, checking %s", testLocation, o.str().c_str());
+ tet_result(TET_FAIL);
+ }
+ }
+
+ // Check all rects are matched
+ DALI_TEST_EQUALS(expectedRectList.empty(), true, testLocation);
+}
+
} // namespace Dali