gfx/tests/gtest/TestGfxPrefs.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     6 #include "gtest/gtest.h"
     8 #include "gfxPrefs.h"
     9 #ifdef GFX_DECL_PREF
    10 #error "This is not supposed to be defined outside of gfxPrefs.h"
    11 #endif
    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.
    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 }
    26 TEST(GfxPrefs, LiveValues) {
    27   ASSERT_FALSE(gfxPrefs::SingletonExists());
    28   gfxPrefs::GetSingleton();
    29   ASSERT_TRUE(gfxPrefs::SingletonExists());
    31   // Live boolean, default false
    32   ASSERT_FALSE(gfxPrefs::CanvasAzureAccelerated());
    34   // Live int32_t, default 23456
    35   ASSERT_TRUE(gfxPrefs::LayerScopePort() == 23456);
    37   // Live uint32_t, default 2
    38   ASSERT_TRUE(gfxPrefs::MSAALevel() == 2);
    40   gfxPrefs::DestroySingleton();
    41   ASSERT_FALSE(gfxPrefs::SingletonExists());
    42 }
    44 TEST(GfxPrefs, OnceValues) {
    45   ASSERT_FALSE(gfxPrefs::SingletonExists());
    46   gfxPrefs::GetSingleton();
    47   ASSERT_TRUE(gfxPrefs::SingletonExists());
    49   // Once boolean, default true
    50   ASSERT_TRUE(gfxPrefs::WorkAroundDriverBugs());
    52   // Once boolean, default false
    53   ASSERT_FALSE(gfxPrefs::LayersDump());
    55   // Once int32_t, default 95
    56   ASSERT_TRUE(gfxPrefs::CanvasSkiaGLCacheSize() == 96);
    58   // Once uint32_t, default 5
    59   ASSERT_TRUE(gfxPrefs::APZMaxVelocityQueueSize() == 5);
    61   // Once float, default -1 (should be OK with ==)
    62   ASSERT_TRUE(gfxPrefs::APZMaxVelocity() == -1.0f);
    64   gfxPrefs::DestroySingleton();
    65   ASSERT_FALSE(gfxPrefs::SingletonExists());
    66 }

mercurial