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