2015-04-24 12:15:11 -07:00
|
|
|
/**
|
2018-03-08 12:02:45 -08:00
|
|
|
* Copyright (c) 2004-present, Facebook, Inc.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2018-05-10 19:06:46 -07:00
|
|
|
*
|
|
|
|
* @format
|
2015-04-24 12:15:11 -07:00
|
|
|
*/
|
|
|
|
|
2016-01-27 18:14:12 -08:00
|
|
|
'use strict';
|
2015-04-24 12:15:11 -07:00
|
|
|
|
2016-01-27 18:14:12 -08:00
|
|
|
const PixelRatio = {
|
2016-04-27 19:15:28 -07:00
|
|
|
get: jest.fn().mockReturnValue(2),
|
|
|
|
getFontScale: jest.fn(() => PixelRatio.get()),
|
2018-05-10 19:06:46 -07:00
|
|
|
getPixelSizeForLayoutSize: jest.fn(layoutSize =>
|
|
|
|
Math.round(layoutSize * PixelRatio.get()),
|
|
|
|
),
|
2016-04-27 19:15:28 -07:00
|
|
|
roundToNearestPixel: jest.fn(layoutSize => {
|
|
|
|
const ratio = PixelRatio.get();
|
|
|
|
return Math.round(layoutSize * ratio) / ratio;
|
|
|
|
}),
|
|
|
|
startDetecting: jest.fn(),
|
2015-04-24 12:15:11 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = PixelRatio;
|