blob: 9ed29d337198893abc2e0e6b453cc3b63a54b133 [file] [log] [blame]
David Ghandeharib1536522017-05-24 00:01:15 -07001//
2// Copyright 2015 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6// ObjectAllocationTest
7// Tests for object allocations and lifetimes.
8//
9
10#include "test_utils/ANGLETest.h"
11
12using namespace angle;
13
14namespace
15{
16
17class ObjectAllocationTest : public ANGLETest
18{
19 protected:
20 ObjectAllocationTest() {}
21};
22
23// Test that we don't re-allocate a bound framebuffer ID.
24TEST_P(ObjectAllocationTest, BindFramebufferBeforeGen)
25{
26 glBindFramebuffer(GL_FRAMEBUFFER, 1);
27 GLuint fbo = 0;
28 glGenFramebuffers(1, &fbo);
29 EXPECT_NE(1u, fbo);
30 glDeleteFramebuffers(1, &fbo);
31 EXPECT_GL_NO_ERROR();
32}
33
34// Test that we don't re-allocate a bound framebuffer ID, other pattern.
35TEST_P(ObjectAllocationTest, BindFramebufferAfterGen)
36{
37 GLuint firstFBO = 0;
38 glGenFramebuffers(1, &firstFBO);
39 glBindFramebuffer(GL_FRAMEBUFFER, 1);
40 glDeleteFramebuffers(1, &firstFBO);
41
42 glBindFramebuffer(GL_FRAMEBUFFER, 2);
43 GLuint secondFBOs[2] = {0};
44 glGenFramebuffers(2, secondFBOs);
45 EXPECT_NE(2u, secondFBOs[0]);
46 EXPECT_NE(2u, secondFBOs[1]);
47 glDeleteFramebuffers(2, secondFBOs);
48
49 EXPECT_GL_NO_ERROR();
50}
51
52} // anonymous namespace
53
Kaido Kert612c0202020-01-22 10:28:42 -080054ANGLE_INSTANTIATE_TEST_ES3(ObjectAllocationTest);