1 // Copyright (C) 2018 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 #pragma once
15 
16 #include "aemu/base/AlignedBuf.h"
17 
18 #include "render-utils/render_api_platform_types.h"
19 
20 #include <GLES3/gl31.h>
21 
22 #include <gtest/gtest.h>
23 
24 namespace gfxstream {
25 
26 using TestTexture = android::AlignedBuf<uint8_t, 4>;
27 
28 testing::AssertionResult RowMatches(int rowIndex, size_t rowBytes,
29                                     unsigned char* expected, unsigned char* actual);
30 
31 testing::AssertionResult ImageMatches(int width, int height, int bpp, int rowLength,
32                                       unsigned char* expected, unsigned char* actual);
33 
34 
35 FBNativeWindowType createTestNativeWindow(int x, int y, int width, int height, int dpr);
36 
37 // Creates an asymmetric test pattern with various formats.
38 TestTexture createTestPatternRGB888(int width, int height);
39 TestTexture createTestPatternRGBA8888(int width, int height);
40 
41 // Creates a test pattern of the specified color.
42 TestTexture createTestTextureRGB888SingleColor(int width, int height, float r, float g, float b);
43 TestTexture createTestTextureRGBA8888SingleColor(int width, int height, float r, float g, float b, float a);
44 
45 // Return the name associated with |v| as a string.
46 const char* getEnumString(GLenum v);
47 
48 }  // namespace gfxstream
49