gecko/dom/manifest/test/test_ImageObjectProcessor_density.html
Marcos Caceres 3b450f1632 Bug 1162808 - Add splash_screens support to web manifest processor. r=ehsan
* Took IconsProcessor out of ManifestProcessor.
* Converted IconsProcessor into ImageObjectProcessor.
* Made extractValue a separate resource, as it's used by multiple
  processors.
* Taught manifest processor about splash_screens.
* icons member now uses ImageObjectProcessor.
* Icon tests are now ImageProcessor tests.
* Fixed a few typos.
2015-05-19 08:20:00 -04:00

58 lines
2.0 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1079453
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1079453</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script src="common.js"></script>
<script>
/**
* Image object density member
* https://w3c.github.io/manifest/#density-member
**/
'use strict';
var testIcon = {
icons: [{
src: 'test',
density: undefined
}]
};
var iconDensityValueTests = [null, {},
[], false, '', -0, '-0', -1.0000, -123131132, -1.2e+200,
'Infinity', '-Infinity',
'-1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
'1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
];
iconDensityValueTests.forEach((density) => {
var expected = `Expect density to default to 1.0.`;
testIcon.icons[0].density = density;
data.jsonText = JSON.stringify(testIcon);
var result = processor.process(data);
is(result.icons[0].density, 1.0, expected);
});
testIcon = {
icons: [{
src: 'test',
density: undefined
}]
};
var parseFloatTests = [3.14, '3.14', `${whiteSpace}3.14${whiteSpace}`, 12e300];
parseFloatTests.forEach((testNumber) => {
var expected = `Expect density to be ${parseFloat(testNumber)}.`;
testIcon.icons[0].density = testNumber;
data.jsonText = JSON.stringify(testIcon);
var result = processor.process(data);
is(result.icons[0].density, parseFloat(testNumber), expected);
});
</script>
</head>