michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "gtest/gtest.h" michael@0: michael@0: #include "gfxPrefs.h" michael@0: #ifdef GFX_DECL_PREF michael@0: #error "This is not supposed to be defined outside of gfxPrefs.h" michael@0: #endif michael@0: michael@0: // If the default values for any of these preferences change, michael@0: // just modify the test to match. We are only testing against michael@0: // a particular value to make sure we receive the correct michael@0: // result through this API. michael@0: michael@0: TEST(GfxPrefs, Singleton) { michael@0: ASSERT_FALSE(gfxPrefs::SingletonExists()); michael@0: gfxPrefs::GetSingleton(); michael@0: ASSERT_TRUE(gfxPrefs::SingletonExists()); michael@0: gfxPrefs::DestroySingleton(); michael@0: ASSERT_FALSE(gfxPrefs::SingletonExists()); michael@0: } michael@0: michael@0: TEST(GfxPrefs, LiveValues) { michael@0: ASSERT_FALSE(gfxPrefs::SingletonExists()); michael@0: gfxPrefs::GetSingleton(); michael@0: ASSERT_TRUE(gfxPrefs::SingletonExists()); michael@0: michael@0: // Live boolean, default false michael@0: ASSERT_FALSE(gfxPrefs::CanvasAzureAccelerated()); michael@0: michael@0: // Live int32_t, default 23456 michael@0: ASSERT_TRUE(gfxPrefs::LayerScopePort() == 23456); michael@0: michael@0: // Live uint32_t, default 2 michael@0: ASSERT_TRUE(gfxPrefs::MSAALevel() == 2); michael@0: michael@0: gfxPrefs::DestroySingleton(); michael@0: ASSERT_FALSE(gfxPrefs::SingletonExists()); michael@0: } michael@0: michael@0: TEST(GfxPrefs, OnceValues) { michael@0: ASSERT_FALSE(gfxPrefs::SingletonExists()); michael@0: gfxPrefs::GetSingleton(); michael@0: ASSERT_TRUE(gfxPrefs::SingletonExists()); michael@0: michael@0: // Once boolean, default true michael@0: ASSERT_TRUE(gfxPrefs::WorkAroundDriverBugs()); michael@0: michael@0: // Once boolean, default false michael@0: ASSERT_FALSE(gfxPrefs::LayersDump()); michael@0: michael@0: // Once int32_t, default 95 michael@0: ASSERT_TRUE(gfxPrefs::CanvasSkiaGLCacheSize() == 96); michael@0: michael@0: // Once uint32_t, default 5 michael@0: ASSERT_TRUE(gfxPrefs::APZMaxVelocityQueueSize() == 5); michael@0: michael@0: // Once float, default -1 (should be OK with ==) michael@0: ASSERT_TRUE(gfxPrefs::APZMaxVelocity() == -1.0f); michael@0: michael@0: gfxPrefs::DestroySingleton(); michael@0: ASSERT_FALSE(gfxPrefs::SingletonExists()); michael@0: } michael@0: