Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: ui/gl/gl_surface_format_unittest.cc

Issue 2616723002: Refactor GL surface format handling (Closed)
Patch Set: Fix copyright notice on new files Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gl/gl_surface_format.cc ('k') | ui/gl/gl_surface_glx.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "ui/gl/gl_surface_format.h"
7
8 namespace gl {
9
10 TEST(GLSurfaceFormatTest, BasicTest) {
11 {
12 // Check default format properties.
13 GLSurfaceFormat format = GLSurfaceFormat();
14 EXPECT_TRUE(format.IsDefault());
15 EXPECT_EQ(32, format.GetBufferSize());
16 EXPECT_FALSE(format.IsSurfaceless());
17 EXPECT_EQ(GLSurfaceFormat::PIXEL_LAYOUT_DONT_CARE,
18 format.GetPixelLayout());
19 }
20
21 {
22 // Check rgb565 format as used for low-end Android devices.
23 GLSurfaceFormat format = GLSurfaceFormat();
24 format.SetRGB565();
25 EXPECT_FALSE(format.IsDefault());
26 EXPECT_EQ(16, format.GetBufferSize());
27 }
28
29 {
30 // Check surfaceless format.
31 GLSurfaceFormat format = GLSurfaceFormat();
32 format.SetIsSurfaceless();
33 EXPECT_FALSE(format.IsDefault());
34 EXPECT_TRUE(format.IsSurfaceless());
35 }
36
37 {
38 // Check custom pixel layout.
39 GLSurfaceFormat format = GLSurfaceFormat(
40 GLSurfaceFormat::PIXEL_LAYOUT_RGBA);
41 EXPECT_FALSE(format.IsDefault());
42 EXPECT_EQ(GLSurfaceFormat::PIXEL_LAYOUT_RGBA,
43 format.GetPixelLayout());
44
45 // The custom pixel layout should remain after other modifications.
46 format.SetDepthBits(24);
47 EXPECT_EQ(GLSurfaceFormat::PIXEL_LAYOUT_RGBA,
48 format.GetPixelLayout());
49 EXPECT_EQ(24, format.GetDepthBits());
50 }
51
52 {
53 // Check IsCompatible
54 GLSurfaceFormat format = GLSurfaceFormat();
55 EXPECT_TRUE(format.IsCompatible(GLSurfaceFormat()));
56
57 GLSurfaceFormat other = GLSurfaceFormat();
58 other.SetRGB565();
59 EXPECT_FALSE(format.IsCompatible(other));
60 EXPECT_TRUE(other.IsCompatible(other));
61 }
62 }
63
64 }
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_format.cc ('k') | ui/gl/gl_surface_glx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698