libgui: Fix some bitrot/warnings in tests
These tests hadn't been run in a while and had accumulated some rot. This fixes most of the compile warnings and some tests which fail incorrectly, but 2 failures remain on N6. Change-Id: I7fee78cd058a32f4d7df40ec9f899ff767f68517
This commit is contained in:
parent
eea6d682b8
commit
f8cebe5457
@ -3,6 +3,8 @@ LOCAL_PATH:= $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
||||
|
||||
LOCAL_CLANG := true
|
||||
|
||||
LOCAL_MODULE := libgui_test
|
||||
|
||||
LOCAL_MODULE_TAGS := tests
|
||||
|
@ -73,6 +73,8 @@ struct DummyConsumer : public BnConsumerListener {
|
||||
virtual void onSidebandStreamChanged() {}
|
||||
};
|
||||
|
||||
static const uint32_t TEST_DATA = 0x12345678u;
|
||||
|
||||
// XXX: Tests that fork a process to hold the BufferQueue must run before tests
|
||||
// that use a local BufferQueue, or else Binder will get unhappy
|
||||
TEST_F(BufferQueueTest, BufferQueueInAnotherProcess) {
|
||||
@ -122,7 +124,7 @@ TEST_F(BufferQueueTest, BufferQueueInAnotherProcess) {
|
||||
uint32_t* dataIn;
|
||||
ASSERT_EQ(OK, buffer->lock(GraphicBuffer::USAGE_SW_WRITE_OFTEN,
|
||||
reinterpret_cast<void**>(&dataIn)));
|
||||
*dataIn = 0x12345678;
|
||||
*dataIn = TEST_DATA;
|
||||
ASSERT_EQ(OK, buffer->unlock());
|
||||
|
||||
IGraphicBufferProducer::QueueBufferInput input(0, false,
|
||||
@ -136,7 +138,7 @@ TEST_F(BufferQueueTest, BufferQueueInAnotherProcess) {
|
||||
uint32_t* dataOut;
|
||||
ASSERT_EQ(OK, item.mGraphicBuffer->lock(GraphicBuffer::USAGE_SW_READ_OFTEN,
|
||||
reinterpret_cast<void**>(&dataOut)));
|
||||
ASSERT_EQ(*dataOut, 0x12345678);
|
||||
ASSERT_EQ(*dataOut, TEST_DATA);
|
||||
ASSERT_EQ(OK, item.mGraphicBuffer->unlock());
|
||||
}
|
||||
|
||||
@ -239,7 +241,7 @@ TEST_F(BufferQueueTest, DetachAndReattachOnProducerSide) {
|
||||
uint32_t* dataIn;
|
||||
ASSERT_EQ(OK, buffer->lock(GraphicBuffer::USAGE_SW_WRITE_OFTEN,
|
||||
reinterpret_cast<void**>(&dataIn)));
|
||||
*dataIn = 0x12345678;
|
||||
*dataIn = TEST_DATA;
|
||||
ASSERT_EQ(OK, buffer->unlock());
|
||||
|
||||
int newSlot;
|
||||
@ -258,7 +260,7 @@ TEST_F(BufferQueueTest, DetachAndReattachOnProducerSide) {
|
||||
uint32_t* dataOut;
|
||||
ASSERT_EQ(OK, item.mGraphicBuffer->lock(GraphicBuffer::USAGE_SW_READ_OFTEN,
|
||||
reinterpret_cast<void**>(&dataOut)));
|
||||
ASSERT_EQ(*dataOut, 0x12345678);
|
||||
ASSERT_EQ(*dataOut, TEST_DATA);
|
||||
ASSERT_EQ(OK, item.mGraphicBuffer->unlock());
|
||||
}
|
||||
|
||||
@ -297,7 +299,7 @@ TEST_F(BufferQueueTest, DetachAndReattachOnConsumerSide) {
|
||||
ASSERT_EQ(OK, item.mGraphicBuffer->lock(
|
||||
GraphicBuffer::USAGE_SW_WRITE_OFTEN,
|
||||
reinterpret_cast<void**>(&dataIn)));
|
||||
*dataIn = 0x12345678;
|
||||
*dataIn = TEST_DATA;
|
||||
ASSERT_EQ(OK, item.mGraphicBuffer->unlock());
|
||||
|
||||
int newSlot;
|
||||
@ -317,7 +319,7 @@ TEST_F(BufferQueueTest, DetachAndReattachOnConsumerSide) {
|
||||
uint32_t* dataOut;
|
||||
ASSERT_EQ(OK, buffer->lock(GraphicBuffer::USAGE_SW_READ_OFTEN,
|
||||
reinterpret_cast<void**>(&dataOut)));
|
||||
ASSERT_EQ(*dataOut, 0x12345678);
|
||||
ASSERT_EQ(*dataOut, TEST_DATA);
|
||||
ASSERT_EQ(OK, buffer->unlock());
|
||||
}
|
||||
|
||||
@ -340,7 +342,7 @@ TEST_F(BufferQueueTest, MoveFromConsumerToProducer) {
|
||||
uint32_t* dataIn;
|
||||
ASSERT_EQ(OK, buffer->lock(GraphicBuffer::USAGE_SW_WRITE_OFTEN,
|
||||
reinterpret_cast<void**>(&dataIn)));
|
||||
*dataIn = 0x12345678;
|
||||
*dataIn = TEST_DATA;
|
||||
ASSERT_EQ(OK, buffer->unlock());
|
||||
|
||||
IGraphicBufferProducer::QueueBufferInput input(0, false,
|
||||
@ -360,7 +362,7 @@ TEST_F(BufferQueueTest, MoveFromConsumerToProducer) {
|
||||
uint32_t* dataOut;
|
||||
ASSERT_EQ(OK, item.mGraphicBuffer->lock(GraphicBuffer::USAGE_SW_READ_OFTEN,
|
||||
reinterpret_cast<void**>(&dataOut)));
|
||||
ASSERT_EQ(*dataOut, 0x12345678);
|
||||
ASSERT_EQ(*dataOut, TEST_DATA);
|
||||
ASSERT_EQ(OK, item.mGraphicBuffer->unlock());
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ protected:
|
||||
mPendingFrames--;
|
||||
}
|
||||
|
||||
virtual void onFrameAvailable() {
|
||||
virtual void onFrameAvailable(const BufferItem&) {
|
||||
Mutex::Autolock lock(mMutex);
|
||||
mPendingFrames++;
|
||||
mCondition.signal();
|
||||
@ -125,7 +125,7 @@ protected:
|
||||
mPendingFrames--;
|
||||
}
|
||||
|
||||
virtual void onFrameAvailable() {
|
||||
virtual void onFrameAvailable(const BufferItem&) {
|
||||
Mutex::Autolock lock(mMutex);
|
||||
mPendingFrames++;
|
||||
mFrameCondition.signal();
|
||||
@ -457,9 +457,12 @@ void configureANW(const sp<ANativeWindow>& anw,
|
||||
const CpuConsumerTestParams& params,
|
||||
int maxBufferSlack) {
|
||||
status_t err;
|
||||
err = native_window_set_buffers_geometry(anw.get(),
|
||||
params.width, params.height, params.format);
|
||||
ASSERT_NO_ERROR(err, "set_buffers_geometry error: ");
|
||||
err = native_window_set_buffers_dimensions(anw.get(),
|
||||
params.width, params.height);
|
||||
ASSERT_NO_ERROR(err, "set_buffers_dimensions error: ");
|
||||
|
||||
err = native_window_set_buffers_format(anw.get(), params.format);
|
||||
ASSERT_NO_ERROR(err, "set_buffers_format error: ");
|
||||
|
||||
err = native_window_set_usage(anw.get(),
|
||||
GRALLOC_USAGE_SW_WRITE_OFTEN);
|
||||
|
@ -38,31 +38,31 @@
|
||||
#define TEST_CONTROLLED_BY_APP false
|
||||
#define TEST_PRODUCER_USAGE_BITS (0)
|
||||
|
||||
// TODO: Make these public constants in a header
|
||||
enum {
|
||||
// Default dimensions before setDefaultBufferSize is called
|
||||
DEFAULT_WIDTH = 1,
|
||||
DEFAULT_HEIGHT = 1,
|
||||
|
||||
// Default format before setDefaultBufferFormat is called
|
||||
DEFAULT_FORMAT = HAL_PIXEL_FORMAT_RGBA_8888,
|
||||
|
||||
// Default transform hint before setTransformHint is called
|
||||
DEFAULT_TRANSFORM_HINT = 0,
|
||||
};
|
||||
|
||||
namespace android {
|
||||
|
||||
namespace {
|
||||
// Parameters for a generic "valid" input for queueBuffer.
|
||||
const int64_t QUEUE_BUFFER_INPUT_TIMESTAMP = 1384888611;
|
||||
const bool QUEUE_BUFFER_INPUT_IS_AUTO_TIMESTAMP = false;
|
||||
const android_dataspace QUEUE_BUFFER_INPUT_DATASPACE = HAL_DATASPACE_UNKNOWN;
|
||||
const Rect QUEUE_BUFFER_INPUT_RECT = Rect(DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||
const int QUEUE_BUFFER_INPUT_SCALING_MODE = 0;
|
||||
const int QUEUE_BUFFER_INPUT_TRANSFORM = 0;
|
||||
const bool QUEUE_BUFFER_INPUT_ASYNC = false;
|
||||
const sp<Fence> QUEUE_BUFFER_INPUT_FENCE = Fence::NO_FENCE;
|
||||
// Default dimensions before setDefaultBufferSize is called
|
||||
const uint32_t DEFAULT_WIDTH = 1;
|
||||
const uint32_t DEFAULT_HEIGHT = 1;
|
||||
|
||||
// Default format before setDefaultBufferFormat is called
|
||||
const PixelFormat DEFAULT_FORMAT = HAL_PIXEL_FORMAT_RGBA_8888;
|
||||
|
||||
// Default transform hint before setTransformHint is called
|
||||
const uint32_t DEFAULT_TRANSFORM_HINT = 0;
|
||||
|
||||
// TODO: Make these constants in header
|
||||
const int DEFAULT_CONSUMER_USAGE_BITS = 0;
|
||||
|
||||
// Parameters for a generic "valid" input for queueBuffer.
|
||||
const int64_t QUEUE_BUFFER_INPUT_TIMESTAMP = 1384888611;
|
||||
const bool QUEUE_BUFFER_INPUT_IS_AUTO_TIMESTAMP = false;
|
||||
const android_dataspace QUEUE_BUFFER_INPUT_DATASPACE = HAL_DATASPACE_UNKNOWN;
|
||||
const Rect QUEUE_BUFFER_INPUT_RECT = Rect(DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||
const int QUEUE_BUFFER_INPUT_SCALING_MODE = 0;
|
||||
const int QUEUE_BUFFER_INPUT_TRANSFORM = 0;
|
||||
const bool QUEUE_BUFFER_INPUT_ASYNC = false;
|
||||
const sp<Fence> QUEUE_BUFFER_INPUT_FENCE = Fence::NO_FENCE;
|
||||
}; // namespace anonymous
|
||||
|
||||
struct DummyConsumer : public BnConsumerListener {
|
||||
@ -273,15 +273,12 @@ TEST_F(IGraphicBufferProducerTest, Disconnect_ReturnsError) {
|
||||
TEST_F(IGraphicBufferProducerTest, Query_Succeeds) {
|
||||
ASSERT_NO_FATAL_FAILURE(ConnectProducer());
|
||||
|
||||
// TODO: Make these constants in header
|
||||
const int DEFAULT_CONSUMER_USAGE_BITS = 0;
|
||||
|
||||
int value = -1;
|
||||
int32_t value = -1;
|
||||
EXPECT_OK(mProducer->query(NATIVE_WINDOW_WIDTH, &value));
|
||||
EXPECT_EQ(DEFAULT_WIDTH, value);
|
||||
EXPECT_EQ(DEFAULT_WIDTH, static_cast<uint32_t>(value));
|
||||
|
||||
EXPECT_OK(mProducer->query(NATIVE_WINDOW_HEIGHT, &value));
|
||||
EXPECT_EQ(DEFAULT_HEIGHT, value);
|
||||
EXPECT_EQ(DEFAULT_HEIGHT, static_cast<uint32_t>(value));
|
||||
|
||||
EXPECT_OK(mProducer->query(NATIVE_WINDOW_FORMAT, &value));
|
||||
EXPECT_EQ(DEFAULT_FORMAT, value);
|
||||
@ -302,7 +299,7 @@ TEST_F(IGraphicBufferProducerTest, Query_ReturnsError) {
|
||||
ASSERT_NO_FATAL_FAILURE(ConnectProducer());
|
||||
|
||||
// One past the end of the last 'query' enum value. Update this if we add more enums.
|
||||
const int NATIVE_WINDOW_QUERY_LAST_OFF_BY_ONE = NATIVE_WINDOW_CONSUMER_USAGE_BITS + 1;
|
||||
const int NATIVE_WINDOW_QUERY_LAST_OFF_BY_ONE = NATIVE_WINDOW_DEFAULT_DATASPACE + 1;
|
||||
|
||||
int value;
|
||||
// What was out of range
|
||||
@ -369,7 +366,7 @@ TEST_F(IGraphicBufferProducerTest, Queue_Succeeds) {
|
||||
EXPECT_EQ(DEFAULT_WIDTH, width);
|
||||
EXPECT_EQ(DEFAULT_HEIGHT, height);
|
||||
EXPECT_EQ(DEFAULT_TRANSFORM_HINT, transformHint);
|
||||
EXPECT_EQ(1, numPendingBuffers); // since queueBuffer was called exactly once
|
||||
EXPECT_EQ(1u, numPendingBuffers); // since queueBuffer was called exactly once
|
||||
}
|
||||
|
||||
// Buffer was not in the dequeued state
|
||||
|
@ -17,6 +17,10 @@
|
||||
#define LOG_TAG "SRGB_test"
|
||||
//#define LOG_NDEBUG 0
|
||||
|
||||
// Ignore for this file because it flags every instance of
|
||||
// ASSERT_EQ(GL_NO_ERROR, glGetError());
|
||||
#pragma clang diagnostic ignored "-Wsign-compare"
|
||||
|
||||
#include "GLTest.h"
|
||||
|
||||
#include <math.h>
|
||||
@ -329,9 +333,9 @@ private:
|
||||
ANativeWindow_Buffer outBuffer;
|
||||
ARect outBufferBounds;
|
||||
mOutputSurface->lock(&outBuffer, &outBufferBounds);
|
||||
ASSERT_EQ(mLockedBuffer.width, outBuffer.width);
|
||||
ASSERT_EQ(mLockedBuffer.height, outBuffer.height);
|
||||
ASSERT_EQ(mLockedBuffer.stride, outBuffer.stride);
|
||||
ASSERT_EQ(mLockedBuffer.width, static_cast<uint32_t>(outBuffer.width));
|
||||
ASSERT_EQ(mLockedBuffer.height, static_cast<uint32_t>(outBuffer.height));
|
||||
ASSERT_EQ(mLockedBuffer.stride, static_cast<uint32_t>(outBuffer.stride));
|
||||
|
||||
if (mLockedBuffer.format == outBuffer.format) {
|
||||
memcpy(outBuffer.bits, mLockedBuffer.data, bufferSize);
|
||||
@ -401,7 +405,8 @@ TEST_F(SRGBTest, GLRenderFromSRGBTexture) {
|
||||
// the debug surface if necessary
|
||||
}
|
||||
|
||||
TEST_F(SRGBTest, RenderToSRGBSurface) {
|
||||
// XXX: Disabled since we don't currently expect this to work
|
||||
TEST_F(SRGBTest, DISABLED_RenderToSRGBSurface) {
|
||||
ASSERT_NO_FATAL_FAILURE(initShaders());
|
||||
|
||||
// By default, the first buffer we write into will be RGB
|
||||
|
@ -76,6 +76,8 @@ private:
|
||||
int mAllocCount;
|
||||
};
|
||||
|
||||
static const uint32_t TEST_DATA = 0x12345678u;
|
||||
|
||||
TEST_F(StreamSplitterTest, OneInputOneOutput) {
|
||||
sp<CountedAllocator> allocator(new CountedAllocator);
|
||||
|
||||
@ -108,7 +110,7 @@ TEST_F(StreamSplitterTest, OneInputOneOutput) {
|
||||
uint32_t* dataIn;
|
||||
ASSERT_EQ(OK, buffer->lock(GraphicBuffer::USAGE_SW_WRITE_OFTEN,
|
||||
reinterpret_cast<void**>(&dataIn)));
|
||||
*dataIn = 0x12345678;
|
||||
*dataIn = TEST_DATA;
|
||||
ASSERT_EQ(OK, buffer->unlock());
|
||||
|
||||
IGraphicBufferProducer::QueueBufferInput qbInput(0, false,
|
||||
@ -123,7 +125,7 @@ TEST_F(StreamSplitterTest, OneInputOneOutput) {
|
||||
uint32_t* dataOut;
|
||||
ASSERT_EQ(OK, item.mGraphicBuffer->lock(GraphicBuffer::USAGE_SW_READ_OFTEN,
|
||||
reinterpret_cast<void**>(&dataOut)));
|
||||
ASSERT_EQ(*dataOut, 0x12345678);
|
||||
ASSERT_EQ(*dataOut, TEST_DATA);
|
||||
ASSERT_EQ(OK, item.mGraphicBuffer->unlock());
|
||||
|
||||
ASSERT_EQ(OK, outputConsumer->releaseBuffer(item.mBuf, item.mFrameNumber,
|
||||
@ -175,7 +177,7 @@ TEST_F(StreamSplitterTest, OneInputMultipleOutputs) {
|
||||
uint32_t* dataIn;
|
||||
ASSERT_EQ(OK, buffer->lock(GraphicBuffer::USAGE_SW_WRITE_OFTEN,
|
||||
reinterpret_cast<void**>(&dataIn)));
|
||||
*dataIn = 0x12345678;
|
||||
*dataIn = TEST_DATA;
|
||||
ASSERT_EQ(OK, buffer->unlock());
|
||||
|
||||
IGraphicBufferProducer::QueueBufferInput qbInput(0, false,
|
||||
@ -191,7 +193,7 @@ TEST_F(StreamSplitterTest, OneInputMultipleOutputs) {
|
||||
uint32_t* dataOut;
|
||||
ASSERT_EQ(OK, item.mGraphicBuffer->lock(GraphicBuffer::USAGE_SW_READ_OFTEN,
|
||||
reinterpret_cast<void**>(&dataOut)));
|
||||
ASSERT_EQ(*dataOut, 0x12345678);
|
||||
ASSERT_EQ(*dataOut, TEST_DATA);
|
||||
ASSERT_EQ(OK, item.mGraphicBuffer->unlock());
|
||||
|
||||
ASSERT_EQ(OK, outputConsumers[output]->releaseBuffer(item.mBuf,
|
||||
|
@ -207,12 +207,8 @@ TEST_F(SurfaceTextureClientTest, EglSwapBuffersAbandonErrorIsEglBadSurface) {
|
||||
}
|
||||
|
||||
TEST_F(SurfaceTextureClientTest, BufferGeometryInvalidSizesFail) {
|
||||
EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), -1, 0, 0));
|
||||
EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), 0, -1, 0));
|
||||
EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), 0, 0, -1));
|
||||
EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), -1, -1, 0));
|
||||
EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), 0, 8, 0));
|
||||
EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), 8, 0, 0));
|
||||
EXPECT_GT(OK, native_window_set_buffers_dimensions(mANW.get(), 0, 8));
|
||||
EXPECT_GT(OK, native_window_set_buffers_dimensions(mANW.get(), 8, 0));
|
||||
}
|
||||
|
||||
TEST_F(SurfaceTextureClientTest, DefaultGeometryValues) {
|
||||
@ -226,7 +222,8 @@ TEST_F(SurfaceTextureClientTest, DefaultGeometryValues) {
|
||||
|
||||
TEST_F(SurfaceTextureClientTest, BufferGeometryCanBeSet) {
|
||||
ANativeWindowBuffer* buf;
|
||||
EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 16, 8, PIXEL_FORMAT_RGB_565));
|
||||
EXPECT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 16, 8));
|
||||
EXPECT_EQ(OK, native_window_set_buffers_format(mANW.get(), PIXEL_FORMAT_RGB_565));
|
||||
ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf));
|
||||
EXPECT_EQ(16, buf->width);
|
||||
EXPECT_EQ(8, buf->height);
|
||||
@ -236,7 +233,8 @@ TEST_F(SurfaceTextureClientTest, BufferGeometryCanBeSet) {
|
||||
|
||||
TEST_F(SurfaceTextureClientTest, BufferGeometryDefaultSizeSetFormat) {
|
||||
ANativeWindowBuffer* buf;
|
||||
EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 0, 0, PIXEL_FORMAT_RGB_565));
|
||||
EXPECT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 0, 0));
|
||||
EXPECT_EQ(OK, native_window_set_buffers_format(mANW.get(), PIXEL_FORMAT_RGB_565));
|
||||
ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf));
|
||||
EXPECT_EQ(1, buf->width);
|
||||
EXPECT_EQ(1, buf->height);
|
||||
@ -246,7 +244,8 @@ TEST_F(SurfaceTextureClientTest, BufferGeometryDefaultSizeSetFormat) {
|
||||
|
||||
TEST_F(SurfaceTextureClientTest, BufferGeometrySetSizeDefaultFormat) {
|
||||
ANativeWindowBuffer* buf;
|
||||
EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 16, 8, 0));
|
||||
EXPECT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 16, 8));
|
||||
EXPECT_EQ(OK, native_window_set_buffers_format(mANW.get(), 0));
|
||||
ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf));
|
||||
EXPECT_EQ(16, buf->width);
|
||||
EXPECT_EQ(8, buf->height);
|
||||
@ -256,13 +255,15 @@ TEST_F(SurfaceTextureClientTest, BufferGeometrySetSizeDefaultFormat) {
|
||||
|
||||
TEST_F(SurfaceTextureClientTest, BufferGeometrySizeCanBeUnset) {
|
||||
ANativeWindowBuffer* buf;
|
||||
EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 16, 8, 0));
|
||||
EXPECT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 16, 8));
|
||||
EXPECT_EQ(OK, native_window_set_buffers_format(mANW.get(), 0));
|
||||
ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf));
|
||||
EXPECT_EQ(16, buf->width);
|
||||
EXPECT_EQ(8, buf->height);
|
||||
EXPECT_EQ(PIXEL_FORMAT_RGBA_8888, buf->format);
|
||||
ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf, -1));
|
||||
EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 0, 0, 0));
|
||||
EXPECT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 0, 0));
|
||||
EXPECT_EQ(OK, native_window_set_buffers_format(mANW.get(), 0));
|
||||
ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf));
|
||||
EXPECT_EQ(1, buf->width);
|
||||
EXPECT_EQ(1, buf->height);
|
||||
@ -272,7 +273,8 @@ TEST_F(SurfaceTextureClientTest, BufferGeometrySizeCanBeUnset) {
|
||||
|
||||
TEST_F(SurfaceTextureClientTest, BufferGeometrySizeCanBeChangedWithoutFormat) {
|
||||
ANativeWindowBuffer* buf;
|
||||
EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 0, 0, PIXEL_FORMAT_RGB_565));
|
||||
EXPECT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 0, 0));
|
||||
EXPECT_EQ(OK, native_window_set_buffers_format(mANW.get(), PIXEL_FORMAT_RGB_565));
|
||||
ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf));
|
||||
EXPECT_EQ(1, buf->width);
|
||||
EXPECT_EQ(1, buf->height);
|
||||
@ -330,7 +332,8 @@ TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSizeVsGeometry) {
|
||||
EXPECT_EQ(8, buf[1]->height);
|
||||
ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[0], -1));
|
||||
ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[1], -1));
|
||||
EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 12, 24, 0));
|
||||
EXPECT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 12, 24));
|
||||
EXPECT_EQ(OK, native_window_set_buffers_format(mANW.get(), 0));
|
||||
ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[0]));
|
||||
ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[1]));
|
||||
EXPECT_NE(buf[0], buf[1]);
|
||||
@ -468,7 +471,8 @@ TEST_F(SurfaceTextureClientTest, SurfaceTextureSyncModeMinUndequeued) {
|
||||
|
||||
// Once we've queued a buffer, however we should not be able to dequeue more
|
||||
// than (buffer-count - MIN_UNDEQUEUED_BUFFERS), which is 2 in this case.
|
||||
EXPECT_EQ(-EBUSY, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[1]));
|
||||
EXPECT_EQ(INVALID_OPERATION,
|
||||
native_window_dequeue_buffer_and_wait(mANW.get(), &buf[1]));
|
||||
|
||||
ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[0], -1));
|
||||
ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[2], -1));
|
||||
@ -620,7 +624,8 @@ TEST_F(SurfaceTextureClientTest, GetTransformMatrixSucceedsAfterFreeingBuffersWi
|
||||
crop.bottom = 5;
|
||||
|
||||
ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 4));
|
||||
ASSERT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 8, 8, 0));
|
||||
ASSERT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 8, 8));
|
||||
ASSERT_EQ(OK, native_window_set_buffers_format(mANW.get(), 0));
|
||||
ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[0]));
|
||||
ASSERT_EQ(OK, native_window_set_crop(mANW.get(), &crop));
|
||||
ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0], -1));
|
||||
@ -668,7 +673,8 @@ TEST_F(SurfaceTextureClientTest, QueryFormatAfterSettingWorks) {
|
||||
const int numFmts = (sizeof(fmts) / sizeof(fmts[0]));
|
||||
for (int i = 0; i < numFmts; i++) {
|
||||
int fmt = -1;
|
||||
ASSERT_EQ(OK, native_window_set_buffers_geometry(anw.get(), 0, 0, fmts[i]));
|
||||
ASSERT_EQ(OK, native_window_set_buffers_dimensions(anw.get(), 0, 0));
|
||||
ASSERT_EQ(OK, native_window_set_buffers_format(anw.get(), fmts[i]));
|
||||
ASSERT_EQ(OK, anw->query(anw.get(), NATIVE_WINDOW_FORMAT, &fmt));
|
||||
EXPECT_EQ(fmts[i], fmt);
|
||||
}
|
||||
|
@ -27,8 +27,10 @@ TEST_F(SurfaceTextureFBOTest, BlitFromCpuFilledBufferToFbo) {
|
||||
const int texWidth = 64;
|
||||
const int texHeight = 64;
|
||||
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(),
|
||||
texWidth, texHeight, HAL_PIXEL_FORMAT_RGBA_8888));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_dimensions(mANW.get(),
|
||||
texWidth, texHeight));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(),
|
||||
HAL_PIXEL_FORMAT_RGBA_8888));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
|
||||
GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));
|
||||
|
||||
|
@ -28,8 +28,10 @@ TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferNpot) {
|
||||
const int texWidth = 64;
|
||||
const int texHeight = 66;
|
||||
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(),
|
||||
texWidth, texHeight, HAL_PIXEL_FORMAT_YV12));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_dimensions(mANW.get(),
|
||||
texWidth, texHeight));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(),
|
||||
HAL_PIXEL_FORMAT_YV12));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
|
||||
GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));
|
||||
|
||||
@ -74,8 +76,10 @@ TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferPow2) {
|
||||
const int texWidth = 64;
|
||||
const int texHeight = 64;
|
||||
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(),
|
||||
texWidth, texHeight, HAL_PIXEL_FORMAT_YV12));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_dimensions(mANW.get(),
|
||||
texWidth, texHeight));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(),
|
||||
HAL_PIXEL_FORMAT_YV12));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
|
||||
GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));
|
||||
|
||||
@ -120,8 +124,10 @@ TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferWithCrop) {
|
||||
const int texWidth = 64;
|
||||
const int texHeight = 66;
|
||||
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(),
|
||||
texWidth, texHeight, HAL_PIXEL_FORMAT_YV12));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_dimensions(mANW.get(),
|
||||
texWidth, texHeight));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(),
|
||||
HAL_PIXEL_FORMAT_YV12));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
|
||||
GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));
|
||||
|
||||
@ -185,8 +191,10 @@ TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BuffersRepeatedly) {
|
||||
enum { numFrames = 1024 };
|
||||
|
||||
ASSERT_EQ(NO_ERROR, mST->setDefaultMaxBufferCount(2));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(),
|
||||
texWidth, texHeight, HAL_PIXEL_FORMAT_YV12));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_dimensions(mANW.get(),
|
||||
texWidth, texHeight));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(),
|
||||
HAL_PIXEL_FORMAT_YV12));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
|
||||
GRALLOC_USAGE_SW_WRITE_OFTEN));
|
||||
|
||||
@ -326,8 +334,10 @@ TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledRGBABufferNpot) {
|
||||
const int texWidth = 64;
|
||||
const int texHeight = 66;
|
||||
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(),
|
||||
texWidth, texHeight, HAL_PIXEL_FORMAT_RGBA_8888));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_dimensions(mANW.get(),
|
||||
texWidth, texHeight));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(),
|
||||
HAL_PIXEL_FORMAT_RGBA_8888));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
|
||||
GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));
|
||||
|
||||
@ -368,8 +378,10 @@ TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledRGBABufferPow2) {
|
||||
const int texWidth = 64;
|
||||
const int texHeight = 64;
|
||||
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(),
|
||||
texWidth, texHeight, HAL_PIXEL_FORMAT_RGBA_8888));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_dimensions(mANW.get(),
|
||||
texWidth, texHeight));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(),
|
||||
HAL_PIXEL_FORMAT_RGBA_8888));
|
||||
ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
|
||||
GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user