Fix a test failing in Firefox by decreasing the precision expected

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2075 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Jeff Schiller 2012-03-31 17:55:01 +00:00
parent 5c1227997b
commit b0aa96bdec
4 changed files with 105 additions and 16 deletions

View File

@ -1,4 +1,4 @@
body {
body {
background: #D0D0D0;
}
@ -222,19 +222,29 @@ html, body, div{
border-width: 1px;
border-left: none;
}
#svg_editor #layerpanel {
#svg_editor #sidepanels #toolpalettes{
display: inline-block;
position:absolute;
top: 1px;
bottom: 0px;
right: 0px;
width: 0px;
padding: 10px;
top: 0;
bottom: 0;
right: 0;
left:0;
overflow-y:auto;
overflow-x:hidden;
display:none;
}
#svg_editor #sidepanels .toolpalette{
padding-left:10px;
margin-right:10px;
margin-bottom:10px;
display:none;
overflow: auto;
margin: 0px;
-moz-user-select: none;
-webkit-user-select: none;
border-top:2px solid gray;
width:100%;
}
/*

View File

@ -55,6 +55,48 @@
<!-- Add script with custom handlers here -->
<title>SVG-edit</title>
<style>
#samplepalette{
overflow:hide;
}
#samplepalette ul{
padding-left: 5px;
}
#samplepalette #palettecontents{
height:700px;
width:250px;
overflow-y:auto;
}
#samplepalette li{
list-style: none;
padding-top: 10px;
padding-left:5px;
padding-bottom: 10px;
font-size: 14px;
border: 1px solid black;
border-top: 0px;
cursor:pointer;
}
#samplepalette li:hover {
background-color: #FFFFC2;
border-left:1px solid #FBD0AD;
border-top:1px solid #FBD0AD;
border-right:1px solid #D79861;
border-bottom:1px solid #D79861;
}
#samplepalette li:first-child {
border: 1px solid black;
}
#samplepalette li:first-child:hover {
background-color: #FFFFC2;
border-left:1px solid #FBD0AD;
border-top:1px solid #FBD0AD;
border-right:1px solid #D79861;
border-bottom:1px solid #D79861;
}
</style>
</head>
<body>
<div id="svg_editor">
@ -81,7 +123,8 @@
</div>
<div id="sidepanels">
<div id="layerpanel">
<div id="toolpalettes">
<div id="layerpanel" class="toolpalette">
<h3 id="layersLabel">Layers</h3>
<fieldset id="layerbuttons">
<div id="layer_new" class="layer_button" title="New Layer"></div>
@ -103,7 +146,41 @@
<option selected="selected" value="layer1">Layer 1</option>
</select>
</div>
<div id="sidepanel_handle" title="Drag left/right to resize side panel [X]">L a y e r s</div>
<div id="samplepalette" class="toolpalette">
<h3 id="samplepalettelabel">Sample Palette</h3>
<div id="palettecontents">
<ul>
<li>Alligator</li>
<li>Bear</li>
<li>Catfish</li>
<li>Donkey</li>
<li>Eagle</li>
<li>Firemouth</li>
<li>Gecko</li>
<li>Hippopotomus</li>
<li>Ibex</li>
<li>Jaguar</li>
<li>Komodo Dragon</li>
<li>Lobster</li>
<li>Mouse</li>
<li>Narwhal</li>
<li>Octopus</li>
<li>Possum</li>
<li>Quail</li>
<li>Rhinoceros</li>
<li>Snake</li>
<li>Turtle</li>
<li>Unicorn</li>
<li>Velociraptor</li>
<li>Warthog</li>
<li>Xeme</li>
<li>Yak</li>
<li>Zebra</li>
</ul>
</div>
</div>
</div>
<div id="sidepanel_handle" title="Drag left/right to resize side panel [X]">P a l e t t e s</div>
</div>
<div id="main_button">

View File

@ -3744,7 +3744,7 @@
});
var SIDEPANEL_MAXWIDTH = 300;
var SIDEPANEL_OPENWIDTH = 150;
var SIDEPANEL_OPENWIDTH = 300;
var sidedrag = -1, sidedragging = false, allowmove = false;
var resizePanel = function(evt) {
@ -3801,13 +3801,15 @@
// the optional close argument forces the side panel closed
var toggleSidePanel = function(close){
var w = parseInt($('#sidepanels').css('width'));
var deltax = (w > 2 || close ? 2 : SIDEPANEL_OPENWIDTH) - w;
var alreadyOpen = w > 2;
var deltax = (alreadyOpen || close ? 2 : SIDEPANEL_OPENWIDTH) - w;
var sidepanels = $('#sidepanels');
var layerpanel = $('#layerpanel');
var palettes = $('.toolpalette');
var ruler_x = $('#ruler_x');
workarea.css('right', parseInt(workarea.css('right')) + deltax);
sidepanels.css('width', parseInt(sidepanels.css('width')) + deltax);
layerpanel.css('width', parseInt(layerpanel.css('width')) + deltax);
palettes.css('display', alreadyOpen ? 'none':'inherit');
$('#toolpalettes').css('display', alreadyOpen ? 'none':'inherit');
ruler_x.css('right', parseInt(ruler_x.css('right')) + deltax);
};

View File

@ -24,7 +24,7 @@
var svgroot = document.getElementById('svgroot');
var svgcontent, rect, circle;
var NEAR_ZERO = 1e-7;
var NEAR_ZERO = 5e-6; // 0.000005, Firefox fails at higher levels of precision.
function almostEquals(a, b, msg) {
msg = msg || (a + ' did not equal ' + b);
ok(Math.abs(a - b) < NEAR_ZERO, msg);