gfx/tests/gtest/TestGfxPrefs.cpp

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:e58916932c2a
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #include "gtest/gtest.h"
7
8 #include "gfxPrefs.h"
9 #ifdef GFX_DECL_PREF
10 #error "This is not supposed to be defined outside of gfxPrefs.h"
11 #endif
12
13 // If the default values for any of these preferences change,
14 // just modify the test to match. We are only testing against
15 // a particular value to make sure we receive the correct
16 // result through this API.
17
18 TEST(GfxPrefs, Singleton) {
19 ASSERT_FALSE(gfxPrefs::SingletonExists());
20 gfxPrefs::GetSingleton();
21 ASSERT_TRUE(gfxPrefs::SingletonExists());
22 gfxPrefs::DestroySingleton();
23 ASSERT_FALSE(gfxPrefs::SingletonExists());
24 }
25
26 TEST(GfxPrefs, LiveValues) {
27 ASSERT_FALSE(gfxPrefs::SingletonExists());
28 gfxPrefs::GetSingleton();
29 ASSERT_TRUE(gfxPrefs::SingletonExists());
30
31 // Live boolean, default false
32 ASSERT_FALSE(gfxPrefs::CanvasAzureAccelerated());
33
34 // Live int32_t, default 23456
35 ASSERT_TRUE(gfxPrefs::LayerScopePort() == 23456);
36
37 // Live uint32_t, default 2
38 ASSERT_TRUE(gfxPrefs::MSAALevel() == 2);
39
40 gfxPrefs::DestroySingleton();
41 ASSERT_FALSE(gfxPrefs::SingletonExists());
42 }
43
44 TEST(GfxPrefs, OnceValues) {
45 ASSERT_FALSE(gfxPrefs::SingletonExists());
46 gfxPrefs::GetSingleton();
47 ASSERT_TRUE(gfxPrefs::SingletonExists());
48
49 // Once boolean, default true
50 ASSERT_TRUE(gfxPrefs::WorkAroundDriverBugs());
51
52 // Once boolean, default false
53 ASSERT_FALSE(gfxPrefs::LayersDump());
54
55 // Once int32_t, default 95
56 ASSERT_TRUE(gfxPrefs::CanvasSkiaGLCacheSize() == 96);
57
58 // Once uint32_t, default 5
59 ASSERT_TRUE(gfxPrefs::APZMaxVelocityQueueSize() == 5);
60
61 // Once float, default -1 (should be OK with ==)
62 ASSERT_TRUE(gfxPrefs::APZMaxVelocity() == -1.0f);
63
64 gfxPrefs::DestroySingleton();
65 ASSERT_FALSE(gfxPrefs::SingletonExists());
66 }
67

mercurial