TestDisplayPort.cpp (1203B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #include "apz/src/AsyncPanZoomController.h" 8 #include "mozilla/StaticPrefs_apz.h" 9 #include "gtest/gtest.h" 10 11 using namespace mozilla; 12 13 // Tests that display port size is monotonically increased depending on the 14 // composition size. 15 TEST(DisplayPortTest, MonotonicIncrease) 16 { 17 CSSSize compositionSize(1000, 1000); 18 CSSToScreenScale2D dPPerCSS = CSSToScreenScale2D(1.0, 1.0); 19 20 CSSSize previousDisplayport; 21 for (int32_t height = 100; height <= 3000; height++) { 22 compositionSize.height = CSSCoord(height); 23 CSSSize displayport = 24 layers::AsyncPanZoomController::CalculateDisplayPortSize( 25 compositionSize, CSSPoint(), 26 layers::AsyncPanZoomController::ZoomInProgress::No, dPPerCSS); 27 if (!previousDisplayport.IsEmpty()) { 28 EXPECT_GT(displayport.height, previousDisplayport.height); 29 } 30 previousDisplayport = displayport; 31 } 32 }