summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-11-02 03:11:10 +0100
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-11-02 03:11:10 +0100
commit948790fa4c01c6f21005e09e85e24d3d66299de8 (patch)
treeab4b045819468d3ea82af956c27a1e2892260d45 /tests
parentMerge changes I69ce001a,I14514017,I8e67cda7 (diff)
parentminui: Add GRSurface::Clone(). (diff)
downloadandroid_bootable_recovery-948790fa4c01c6f21005e09e85e24d3d66299de8.tar
android_bootable_recovery-948790fa4c01c6f21005e09e85e24d3d66299de8.tar.gz
android_bootable_recovery-948790fa4c01c6f21005e09e85e24d3d66299de8.tar.bz2
android_bootable_recovery-948790fa4c01c6f21005e09e85e24d3d66299de8.tar.lz
android_bootable_recovery-948790fa4c01c6f21005e09e85e24d3d66299de8.tar.xz
android_bootable_recovery-948790fa4c01c6f21005e09e85e24d3d66299de8.tar.zst
android_bootable_recovery-948790fa4c01c6f21005e09e85e24d3d66299de8.zip
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/minui_test.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/unit/minui_test.cpp b/tests/unit/minui_test.cpp
index b188b5992..d68e5e3a1 100644
--- a/tests/unit/minui_test.cpp
+++ b/tests/unit/minui_test.cpp
@@ -15,8 +15,9 @@
*/
#include <stdint.h>
+#include <stdlib.h>
-#include <memory>
+#include <vector>
#include <gtest/gtest.h>
@@ -30,3 +31,14 @@ TEST(GRSurfaceTest, Create_aligned) {
ASSERT_EQ(0, reinterpret_cast<uintptr_t>(surface->data()) % kSurfaceDataAlignment);
}
}
+
+TEST(GRSurfaceTest, Clone) {
+ static constexpr size_t kImageSize = 10 * 50;
+ auto image = GRSurface::Create(50, 10, 50, 1, kImageSize);
+ for (auto i = 0; i < kImageSize; i++) {
+ image->data()[i] = rand() % 128;
+ }
+ auto image_copy = image->Clone();
+ ASSERT_EQ(std::vector(image->data(), image->data() + kImageSize),
+ std::vector(image_copy->data(), image_copy->data() + kImageSize));
+}