1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/themes/osx/reftests/nostretch.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,110 @@ 1.4 +<?xml version="1.0"?> 1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> 1.6 + 1.7 +<!-- 1.8 + * This test tests whether you can put different widgets in the same 1.9 + * hbox without stretching them, even if you don't set align="center". 1.10 + * I.e. prior to the fix that added this patch, having a button and a 1.11 + * menulist in the same hbox next to each other would stretch the menulist 1.12 + * vertically because the button had such a big vertical margin. 1.13 + * 1.14 + * The test works like this: Two widgets are placed in a hbox, and the second 1.15 + * widget is visibility: hidden. In the reference (nostretch-ref.xul), the 1.16 + * second widget is display: none. If test and reference look the same, 1.17 + * adding the second widget hasn't affected the appearance of the first widget, 1.18 + * and everything's fine. 1.19 + * --> 1.20 +<window title="Stretched controls test" 1.21 + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 1.22 + xmlns:html="http://www.w3.org/1999/xhtml" 1.23 + xmlns:svg="http://www.w3.org/2000/svg" 1.24 + orient="vertical" 1.25 + class="reftest-wait" 1.26 + onload="loaded()"> 1.27 + 1.28 +<html:style><![CDATA[ 1.29 +.regular { 1.30 + font: -moz-dialog; 1.31 +} 1.32 +.small { 1.33 + font: message-box; 1.34 +} 1.35 +.spacer { 1.36 + height: 40px; 1.37 +} 1.38 +.foreground > :nth-child(2) { 1.39 + visibility: hidden; 1.40 +} 1.41 +]]> 1.42 +</html:style> 1.43 + 1.44 +<script type="application/javascript;version=1.8"><![CDATA[ 1.45 + 1.46 +function cE(elem) { 1.47 + return document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", elem); 1.48 +} 1.49 +function elWithValue(elem, val) { 1.50 + let e = cE(elem); 1.51 + e.setAttribute(elem == "label" || elem == "textbox" ? "value" : "label", val); 1.52 + return e; 1.53 +} 1.54 + 1.55 +function allPairs(set) { 1.56 + let ps = []; 1.57 + for(let i = 0; i < set.length; ++i) { 1.58 + for (let j = 0; j < set.length; ++j) { 1.59 + if (i != j) 1.60 + ps.push([set[i], set[j]]); 1.61 + } 1.62 + } 1.63 + return ps; 1.64 +} 1.65 + 1.66 +function createLabel(v) elWithValue("label", v) 1.67 +function createRadio(v) elWithValue("radio", v) 1.68 +function createCheckbox(v) elWithValue("checkbox", v) 1.69 +function createButton(v) elWithValue("button", v) 1.70 +function createTextField(v) elWithValue("textbox", v) 1.71 +function createMenulist(v) { 1.72 + let [list, popup, item] = [cE("menulist"), cE("menupopup"), elWithValue("menuitem", v)]; 1.73 + item.setAttribute("selected", "true"); 1.74 + popup.appendChild(item); 1.75 + list.appendChild(popup); 1.76 + return list; 1.77 +} 1.78 +function createEditableMenulist(v) { 1.79 + let list = createMenulist(v); 1.80 + list.setAttribute("editable", "true"); 1.81 + return list; 1.82 +} 1.83 +function loaded() { 1.84 + let template = document.getElementById("template"); 1.85 + ["regular", "small"].forEach(function(size) { 1.86 + let wrapper = document.querySelectorAll("#wrapper > ." + size)[0]; 1.87 + allPairs([ 1.88 + createButton, createMenulist, createTextField, createEditableMenulist, 1.89 + ]).forEach(function(elemList) { 1.90 + let newBox = template.cloneNode(true); 1.91 + newBox.className = "spacer"; 1.92 + let foregroundRow = newBox.firstChild; 1.93 + elemList.forEach(function(creator) { 1.94 + foregroundRow.appendChild(creator("Label")); 1.95 + }); 1.96 + wrapper.appendChild(newBox); 1.97 + }); 1.98 + }); 1.99 + document.documentElement.className = ""; 1.100 +} 1.101 + 1.102 +]]></script> 1.103 + <vbox id="template"> 1.104 + <hbox class="foreground"/> 1.105 + </vbox> 1.106 + <hbox id="wrapper"> 1.107 + <vbox class="regular" width="500"/> 1.108 + <vbox class="small" flex="1"/> 1.109 + </hbox> 1.110 + 1.111 + <spacer flex="1"/> 1.112 + 1.113 +</window>