Best Python code snippet using unittest-xml-reporting_python
skins.js
Source:skins.js
12/*3 * PERGOLA - JAVASCRIPT SVG FRAMEWORK AND LIBRARIES4 *5 * SKINS LIBRARY6 *7 * Copyright (C) 2009-2013 Dotuscomus8 * info@dotuscomus.com9 * http://www.dotuscomus.com/pergola/licenses10*/111213pergola.skins = {14 rubber : function () {15 var defs = pergola.defs,16 shade = pergola.color.shade,17 gradient,18 pattern,19 luminosity;2021 pergola.color.lab(pergola.color.convert(pergola.theme));22 luminosity = pergola.themeLuminosity;2324 pergola.presentationAttributes = {25 all : {26 'font-family' : "'Segoe UI', 'Trebuchet MS', 'Lucida Grande', 'Deja Vu'",27 'font-size' : 13,28 stroke : "#7F7F7F"29 },30 background : {31 fill : "white",32 stroke : "none",33 opacity : .5,34 'xlink:href' : ""35 },36 button : {37 fill : "url(#buttonGrad)",38 stroke : "#878787",39 maskFill : "url(#buttonMaskGrad)",40 large : {41 width : 20,42 height : 2043 },44 small : {45 width : 14,46 height : 1447 }48 },49 checkBox : {50 width : 13,51 height : 13,52 fill : "white"53 },54 colorBoxSelector : {55 fill : "#FFFFFF",56 stroke : "#B0B0B0",57 width : 216,58 height : 2159 },60 comboBox : {61 width : 220,62 height : 160,63 listItemHeight : 21,64 listMargin : 865 },66 commandButton : {67 width : 15,68 height : 13,69 rx : 370 },71 coordinates : {72 "font-size" : 1273 },74 dialogButton : {75 width : 64,76 height : 25,77 rx : 378 },79 frame : {80 width : 200,81 height : 200,82 fill : shade([90, 90, 90]),83 stroke : shade([90, 90, 90], -24),84 'fill-opacity' : function () {85 var c = pergola.color.hexToRGB(pergola.presentationAttributes.background.fill);86 var lum = pergola.color.luminosity(c[0], c[1], c[2]);87 return (.2 + .15 * (lum < luminosity));88 },89 'stroke-opacity' : function () {90 var c = pergola.color.hexToRGB(pergola.presentationAttributes.background.fill);91 var lum = pergola.color.luminosity(c[0], c[1], c[2]);92 return (.3 + .3 * (lum < luminosity));93 },94 rx : 395 },96 input : {97 width : 36,98 height : 20,99 fill : "#FFFFFF",100 stroke : "#A0A0A0",101 hasButtons : true102 },103 inputCursor : {104 blinkRate : 750105 },106 legend : {107 'font-size' : '12px'108 },109 listItem : {110 fill : "url(#listItemGrad)",111 maskFill : "#FBFBFB"112 },113 menu : {114 'font-size' : '12px',115 fill : "url(#menuGrad)",116 stroke : shade([100, 100, 100], -4),117 rx : 3,118 opacity : 0.4119 },120 menuBar : {121 "font-size" : "12px",122 height : 19,123 fill : "url(#menubarGrad)"124 },125 menuItem : {126 height : 19,127 fill : "url(#listItemGrad)"128 },129 menuList : {130 margin : 15,131 filter : pergola.filter.blur({stdDeviation : 1.4, dx : 2.8, dy : 2.8, "flood-opacity" : .42})132 },133 notification : {134 x : 440,135 y : 340,136 width : 360,137 height : 220,138 fill : "white"139 },140 panel : {141 x : 150,142 y : 120,143 width : 440,144 height : 360,145 margin : 4,146 fill : "#ebecec",147 footerFill : "#ebecec",148 footerHeight : 60,149 filter : pergola.filter.blur()150 },151 popupList : {152 width : 200,153 listItemHeight : 20,154 listMargin : 8155 },156 preview : {157 rx : 2,158 width : 150,159 height : 120,160 opacity : .5161 },162 progress : {163 fill : "#F0F0F0",164 stroke : "#E0E0E0",165 statusFill : "url(#progressGrad)",166 width : 300,167 height : 12168 },169 quickTip : {170 'font-size' : '8pt',171 rx : 6,172 fill : "url(#quickTipGrad)",173 stroke : "#989898",174 textFill : "#242424",175 delay : 700176 },177 radioButton : {178 r : 7,179 dotR : 3,180 fill : "url(#radioButtonGrad)",181 stroke : "#808080",182 dotFill : "#303030"183 },184 rubberBox : {185 stroke : "black",186 'stroke-width' : 1,187 'stroke-dasharray' : "1,2",188 maskStroke : "white"189 },190 scrollBar : {191 fill : shade([100, 100, 100], 40),192 stroke : "#D0D0D0",193 horTrackFill : "url(#hTrackGrad)",194 vertTrackFill : "url(#vTrackGrad)",195 rx : 0,196 size : 15,197 padding : 1.5,198 delay : 250,199 stepFrequence : 50,200 step : 40,201 pageFrequence : 100,202 mapPageFrequence : 500203 },204 scrollSlider : {205 fill : {206 horizontal : "url(#sliderPattern)",207 vertical : "url(#sliderPattern)"208 },209 rx : 0,210 stroke : {211 horizontal : shade([100, 100, 100]),212 vertical : shade([100, 100, 100])213 }214 },215 selector : {216 'font-size' : "9pt",217 fill : "#F5F5F6",218 stroke : "#B0B0B0",219 maskFill : "#B0B0B0",220 'stroke-width' : 2,221 rx : 5,222 width : 216,223 height : 21224 },225 separator : {226 width : 13,227 height : 5228 },229 slider : {230 'font-size' : "7pt",231 rx : 2,232 fill : "url(#sliderButtonGrad)",233 stroke : "#FFFFFF",234 trackFill : "#C0C0C0",235 trackStroke : "none",236 trackOpacity : .05,237 slotStroke : "#606060",238 slotSize : 1,239 shape : "round",240 size : 16,241 type : "linear",242 initial : "middle",243 valueTip : false244 },245 statusBar : {246 fill : "url(#statusBarGrad)",247 height : 20,248 "font-size" : "10px",249 advanceX : 10250 },251 tab : {252 'font-size' : '8pt',253 fill : "url(#tabGrad)",254 'fill-opacity' : .5,255 width : 120,256 height : 18.5257 },258 taskBar : {259 fill : "url(#taskbarGrad)",260 maskFill : shade([100, 100, 100], 20),261 width : "100%",262 height : 32,263 position : "top",264 hasMenu : false265 },266 text : {267 fill : (luminosity < 128)? "white" : "#000000",268 fillInverse : (luminosity < 128)? "#000000" : "#FFFFFF",269 shadow : (luminosity < 128)? "#000000" : shade([82, 84, 85.5], luminosity / 4)270 },271 toolBar : {272 fill : "url(#toolbarGrad)",273 height : 29,274 rx : 0,275 spacing : 5276 },277 toolButton : {278 fill : "url(#buttonGrad)",279 stroke : "url(#toolButtonStrokeGrad)",280 maskFill : "url(#toolButtonMaskGrad)",281 rx : 6282 },283 topBar : {284 fill : {285 panel : "url(#topBarGrad)",286 window : "url(#winTopBarGrad)",287 messageBox : "url(#alertTopBarGrad)"288 },289 maskFill : shade([100, 100, 100], 25),290 height : {291 panel : 32,292 window : 44293 }294 },295 window : {296 fill : "#FFFFFF",297 scrollSize : 17298 },299 windowTab : {300 'font-size' : 11,301 width : 100,302 fill : "url(#windowTabGrad)",303 maskFill : "url(#windowTabMaskGrad)",304 maskStroke : shade([100, 100, 100], 75)305 }306 };307308 gradient = $C({element : "linearGradient", id : "taskbarGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});309 $C({element : "stop", offset : "0%", "stop-color" : "#FFFFFF", "stop-opacity" : .9, appendTo : gradient});310 $C({element : "stop", offset : "4%", "stop-color" : "#D8D8D8", "stop-opacity" : .65, appendTo : gradient});311 $C({element : "stop", offset : "95%", "stop-color" : "#606060", "stop-opacity" : .4, appendTo : gradient});312 $C({element : "stop", offset : "100%", "stop-color" : "#000000", appendTo : gradient});313314 gradient = $C({element : "linearGradient", id : "windowTabGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});315 $C({element : "stop", offset : "0%", "stop-color" : shade([90, 90, 90], 20), appendTo : gradient});316 $C({element : "stop", offset : "100%", "stop-color" : shade([90, 90, 90], 50), appendTo : gradient});317318 gradient = $C({element : "linearGradient", id : "windowTabMaskGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});319 $C({element : "stop", offset : "0%", "stop-color" : shade([90, 90, 90], 20), appendTo : gradient});320 $C({element : "stop", offset : "100%", "stop-color" : shade([90, 90, 90], 0), appendTo : gradient});321322 gradient = $C({element : "linearGradient", id : "topBarGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});323 $C({element : "stop", offset : "0%", "stop-color" : shade([100, 100, 100], -18), appendTo : gradient});324 $C({element : "stop", offset : "10%", "stop-color" : shade([100, 100, 100]), appendTo : gradient});325 $C({element : "stop", offset : "94%", "stop-color" : shade([100, 100, 100], 10), appendTo : gradient});326 $C({element : "stop", offset : "100%", "stop-color" : shade([100, 100, 100], 60), appendTo : gradient});327328 gradient = $C({element : "linearGradient", id : "alertTopBarGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});329 $C({element : "stop", offset : "0%", "stop-color" : shade([100, 100, 100], -36), appendTo : gradient});330 $C({element : "stop", offset : "10%", "stop-color" : shade([100, 100, 100], -16), appendTo : gradient});331 $C({element : "stop", offset : "95%", "stop-color" : shade([100, 100, 100], -8), appendTo : gradient});332 $C({element : "stop", offset : "100%", "stop-color" : shade([100, 100, 100], 80), appendTo : gradient});333334 gradient = $C({element : "linearGradient", id : "winTopBarGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});335 $C({element : "stop", offset : "0%", "stop-color" : shade([100, 100, 100], -40), appendTo : gradient});336 $C({element : "stop", offset : "1%", "stop-color" : shade([100, 100, 100], -18), appendTo : gradient});337 $C({element : "stop", offset : "12%", "stop-color" : shade([100, 100, 100]), appendTo : gradient});338 $C({element : "stop", offset : "92%", "stop-color" : shade([100, 100, 100], 10), appendTo : gradient});339 $C({element : "stop", offset : "100%", "stop-color" : shade([100, 100, 100], 32), appendTo : gradient});340341 gradient = $C({element : "linearGradient", id : "menuGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});342 $C({element : "stop", offset : "0%", "stop-color" : shade([100, 100, 100], 50), appendTo : gradient});343 $C({element : "stop", offset : "100%", "stop-color" : shade([100, 100, 100], 45), appendTo : gradient});344345 gradient = $C({element : "linearGradient", id : "menubarGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});346 $C({element : "stop", offset : "0%", "stop-color" : shade([103.333, 98.514, 92.934]), appendTo : gradient});347 $C({element : "stop", offset : "44%", "stop-color" : shade([104.761, 99.009, 91.847]), appendTo : gradient});348 $C({element : "stop", offset : "100%", "stop-color" : shade([102.38, 91.584, 80.434]), appendTo : gradient});349350 gradient = $C({element : "radialGradient", id : "radioButtonGrad", cx : "65%", cy : "65%", r : "100%", fx : "65%", fy : "65%", gradientUnits : "objectBoundingBox", appendTo : defs});351 $C({element : "stop", offset : "0%", "stop-color" : "#F0F0F0", appendTo : gradient});352 $C({element : "stop", offset : "100%", "stop-color" : "#A8B0B8", appendTo : gradient});353354 gradient = $C({element : "linearGradient", id : "tabGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});355 $C({element : "stop", offset : "0%", "stop-color" : "#C0C0C0", appendTo : gradient});356 $C({element : "stop", offset : "15%", "stop-color" : "#ECECEC", appendTo : gradient});357 $C({element : "stop", offset : "50%", "stop-color" : "white", appendTo : gradient});358359 gradient = $C({element : "linearGradient", id : "toolbarGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});360 $C({element : "stop", offset : "0%", "stop-color" : shade([102.333, 100, 96.934]), appendTo : gradient});361 $C({element : "stop", offset : "44%", "stop-color" : shade([103.761, 100.009, 97.847]), appendTo : gradient});362 $C({element : "stop", offset : "100%", "stop-color" : shade([99.38, 92.584, 88.434]), appendTo : gradient});363364 gradient = $C({element : "linearGradient", id : "statusBarGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});365 $C({element : "stop", offset : "0%", "stop-color" : shade([100, 100, 100], 70), appendTo : gradient});366 $C({element : "stop", offset : "8%", "stop-color" : shade([100, 100, 100], 10), appendTo : gradient});367 $C({element : "stop", offset : "94%", "stop-color" : shade([100, 100, 100], 10), appendTo : gradient});368 $C({element : "stop", offset : "100%", "stop-color" : shade([100, 100, 100], -30), appendTo : gradient});369370 gradient = $C({element : "linearGradient", id : "toolButtonMaskGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});371 $C({element : "stop", offset : "0%", "stop-color" : shade([104.761, 99.009, 91.847], 30), appendTo : gradient});372 $C({element : "stop", offset : "44%", "stop-color" : shade([104.761, 99.009, 91.847], 36), appendTo : gradient});373 $C({element : "stop", offset : "100%", "stop-color" : shade([104.761, 99.009, 91.847], 21), appendTo : gradient});374375 gradient = $C({element : "linearGradient", id : "toolButtonStrokeGrad", x1 : "0%", y1 : "0%", x2 : "33%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});376 $C({element : "stop", offset : "0%", "stop-color" : shade([100, 100, 100], 100), appendTo : gradient});377 $C({element : "stop", offset : "100%", "stop-color" : shade([100, 100, 100], 60), appendTo : gradient});378379 gradient = $C({element : "linearGradient", id : "hTrackGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});380 $C({element : "stop", offset : "0%", "stop-color" : shade([100, 100, 100], -35), appendTo : gradient});381 $C({element : "stop", offset : "12%", "stop-color" : shade([100, 100, 100], 78), appendTo : gradient});382 $C({element : "stop", offset : "88%", "stop-color" : shade([100, 100, 100], 78), appendTo : gradient});383 $C({element : "stop", offset : "100%", "stop-color" : "#FFFFFF", appendTo : gradient});384385 gradient = $C({element : "linearGradient", id : "listItemGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});386 $C({element : "stop", offset : "0%", "stop-color" : shade([120.283, 61.538, 47.058], 9), appendTo : gradient});387 $C({element : "stop", offset : "45%", "stop-color" : shade([120.283, 61.538, 47.058], 11), appendTo : gradient});388 $C({element : "stop", offset : "55%", "stop-color" : shade([120.283, 61.538, 47.058], 10), appendTo : gradient});389 $C({element : "stop", offset : "100%", "stop-color" : shade([120.283, 61.538, 47.058], -5), appendTo : gradient});390391 gradient = $C({element : "linearGradient", id : "vTrackGrad", x1 : "0%", y1 : "0%", x2 : "100%", y2 : "0%", gradientUnits : "objectBoundingBox", appendTo : defs});392 $C({element : "stop", offset : "0%", "stop-color" : shade([100, 100, 100], -35), appendTo : gradient});393 $C({element : "stop", offset : "12%", "stop-color" : shade([100, 100, 100], 78), appendTo : gradient});394 $C({element : "stop", offset : "88%", "stop-color" : shade([100, 100, 100], 78), appendTo : gradient});395 $C({element : "stop", offset : "100%", "stop-color" : "#FFFFFF", appendTo : gradient});396397 gradient = $C({element : "linearGradient", id : "hScrollSliderStrokeGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});398 $C({element : "stop", offset : "0%", "stop-color" : shade([100, 100, 100], 74), appendTo : gradient});399 $C({element : "stop", offset : "10%", "stop-color" : shade([100, 100, 100]), appendTo : gradient});400 $C({element : "stop", offset : "88%", "stop-color" : shade([100, 100, 100]), appendTo : gradient});401 $C({element : "stop", offset : "100%", "stop-color" : shade([100, 100, 100], -25), appendTo : gradient});402403 gradient = $C({element : "linearGradient", id : "vScrollSliderStrokeGrad", x1 : "0%", y1 : "0%", x2 : "100%", y2 : "0%", gradientUnits : "objectBoundingBox", appendTo : defs});404 $C({element : "stop", offset : "0%", "stop-color" : shade([100, 100, 100], 74), appendTo : gradient});405 $C({element : "stop", offset : "10%", "stop-color" : shade([100, 100, 100]), appendTo : gradient});406 $C({element : "stop", offset : "88%", "stop-color" : shade([100, 100, 100]), appendTo : gradient});407 $C({element : "stop", offset : "100%", "stop-color" : shade([100, 100, 100], -25), appendTo : gradient});408409 gradient = $C({element : "linearGradient", id : "buttonMaskGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});410 $C({element : "stop", offset : "0%", "stop-color" : shade([100, 100, 100], 76), appendTo : gradient});411 $C({element : "stop", offset : "8%", "stop-color" : shade([100, 100, 100], 55), appendTo : gradient});412 $C({element : "stop", offset : "88%", "stop-color" : shade([100, 100, 100], 55), appendTo : gradient});413 $C({element : "stop", offset : "100%", "stop-color" : shade([100, 100, 100], -12), appendTo : gradient});414415 gradient = $C({element : "linearGradient", id : "buttonGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});416 $C({element : "stop", offset : "0%", "stop-color" : shade([100, 100, 100], -20), appendTo : gradient});417 $C({element : "stop", offset : "20%", "stop-color" : shade([100, 100, 100], 10), appendTo : gradient});418 $C({element : "stop", offset : "80%", "stop-color" : shade([100, 100, 100], 10), appendTo : gradient});419 $C({element : "stop", offset : "100%", "stop-color" : shade([100, 100, 100], 55), appendTo : gradient});420421 gradient = $C({element : "linearGradient", id : "neutralButtonMaskGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});422 $C({element : "stop", offset : "0%", "stop-color" : "#F8F8F8", appendTo : gradient});423 $C({element : "stop", offset : "20%", "stop-color" : "#DADCDE", appendTo : gradient});424 $C({element : "stop", offset : "80%", "stop-color" : "#DADCDE", appendTo : gradient});425 $C({element : "stop", offset : "100%", "stop-color" : "#9EA0A2", appendTo : gradient});426427 gradient = $C({element : "linearGradient", id : "neutralButtonGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});428 $C({element : "stop", offset : "0%", "stop-color" : "#8A8C8E", appendTo : gradient});429 $C({element : "stop", offset : "20%", "stop-color" : "#B4B6B8", appendTo : gradient});430 $C({element : "stop", offset : "80%", "stop-color" : "#B4B6B8", appendTo : gradient});431 $C({element : "stop", offset : "100%", "stop-color" : "#FFFFFF", appendTo : gradient});432433 gradient = $C({element : "linearGradient", id : "sliderButtonGrad", x1 : "0%", y1 : "0%", x2 : "40%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});434 $C({element : "stop", offset : "0%", "stop-color" : shade([100, 100, 100], 80), appendTo : gradient});435 $C({element : "stop", offset : "100%", "stop-color" : shade([100, 100, 100], -8), appendTo : gradient});436437 gradient = $C({element : "linearGradient", id : "sliderPatternGrad", x1 : "0%", y1 : "0%", x2 : "100%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});438 $C({element : "stop", offset : "0%", "stop-color" : shade([100, 100, 100], 20), appendTo : gradient});439 $C({element : "stop", offset : "100%", "stop-color" : shade([100, 100, 100], -20), appendTo : gradient});440441 pattern = $C({element : "pattern", id : "sliderPattern", x : 2.5, y : 2.5, width : 5, height : 5, patternUnits : "userSpaceOnUse", appendTo : defs});442 $C({element : "rect", x : 0, y : 0, width : 5, height : 5, fill : "url(#sliderPatternGrad)", appendTo : pattern});443 $C({element : "circle", cx : 2.5, cy : 2.5, r : 1.5, fill : shade([100, 100, 100]), appendTo : pattern});444445 gradient = $C({element : "linearGradient", id : "horScrollSliderGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});446 $C({element : "stop", offset : "0%", "stop-color" : shade([102.333, 100, 96.934], 20), appendTo : gradient});447 $C({element : "stop", offset : "44%", "stop-color" : shade([103.761, 100.009, 97.847]), appendTo : gradient});448 $C({element : "stop", offset : "100%", "stop-color" : shade([99.38, 92.584, 88.434]), appendTo : gradient});449450 gradient = $C({element : "linearGradient", id : "vertScrollSliderGrad", x1 : "0%", y1 : "0%", x2 : "100%", y2 : "0%", gradientUnits : "objectBoundingBox", appendTo : defs});451 $C({element : "stop", offset : "0%", "stop-color" : shade([102.333, 100, 96.934], 20), appendTo : gradient});452 $C({element : "stop", offset : "44%", "stop-color" : shade([103.761, 100.009, 97.847]), appendTo : gradient});453 $C({element : "stop", offset : "100%", "stop-color" : shade([99.38, 92.584, 88.434]), appendTo : gradient});454455 gradient = $C({element : "linearGradient", id : "resizeGrad", x1 : "0%", y1 : "0%", x2 : "100%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});456 $C({element : "stop", offset : "40%", "stop-color" : "#FFFFFF", "stop-opacity" : .05, appendTo : gradient});457 $C({element : "stop", offset : "100%", "stop-color" : "#000000", "stop-opacity" : .25, appendTo : gradient});458459 gradient = $C({element : "radialGradient", id : "lensGrad", cx : "28%", cy : "20%", r : "54.6%", gradientUnits : "objectBoundingBox", appendTo : defs});460 $C({element : "stop", offset : "12%", "stop-color" : "#FAFAFA", appendTo : gradient});461 $C({element : "stop", offset : "34%", "stop-color" : "#D8E0E2", appendTo : gradient});462 $C({element : "stop", offset : "100%", "stop-color" : "#ACB9BD", appendTo : gradient});463464 gradient = $C({element : "radialGradient", id : "handGrad", cx : "55%", cy : "65%", r : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});465 $C({element : "stop", offset : "20%", "stop-color" : "#FFFFFF", appendTo : gradient});466 $C({element : "stop", offset : "100%", "stop-color" : "#ACB9BD", appendTo : gradient});467468 gradient = $C({element : "linearGradient", id : "progressGrad", x1 : "0%", y1 : "0%", x2 : "100%", y2 : "0%", gradientUnits : "objectBoundingBox", appendTo : defs});469 $C({element : "stop", offset : "50%", "stop-color" : "#d00030", appendTo : gradient});470 $C({element : "stop", offset : "100%", "stop-color" : "#ffc030", appendTo : gradient});471472 gradient = $C({element : "linearGradient", id : "quickTipGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});473 $C({element : "stop", offset : "10%", "stop-color" : shade([100, 100, 100], 100), appendTo : gradient});474 $C({element : "stop", offset : "100%", "stop-color" : shade([100, 100, 100], 72), appendTo : gradient});475476 gradient = $C({element : "linearGradient", id : "insetStroke", x1 : "0%", y1 : "0%", x2 : "100%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});477 $C({element : "stop", offset : "0%", "stop-color" : "#c0c0c0", appendTo : gradient});478 $C({element : "stop", offset : "49.9%", "stop-color" : "#c0c0c0", appendTo : gradient});479 $C({element : "stop", offset : "50%", "stop-color" : "#f0f0f0", appendTo : gradient});480481 gradient = $C({element : "linearGradient", id : "marker1", x1 : "0%", y1 : "0%", x2 : "100%", y2 : "75%", gradientUnits : "objectBoundingBox", appendTo : defs});482 $C({element : "stop", offset : "0%", "stop-color" : "#001030", appendTo : gradient});483 $C({element : "stop", offset : "100%", "stop-color" : "#FAFAFF", appendTo : gradient});484485 gradient = $C({element : "linearGradient", id : "marker2", x1 : "0%", y1 : "0%", x2 : "100%", y2 : "75%", gradientUnits : "objectBoundingBox", appendTo : defs});486 $C({element : "stop", offset : "40%", "stop-color" : "#001030", appendTo : gradient});487 $C({element : "stop", offset : "66%", "stop-color" : "#FAFAFF", appendTo : gradient});488489 gradient = $C({element : "linearGradient", id : "marker3", x1 : "0%", y1 : "0%", x2 : "100%", y2 : "75%", gradientUnits : "objectBoundingBox", appendTo : defs});490 $C({element : "stop", offset : "0%", "stop-color" : "#003090", appendTo : gradient});491 $C({element : "stop", offset : "94%", "stop-color" : "#E0F0FF", appendTo : gradient});492493 gradient = $C({element : "linearGradient", id : "LonGutter", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});494 $C({element : "stop", offset : "0%", "stop-color" : "#00040A", appendTo : gradient});495 $C({element : "stop", offset : "100%", "stop-color" : "#00040A", "stop-opacity" : 0, appendTo : gradient});496497 gradient = $C({element : "linearGradient", id : "LatGutter", x1 : "0%", y1 : "0%", x2 : "100%", y2 : "0%", gradientUnits : "objectBoundingBox", appendTo : defs});498 $C({element : "stop", offset : "0%", "stop-color" : "#00040A", appendTo : gradient});499 $C({element : "stop", offset : "100%", "stop-color" : "#00040A", "stop-opacity" : 0, appendTo : gradient});500501 gradient = $C({element : "radialGradient", id : "paddleGrad", cx : "50%", cy : "50%", r : "69%", fx : "50%", fy : "50%", gradientUnits : "objectBoundingBox", appendTo : defs});502 $C({element : "stop", offset : "55%", "stop-color" : "#F02424", appendTo : gradient});503 $C({element : "stop", offset : "78%", "stop-color" : "#F06060", appendTo : gradient});504 $C({element : "stop", offset : "100%", "stop-color" : "#FF1010", appendTo : gradient});505506 gradient = $C({element : "radialGradient", id : "pushpinGrad_red", cx : "50%", cy : "50%", r : "69%", fx : "50%", fy : "50%", gradientUnits : "objectBoundingBox", appendTo : defs});507 $C({element : "stop", offset : "55%", "stop-color" : "#F02424", appendTo : gradient});508 $C({element : "stop", offset : "78%", "stop-color" : "#F06060", appendTo : gradient});509 $C({element : "stop", offset : "100%", "stop-color" : "#FF1010", appendTo : gradient});510511 gradient = $C({element : "radialGradient", id : "pushpinGrad_green", cx : "50%", cy : "50%", r : "69%", fx : "50%", fy : "50%", gradientUnits : "objectBoundingBox", appendTo : defs});512 $C({element : "stop", offset : "55%", "stop-color" : "#00C000", appendTo : gradient});513 $C({element : "stop", offset : "78%", "stop-color" : "#20C020", appendTo : gradient});514 $C({element : "stop", offset : "100%", "stop-color" : "#00C000", appendTo : gradient});515516 gradient = $C({element : "radialGradient", id : "pushpinGrad_blue", cx : "50%", cy : "50%", r : "69%", fx : "50%", fy : "50%", gradientUnits : "objectBoundingBox", appendTo : defs});517 $C({element : "stop", offset : "55%", "stop-color" : "#4040FF", appendTo : gradient});518 $C({element : "stop", offset : "78%", "stop-color" : "#6868FF", appendTo : gradient});519 $C({element : "stop", offset : "100%", "stop-color" : "#4040FF", appendTo : gradient});520521 gradient = $C({element : "linearGradient", id : "chiaroscuro", x1 : "0%", y1 : "0%", x2 : "100%", y2 : "0%", gradientUnits : "objectBoundingBox", appendTo : defs});522 $C({element : "stop", offset : "25%", "stop-color" : "#FFFFFF", appendTo : gradient});523 $C({element : "stop", offset : "100%", "stop-color" : "#A8A8A8", appendTo : gradient});524525 gradient = $C({element : "linearGradient", id : "chrome", x1 : "0%", y1 : "0%", x2 : "100%", y2 : "0%", gradientUnits : "objectBoundingBox", appendTo : defs});526 $C({element : "stop", offset : "20%", "stop-color" : "#787878", appendTo : gradient});527 $C({element : "stop", offset : "32%", "stop-color" : "#FFFFFF", appendTo : gradient});528 $C({element : "stop", offset : "58%", "stop-color" : "#FFFFFF", appendTo : gradient});529 $C({element : "stop", offset : "58%", "stop-color" : "#686868", appendTo : gradient});530 $C({element : "stop", offset : "78%", "stop-color" : "#686868", appendTo : gradient});531 $C({element : "stop", offset : "96%", "stop-color" : "#808080", appendTo : gradient});532533 gradient = $C({element : "linearGradient", id : "paddleReflection", x1 : "0%", y1 : "0%", x2 : "100%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});534 $C({element : "stop", offset : "16%", "stop-color" : "#FFC0C0", appendTo : gradient});535 $C({element : "stop", offset : "32%", "stop-color" : "#F06060", appendTo : gradient});536537 gradient = $C({element : "linearGradient", id : "pinReflection_red", x1 : "0%", y1 : "0%", x2 : "100%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});538 $C({element : "stop", offset : "16%", "stop-color" : "#FFC0C0", appendTo : gradient});539 $C({element : "stop", offset : "32%", "stop-color" : "#F06060", appendTo : gradient});540541 gradient = $C({element : "linearGradient", id : "pinReflection_green", x1 : "0%", y1 : "0%", x2 : "100%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});542 $C({element : "stop", offset : "16%", "stop-color" : "#C0FFC0", appendTo : gradient});543 $C({element : "stop", offset : "32%", "stop-color" : "#20CE20", appendTo : gradient});544545 gradient = $C({element : "linearGradient", id : "pinReflection_blue", x1 : "0%", y1 : "0%", x2 : "100%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});546 $C({element : "stop", offset : "16%", "stop-color" : "#C8C8FF", appendTo : gradient});547 $C({element : "stop", offset : "32%", "stop-color" : "#6868FF", appendTo : gradient});548549 gradient = $C({element : "radialGradient", id : "leg_diskGrad", cx : "50%", cy : "50%", r : "69%", fx : "50%", fy : "50%", gradientUnits : "objectBoundingBox", appendTo : defs});550 $C({element : "stop", offset : "45%", "stop-color" : "#1050AF", appendTo : gradient});551 $C({element : "stop", offset : "84%", "stop-color" : "#B0D0F0", appendTo : gradient});552 $C({element : "stop", offset : "100%", "stop-color" : "#0000E0", appendTo : gradient});553554 gradient = $C({element : "linearGradient", id : "D3ButtonMaskGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});555 $C({element : "stop", offset : "0%", "stop-color" : "#5C5C5C", appendTo : gradient});556 $C({element : "stop", offset : "100%", "stop-color" : "#282828", appendTo : gradient});557558 gradient = $C({element : "linearGradient", id : "D3ButtonGrad", x1 : "0%", y1 : "0%", x2 : "0%", y2 : "100%", gradientUnits : "objectBoundingBox", appendTo : defs});559 $C({element : "stop", offset : "0%", "stop-color" : "#4682B4", appendTo : gradient});560 $C({element : "stop", offset : "100%", "stop-color" : "#3670A4", appendTo : gradient});561 }562563};564565566pergola.customColorNames = {567 nürburgring : "#B8CAD2",568 city : "#CCD0D4",569 rustica : "#7B961E",570 suburban : "#DDFF58",571 frostica : "#F8FDFE",572 tropica : "#FF4200",573 herman : "#5E0200",574 glockenspiel : "#EDF4F4",575 black_diamond : "#293032",576 lightslategray : "rgb(144, 160, 176)"577};578579580581pergola.skins[skin]();582
...
ViewController.js
Source:ViewController.js
1/*2 * Copyright (C) 2011 Apple Inc. All rights reserved.3 *4 * Redistribution and use in source and binary forms, with or without5 * modification, are permitted provided that the following conditions6 * are met:7 * 1. Redistributions of source code must retain the above copyright8 * notice, this list of conditions and the following disclaimer.9 * 2. Redistributions in binary form must reproduce the above copyright10 * notice, this list of conditions and the following disclaimer in the11 * documentation and/or other materials provided with the distribution.12 *13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF23 * THE POSSIBILITY OF SUCH DAMAGE.24 */25function ViewController(buildbot) {26 this._buildbot = buildbot;27 this._navigationID = 0;28 var self = this;29 addEventListener('load', function() { self.loaded() }, false);30 addEventListener('hashchange', function() { self.parseHash(location.hash) }, false);31}32ViewController.prototype = {33 loaded: function() {34 this._header = document.createElement('h1');35 document.body.appendChild(this._header);36 this._mainContentElement = document.createElement('div');37 document.body.appendChild(this._mainContentElement);38 document.body.appendChild(this._domForAuxiliaryUIElements());39 this.parseHash(location.hash);40 },41 parseHash: function(hash) {42 ++this._navigationID;43 var match = /#\/(.*)/.exec(hash);44 if (match)45 this._displayBuilder(this._buildbot.builderNamed(decodeURIComponent(match[1])));46 else47 this._displayTesters();48 },49 _displayBuilder: function(builder) {50 this._setTitle(builder.name);51 this._mainContentElement.removeAllChildren();52 var navigationID = this._navigationID;53 var self = this;54 (new LayoutTestHistoryAnalyzer(builder)).start(function(data, stillFetchingData) {55 if (self._navigationID !== navigationID) {56 // The user has navigated somewhere else. Stop loading data about this tester.57 return false;58 }59 var list = document.createElement('ol');60 list.id = 'failure-history';61 var buildNames = Object.keys(data.history)62 buildNames.forEach(function(buildName, buildIndex, buildNameArray) {63 var failingTestNames = Object.keys(data.history[buildName].tests);64 if (!failingTestNames.length)65 return;66 var item = document.createElement('li');67 list.appendChild(item);68 var testList = document.createElement('ol');69 item.appendChild(testList);70 testList.className = 'test-list';71 for (var testName in data.history[buildName].tests) {72 var testItem = document.createElement('li');73 testItem.appendChild(self._domForFailedTest(builder, buildName, testName, data.history[buildName].tests[testName]));74 testList.appendChild(testItem);75 }76 if (data.history[buildName].tooManyFailures) {77 var p = document.createElement('p');78 p.className = 'info';79 p.appendChild(document.createTextNode('run-webkit-tests exited early due to too many failures/crashes/timeouts'));80 item.appendChild(p);81 }82 var passingBuildName;83 if (buildIndex + 1 < buildNameArray.length)84 passingBuildName = buildNameArray[buildIndex + 1];85 item.appendChild(self._domForRegressionRange(builder, buildName, passingBuildName, failingTestNames));86 if (passingBuildName || !stillFetchingData) {87 var bugForm = new FailingTestsBugForm(builder, buildName, passingBuildName, failingTestNames);88 item.appendChild(self._domForNewAndExistingBugs(builder, failingTestNames, bugForm))89 }90 });91 self._mainContentElement.removeAllChildren();92 self._mainContentElement.appendChild(list);93 self._mainContentElement.appendChild(self._domForPossiblyFlakyTests(builder, data.possiblyFlaky, buildNames));94 if (!stillFetchingData)95 PersistentCache.prune();96 return true;97 });98 },99 _displayTesters: function() {100 this._setTitle('Testers');101 this._mainContentElement.removeAllChildren();102 var list = document.createElement('ul');103 this._mainContentElement.appendChild(list);104 var latestBuildInfos = [];105 var navigationID = this._navigationID;106 function updateList() {107 latestBuildInfos.sort(function(a, b) { return a.tester.name.localeCompare(b.tester.name) });108 list.removeAllChildren();109 latestBuildInfos.forEach(function(buildInfo) {110 var link = document.createElement('a');111 link.href = '#/' + buildInfo.tester.name;112 link.appendChild(document.createTextNode(buildInfo.tester.name));113 var item = document.createElement('li');114 item.appendChild(link);115 if (buildInfo.tooManyFailures)116 item.appendChild(document.createTextNode(' (too many failures/crashes/timeouts)'));117 else118 item.appendChild(document.createTextNode(' (' + buildInfo.failureCount + ' failing test' + (buildInfo.failureCount > 1 ? 's' : '') + ')'));119 list.appendChild(item);120 });121 }122 var self = this;123 this._buildbot.getTesters(function(testers) {124 if (self._navigationID !== navigationID) {125 // The user has navigated somewhere else.126 return;127 }128 testers.forEach(function(tester) {129 tester.getMostRecentCompletedBuildNumber(function(buildNumber) {130 if (self._navigationID !== navigationID)131 return;132 if (buildNumber < 0)133 return;134 tester.getNumberOfFailingTests(buildNumber, function(failureCount, tooManyFailures) {135 if (self._navigationID !== navigationID)136 return;137 if (failureCount <= 0)138 return;139 latestBuildInfos.push({ tester: tester, failureCount: failureCount, tooManyFailures: tooManyFailures });140 updateList();141 });142 });143 });144 });145 },146 _domForRegressionRange: function(builder, failingBuildName, passingBuildName, failingTestNames) {147 var result = document.createDocumentFragment();148 var dlItems = [149 [document.createTextNode('Failed'), this._domForBuildName(builder, failingBuildName)],150 ];151 if (passingBuildName)152 dlItems.push([document.createTextNode('Passed'), this._domForBuildName(builder, passingBuildName)]);153 result.appendChild(createDefinitionList(dlItems));154 if (!passingBuildName)155 return result;156 var firstSuspectRevision = this._buildbot.parseBuildName(passingBuildName).revision + 1;157 var lastSuspectRevision = this._buildbot.parseBuildName(failingBuildName).revision;158 if (firstSuspectRevision === lastSuspectRevision)159 return result;160 var suspectsContainer = document.createElement('div');161 result.appendChild(suspectsContainer);162 var link = document.createElement('a');163 result.appendChild(link);164 link.href = trac.logURL('trunk', firstSuspectRevision, lastSuspectRevision, true);165 link.appendChild(document.createTextNode('View regression range in Trac'));166 suspectsContainer.appendChild(document.createTextNode('Searching for suspect revisions\u2026'));167 // FIXME: Maybe some of this code should go in LayoutTestHistoryAnalyzer, or some other class?168 var self = this;169 trac.commitDataForRevisionRange('trunk', firstSuspectRevision, lastSuspectRevision, function(commits) {170 var failingTestNamesWithoutExtensions = failingTestNames.map(removePathExtension);171 var suspectCommits = commits.filter(function(commit) {172 return failingTestNamesWithoutExtensions.some(function(testName) {173 return commit.message.contains(testName);174 });175 });176 suspectsContainer.removeAllChildren();177 if (!suspectCommits.length)178 return;179 var title = 'Suspect revision' + (suspectCommits.length > 1 ? 's' : '') + ':';180 suspectsContainer.appendChild(document.createTextNode(title));181 var list = document.createElement('ul');182 suspectsContainer.appendChild(list);183 list.className = 'suspect-revisions-list';184 function compareCommits(a, b) {185 return b.revision - a.revision;186 }187 list.appendChildren(sorted(suspectCommits, compareCommits).map(function(commit) {188 var item = document.createElement('li');189 var link = document.createElement('a');190 item.appendChild(link);191 link.href = trac.changesetURL(commit.revision);192 link.appendChild(document.createTextNode(commit.title))193 return item;194 }));195 });196 return result;197 },198 _domForAuxiliaryUIElements: function() {199 var aside = document.createElement('aside');200 aside.appendChild(document.createTextNode('Something not working? Have an idea to improve this page? '));201 var link = document.createElement('a');202 aside.appendChild(link);203 link.appendChild(document.createTextNode('File a bug!'));204 var queryParameters = {205 product: 'WebKit',206 component: 'Tools / Tests',207 version: '528+ (Nightly build)',208 bug_file_loc: location.href,209 cc: 'aroben@apple.com',210 short_desc: 'TestFailures page needs more unicorns!',211 };212 link.href = addQueryParametersToURL(config.kBugzillaURL + '/enter_bug.cgi', queryParameters);213 link.target = '_blank';214 return aside;215 },216 _domForBuildName: function(builder, buildName) {217 var parsed = this._buildbot.parseBuildName(buildName);218 var sourceLink = document.createElement('a');219 sourceLink.href = 'http://trac.webkit.org/changeset/' + parsed.revision;220 sourceLink.appendChild(document.createTextNode('r' + parsed.revision));221 var buildLink = document.createElement('a');222 buildLink.href = builder.buildURL(parsed.buildNumber);223 buildLink.appendChild(document.createTextNode(parsed.buildNumber));224 var resultsLink = document.createElement('a');225 resultsLink.href = builder.resultsPageURL(buildName);226 resultsLink.appendChild(document.createTextNode('results.html'));227 var result = document.createDocumentFragment();228 result.appendChild(sourceLink);229 result.appendChild(document.createTextNode(' ('));230 result.appendChild(buildLink);231 result.appendChild(document.createTextNode(') ('));232 result.appendChild(resultsLink);233 result.appendChild(document.createTextNode(')'));234 return result;235 },236 _domForFailedTest: function(builder, buildName, testName, testResult) {237 var result = document.createDocumentFragment();238 result.appendChild(document.createTextNode(testName + ': '));239 result.appendChild(this._domForFailureDiagnosis(builder, buildName, testName, testResult));240 return result;241 },242 _domForFailureDiagnosis: function(builder, buildName, testName, testResult) {243 var diagnosticInfo = builder.failureDiagnosisTextAndURL(buildName, testName, testResult);244 if (!diagnosticInfo)245 return document.createTextNode(testResult.failureType);246 var textAndCrashingSymbol = document.createDocumentFragment();247 textAndCrashingSymbol.appendChild(document.createTextNode(diagnosticInfo.text));248 if (testResult.crashingSymbol) {249 var code = document.createElement('code');250 code.appendChild(document.createTextNode(testResult.crashingSymbol));251 textAndCrashingSymbol.appendChild(document.createTextNode(' ('));252 textAndCrashingSymbol.appendChild(code);253 textAndCrashingSymbol.appendChild(document.createTextNode(')'));254 }255 if (!('url' in diagnosticInfo))256 return textAndCrashingSymbol;257 var link = document.createElement('a');258 link.href = diagnosticInfo.url;259 link.appendChild(textAndCrashingSymbol);260 return link;261 },262 _domForNewAndExistingBugs: function(tester, failingTests, bugForm) {263 var result = document.createDocumentFragment();264 var container = document.createElement('p');265 result.appendChild(container);266 container.className = 'existing-and-new-bugs';267 var bugsContainer = document.createElement('div');268 container.appendChild(bugsContainer);269 bugsContainer.appendChild(document.createTextNode('Searching for bugs related to ' + (failingTests.length > 1 ? 'these tests' : 'this test') + '\u2026'));270 bugzilla.quickSearch('ALL ' + failingTests.join('|'), function(bugs) {271 if (!bugs.length) {272 bugsContainer.parentNode.removeChild(bugsContainer);273 return;274 }275 while (bugsContainer.firstChild)276 bugsContainer.removeChild(bugsContainer.firstChild);277 bugsContainer.appendChild(document.createTextNode('Existing bugs related to ' + (failingTests.length > 1 ? 'these tests' : 'this test') + ':'));278 var list = document.createElement('ul');279 bugsContainer.appendChild(list);280 list.className = 'existing-bugs-list';281 function bugToListItem(bug) {282 var link = document.createElement('a');283 link.href = bug.url;284 link.appendChild(document.createTextNode(bug.title));285 var item = document.createElement('li');286 item.appendChild(link);287 return item;288 }289 var openBugs = bugs.filter(function(bug) { return bugzilla.isOpenStatus(bug.status) });290 var closedBugs = bugs.filter(function(bug) { return !bugzilla.isOpenStatus(bug.status) });291 list.appendChildren(openBugs.map(bugToListItem));292 if (!closedBugs.length)293 return;294 var item = document.createElement('li');295 list.appendChild(item);296 item.appendChild(document.createTextNode('Closed bugs:'));297 var closedList = document.createElement('ul');298 item.appendChild(closedList);299 closedList.appendChildren(closedBugs.map(bugToListItem));300 });301 var form = bugForm.domElement();302 result.appendChild(form);303 var link = document.createElement('a');304 container.appendChild(link);305 link.addEventListener('click', function(event) { form.submit(); event.preventDefault(); });306 link.href = '#';307 link.appendChild(document.createTextNode('File bug for ' + (failingTests.length > 1 ? 'these failures' : 'this failure')));308 return result;309 },310 _domForPossiblyFlakyTests: function(builder, possiblyFlakyTestData, allBuilds) {311 var result = document.createDocumentFragment();312 var flakyTests = Object.keys(possiblyFlakyTestData);313 if (!flakyTests.length)314 return result;315 var flakyHeader = document.createElement('h2');316 result.appendChild(flakyHeader);317 flakyHeader.appendChild(document.createTextNode('Possibly Flaky Tests'));318 var flakyList = document.createElement('ol');319 result.appendChild(flakyList);320 flakyList.id = 'possibly-flaky-tests';321 var self = this;322 flakyList.appendChildren(sorted(flakyTests).map(function(testName) {323 var item = document.createElement('li');324 var disclosureTriangle = document.createElement('span');325 item.appendChild(disclosureTriangle);326 disclosureTriangle.className = 'disclosure-triangle';327 const blackRightPointingSmallTriangle = '\u25b8';328 disclosureTriangle.appendChild(document.createTextNode(blackRightPointingSmallTriangle));329 var failures = possiblyFlakyTestData[testName];330 item.appendChild(document.createTextNode(testName + ' (failed ' + failures.length + ' out of ' + allBuilds.length + ' times)'));331 var container = document.createElement('div');332 item.appendChild(container);333 container.className = 'expandable';334 disclosureTriangle.addEventListener('click', function() {335 item.toggleStyleClass('expanded');336 if (!item.hasStyleClass('expanded'))337 return;338 if (!container.firstChild) {339 var failureList = document.createElement('ol');340 container.appendChild(failureList);341 failureList.className = 'flakiness-examples-list';342 failureList.appendChildren(failures.map(function(historyItem) {343 var item = document.createElement('li');344 item.appendChild(self._domForBuildName(builder, historyItem.build));345 item.appendChild(document.createTextNode(': '));346 item.appendChild(self._domForFailureDiagnosis(builder, historyItem.build, testName, historyItem.result));347 return item;348 }));349 var failingBuildNames = failures.map(function(historyItem) { return historyItem.build });350 var bugForm = new FlakyTestBugForm(builder, failingBuildNames, testName, allBuilds.last(), allBuilds[0], allBuilds.length);351 container.appendChild(self._domForNewAndExistingBugs(builder, [testName], bugForm));352 }353 });354 return item;355 }));356 return result;357 },358 _setTitle: function(title) {359 document.title = title;360 this._header.textContent = title;361 },...
CesiumInspector.js
Source:CesiumInspector.js
1define([2 '../../Core/defined',3 '../../Core/defineProperties',4 '../../Core/destroyObject',5 '../../Core/DeveloperError',6 '../../ThirdParty/knockout',7 '../getElement',8 './CesiumInspectorViewModel'9 ], function(10 defined,11 defineProperties,12 destroyObject,13 DeveloperError,14 knockout,15 getElement,16 CesiumInspectorViewModel) {17 'use strict';1819 /**20 * Inspector widget to aid in debugging21 *22 * @alias CesiumInspector23 * @constructor24 *25 * @param {Element|String} container The DOM element or ID that will contain the widget.26 * @param {Scene} scene The Scene instance to use.27 *28 * @demo {@link http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Cesium%20Inspector.html|Cesium Sandcastle Cesium Inspector Demo}29 */30 function CesiumInspector(container, scene) {31 //>>includeStart('debug', pragmas.debug);32 if (!defined(container)) {33 throw new DeveloperError('container is required.');34 }3536 if (!defined(scene)) {37 throw new DeveloperError('scene is required.');38 }39 //>>includeEnd('debug');4041 container = getElement(container);4243 var performanceContainer = document.createElement('div');4445 var viewModel = new CesiumInspectorViewModel(scene, performanceContainer);46 this._viewModel = viewModel;47 this._container = container;4849 var element = document.createElement('div');50 this._element = element;51 var text = document.createElement('div');52 text.textContent = 'Cesium Inspector';53 text.className = 'cesium-cesiumInspector-button';54 text.setAttribute('data-bind', 'click: toggleDropDown');55 element.appendChild(text);56 element.className = 'cesium-cesiumInspector';57 element.setAttribute('data-bind', 'css: { "cesium-cesiumInspector-visible" : dropDownVisible, "cesium-cesiumInspector-hidden" : !dropDownVisible }');58 container.appendChild(this._element);5960 var panel = document.createElement('div');61 this._panel = panel;62 panel.className = 'cesium-cesiumInspector-dropDown';63 element.appendChild(panel);6465 // General66 var general = document.createElement('div');67 general.className = 'cesium-cesiumInspector-sectionHeader';68 var plus = document.createElement('span');69 plus.className = 'cesium-cesiumInspector-toggleSwitch';70 plus.setAttribute('data-bind', 'click: toggleGeneral, text: generalSwitchText');71 general.appendChild(plus);72 general.appendChild(document.createTextNode('General'));73 panel.appendChild(general);7475 var generalSection = document.createElement('div');76 generalSection.className = 'cesium-cesiumInspector-section';77 generalSection.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-show" : generalVisible, "cesium-cesiumInspector-hide" : !generalVisible}');78 panel.appendChild(generalSection);7980 var debugShowFrustums = document.createElement('div');81 generalSection.appendChild(debugShowFrustums);82 var frustumStatistics = document.createElement('div');83 frustumStatistics.className = 'cesium-cesiumInspector-frustumStatistics';84 frustumStatistics.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-show" : frustums, "cesium-cesiumInspector-hide" : !frustums}, html: frustumStatisticText');85 var frustumsCheckbox = document.createElement('input');86 frustumsCheckbox.type = 'checkbox';87 frustumsCheckbox.setAttribute('data-bind', 'checked: frustums');88 debugShowFrustums.appendChild(frustumsCheckbox);89 debugShowFrustums.appendChild(document.createTextNode('Show Frustums'));90 debugShowFrustums.appendChild(frustumStatistics);9192 var debugShowFrustumPlanes = document.createElement('div');93 generalSection.appendChild(debugShowFrustumPlanes);94 var frustumPlanesCheckbox = document.createElement('input');95 frustumPlanesCheckbox.type = 'checkbox';96 frustumPlanesCheckbox.setAttribute('data-bind', 'checked: frustumPlanes');97 debugShowFrustumPlanes.appendChild(frustumPlanesCheckbox);98 debugShowFrustumPlanes.appendChild(document.createTextNode('Show Frustum Planes'));99100 var performanceDisplay = document.createElement('div');101 generalSection.appendChild(performanceDisplay);102 var pdCheckbox = document.createElement('input');103 pdCheckbox.type = 'checkbox';104 pdCheckbox.setAttribute('data-bind', 'checked: performance');105 performanceDisplay.appendChild(pdCheckbox);106 performanceDisplay.appendChild(document.createTextNode('Performance Display'));107108 performanceContainer.className = 'cesium-cesiumInspector-performanceDisplay';109 generalSection.appendChild(performanceContainer);110111 var shaderCacheDisplay = document.createElement('div');112 shaderCacheDisplay.className = 'cesium-cesiumInspector-shaderCache';113 shaderCacheDisplay.setAttribute('data-bind', 'html: shaderCacheText');114 generalSection.appendChild(shaderCacheDisplay);115116 var globeDepth = document.createElement('div');117 generalSection.appendChild(globeDepth);118 var gCheckbox = document.createElement('input');119 gCheckbox.type = 'checkbox';120 gCheckbox.setAttribute('data-bind', 'checked: globeDepth');121 globeDepth.appendChild(gCheckbox);122 globeDepth.appendChild(document.createTextNode('Show globe depth'));123124 var globeDepthFrustum = document.createElement('div');125 globeDepth.appendChild(globeDepthFrustum);126127 var pickDepth = document.createElement('div');128 generalSection.appendChild(pickDepth);129 var pCheckbox = document.createElement('input');130 pCheckbox.type = 'checkbox';131 pCheckbox.setAttribute('data-bind', 'checked: pickDepth');132 pickDepth.appendChild(pCheckbox);133 pickDepth.appendChild(document.createTextNode('Show pick depth'));134135 var depthFrustum = document.createElement('div');136 generalSection.appendChild(depthFrustum);137138 // Use a span with HTML binding so that we can indent with non-breaking spaces.139 var gLabel = document.createElement('span');140 gLabel.setAttribute('data-bind', 'html: " Frustum:"');141 depthFrustum.appendChild(gLabel);142143 var gText = document.createElement('span');144 gText.setAttribute('data-bind', 'text: depthFrustumText');145 depthFrustum.appendChild(gText);146147 var gMinusButton = document.createElement('input');148 gMinusButton.type = 'button';149 gMinusButton.value = '-';150 gMinusButton.className = 'cesium-cesiumInspector-pickButton';151 gMinusButton.setAttribute('data-bind', 'click: decrementDepthFrustum');152 depthFrustum.appendChild(gMinusButton);153154 var gPlusButton = document.createElement('input');155 gPlusButton.type = 'button';156 gPlusButton.value = '+';157 gPlusButton.className = 'cesium-cesiumInspector-pickButton';158 gPlusButton.setAttribute('data-bind', 'click: incrementDepthFrustum');159 depthFrustum.appendChild(gPlusButton);160161 // Primitives162 var prim = document.createElement('div');163 prim.className = 'cesium-cesiumInspector-sectionHeader';164 plus = document.createElement('span');165 plus.className = 'cesium-cesiumInspector-toggleSwitch';166 plus.setAttribute('data-bind', 'click: togglePrimitives, text: primitivesSwitchText');167 prim.appendChild(plus);168 prim.appendChild(document.createTextNode('Primitives'));169 panel.appendChild(prim);170171 var primitivesSection = document.createElement('div');172 primitivesSection.className = 'cesium-cesiumInspector-section';173 primitivesSection.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-show" : primitivesVisible, "cesium-cesiumInspector-hide" : !primitivesVisible}');174 panel.appendChild(primitivesSection);175 var pickPrimRequired = document.createElement('div');176 pickPrimRequired.className = 'cesium-cesiumInspector-pickSection';177 primitivesSection.appendChild(pickPrimRequired);178179 var pickPrimitiveButton = document.createElement('input');180 pickPrimitiveButton.type = 'button';181 pickPrimitiveButton.value = 'Pick a primitive';182 pickPrimitiveButton.className = 'cesium-cesiumInspector-pickButton';183 pickPrimitiveButton.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-pickButtonHighlight" : pickPrimitiveActive}, click: pickPrimitive');184 var buttonWrap = document.createElement('div');185 buttonWrap.className = 'cesium-cesiumInspector-center';186 buttonWrap.appendChild(pickPrimitiveButton);187 pickPrimRequired.appendChild(buttonWrap);188189 var debugSphere = document.createElement('div');190 pickPrimRequired.appendChild(debugSphere);191 var bsCheckbox = document.createElement('input');192 bsCheckbox.type = 'checkbox';193 bsCheckbox.setAttribute('data-bind', 'checked: primitiveBoundingSphere, enable: hasPickedPrimitive');194 debugSphere.appendChild(bsCheckbox);195 debugSphere.appendChild(document.createTextNode('Show bounding sphere'));196197 var refFrame = document.createElement('div');198 pickPrimRequired.appendChild(refFrame);199 var rfCheckbox = document.createElement('input');200 rfCheckbox.type = 'checkbox';201 rfCheckbox.setAttribute('data-bind', 'checked: primitiveReferenceFrame, enable: hasPickedPrimitive');202 refFrame.appendChild(rfCheckbox);203 refFrame.appendChild(document.createTextNode('Show reference frame'));204205 var primitiveOnly = document.createElement('div');206 this._primitiveOnly = primitiveOnly;207 pickPrimRequired.appendChild(primitiveOnly);208 var primitiveOnlyCheckbox = document.createElement('input');209 primitiveOnlyCheckbox.type = 'checkbox';210 primitiveOnlyCheckbox.setAttribute('data-bind', 'checked: filterPrimitive, enable: hasPickedPrimitive');211 primitiveOnly.appendChild(primitiveOnlyCheckbox);212 primitiveOnly.appendChild(document.createTextNode('Show only selected'));213214 // Terrain215 var terrain = document.createElement('div');216 terrain.className = 'cesium-cesiumInspector-sectionHeader';217 plus = document.createElement('span');218 plus.className = 'cesium-cesiumInspector-toggleSwitch';219 plus.setAttribute('data-bind', 'click: toggleTerrain, text: terrainSwitchText');220 terrain.appendChild(plus);221 terrain.appendChild(document.createTextNode('Terrain'));222 panel.appendChild(terrain);223224 var terrainSection = document.createElement('div');225 terrainSection.className = 'cesium-cesiumInspector-section';226 terrainSection.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-show" : terrainVisible, "cesium-cesiumInspector-hide" : !terrainVisible}');227 panel.appendChild(terrainSection);228 var pickTileRequired = document.createElement('div');229 pickTileRequired.className = 'cesium-cesiumInspector-pickSection';230 terrainSection.appendChild(pickTileRequired);231 var pickTileButton = document.createElement('input');232 pickTileButton.type = 'button';233 pickTileButton.value = 'Pick a tile';234 pickTileButton.className = 'cesium-cesiumInspector-pickButton';235 pickTileButton.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-pickButtonHighlight" : pickTileActive}, click: pickTile');236 buttonWrap = document.createElement('div');237 buttonWrap.appendChild(pickTileButton);238 buttonWrap.className = 'cesium-cesiumInspector-center';239 pickTileRequired.appendChild(buttonWrap);240 var tileInfo = document.createElement('div');241 pickTileRequired.appendChild(tileInfo);242 var parentTile = document.createElement('input');243 parentTile.type = 'button';244 parentTile.value = 'Parent';245 parentTile.className = 'cesium-cesiumInspector-pickButton';246 parentTile.setAttribute('data-bind', 'click: selectParent');247 var nwTile = document.createElement('input');248 nwTile.type = 'button';249 nwTile.value = 'NW';250 nwTile.className = 'cesium-cesiumInspector-pickButton';251 nwTile.setAttribute('data-bind', 'click: selectNW');252 var neTile = document.createElement('input');253 neTile.type = 'button';254 neTile.value = 'NE';255 neTile.className = 'cesium-cesiumInspector-pickButton';256 neTile.setAttribute('data-bind', 'click: selectNE');257 var swTile = document.createElement('input');258 swTile.type = 'button';259 swTile.value = 'SW';260 swTile.className = 'cesium-cesiumInspector-pickButton';261 swTile.setAttribute('data-bind', 'click: selectSW');262 var seTile = document.createElement('input');263 seTile.type = 'button';264 seTile.value = 'SE';265 seTile.className = 'cesium-cesiumInspector-pickButton';266 seTile.setAttribute('data-bind', 'click: selectSE');267268 var tileText = document.createElement('div');269 tileText.className = 'cesium-cesiumInspector-tileText';270 tileInfo.className = 'cesium-cesiumInspector-frustumStatistics';271 tileInfo.appendChild(tileText);272 tileInfo.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-show" : hasPickedTile, "cesium-cesiumInspector-hide" : !hasPickedTile}');273 tileText.setAttribute('data-bind', 'html: tileText');274275 var relativeText = document.createElement('div');276 relativeText.className = 'cesium-cesiumInspector-relativeText';277 relativeText.textContent = 'Select relative:';278 tileInfo.appendChild(relativeText);279280 var table = document.createElement('table');281 var tr1 = document.createElement('tr');282 var tr2 = document.createElement('tr');283 var td1 = document.createElement('td');284 td1.appendChild(parentTile);285 var td2 = document.createElement('td');286 td2.appendChild(nwTile);287 var td3 = document.createElement('td');288 td3.appendChild(neTile);289 tr1.appendChild(td1);290 tr1.appendChild(td2);291 tr1.appendChild(td3);292 var td4 = document.createElement('td');293 var td5 = document.createElement('td');294 td5.appendChild(swTile);295 var td6 = document.createElement('td');296 td6.appendChild(seTile);297 tr2.appendChild(td4);298 tr2.appendChild(td5);299 tr2.appendChild(td6);300 table.appendChild(tr1);301 table.appendChild(tr2);302303 tileInfo.appendChild(table);304305 var tileBoundingSphere = document.createElement('div');306 pickTileRequired.appendChild(tileBoundingSphere);307 var tbsCheck = document.createElement('input');308 tbsCheck.type = 'checkbox';309 tbsCheck.setAttribute('data-bind', 'checked: tileBoundingSphere, enable: hasPickedTile');310 tileBoundingSphere.appendChild(tbsCheck);311 tileBoundingSphere.appendChild(document.createTextNode('Show bounding volume'));312313 var renderTile = document.createElement('div');314 pickTileRequired.appendChild(renderTile);315 var rCheck = document.createElement('input');316 rCheck.type = 'checkbox';317 rCheck.setAttribute('data-bind', 'checked: filterTile, enable: hasPickedTile');318 renderTile.appendChild(rCheck);319 renderTile.appendChild(document.createTextNode('Show only selected'));320321 var wireframe = document.createElement('div');322 terrainSection.appendChild(wireframe);323 var wCheckbox = document.createElement('input');324 wCheckbox.type = 'checkbox';325 wCheckbox.setAttribute('data-bind', 'checked: wireframe');326 wireframe.appendChild(wCheckbox);327 wireframe.appendChild(document.createTextNode('Wireframe'));328329 var suspendUpdates = document.createElement('div');330 terrainSection.appendChild(suspendUpdates);331 var upCheckbox = document.createElement('input');332 upCheckbox.type = 'checkbox';333 upCheckbox.setAttribute('data-bind', 'checked: suspendUpdates');334 suspendUpdates.appendChild(upCheckbox);335 suspendUpdates.appendChild(document.createTextNode('Suspend LOD update'));336337 var tileCoords = document.createElement('div');338 terrainSection.appendChild(tileCoords);339 var coordCheck = document.createElement('input');340 coordCheck.type = 'checkbox';341 coordCheck.setAttribute('data-bind', 'checked: tileCoordinates');342 tileCoords.appendChild(coordCheck);343 tileCoords.appendChild(document.createTextNode('Show tile coordinates'));344345 knockout.applyBindings(viewModel, this._element);346 }347348 defineProperties(CesiumInspector.prototype, {349 /**350 * Gets the parent container.351 * @memberof CesiumInspector.prototype352 *353 * @type {Element}354 */355 container : {356 get : function() {357 return this._container;358 }359 },360361 /**362 * Gets the view model.363 * @memberof CesiumInspector.prototype364 *365 * @type {CesiumInspectorViewModel}366 */367 viewModel : {368 get : function() {369 return this._viewModel;370 }371 }372 });373374 /**375 * @returns {Boolean} true if the object has been destroyed, false otherwise.376 */377 CesiumInspector.prototype.isDestroyed = function() {378 return false;379 };380381 /**382 * Destroys the widget. Should be called if permanently383 * removing the widget from layout.384 */385 CesiumInspector.prototype.destroy = function() {386 knockout.cleanNode(this._element);387 this._container.removeChild(this._element);388 this.viewModel.destroy();389390 return destroyObject(this);391 };392393 return CesiumInspector;
...
Cesium3DTilesInspector.js
Source:Cesium3DTilesInspector.js
1define([2 '../../Core/Check',3 '../../Core/defaultValue',4 '../../Core/defined',5 '../../Core/defineProperties',6 '../../Core/destroyObject',7 '../../ThirdParty/knockout',8 '../getElement',9 './Cesium3DTilesInspectorViewModel'10 ], function(11 Check,12 defaultValue,13 defined,14 defineProperties,15 destroyObject,16 knockout,17 getElement,18 Cesium3DTilesInspectorViewModel) {19 'use strict';2021 /**22 * Inspector widget to aid in debugging 3D Tiles23 *24 * @alias Cesium3DTilesInspector25 * @constructor26 *27 * @param {Element|String} container The DOM element or ID that will contain the widget.28 * @param {Scene} scene the Scene instance to use.29 */30 function Cesium3DTilesInspector(container, scene) {31 //>includeStart('debug', pragmas.debug);32 Check.defined('container', container);33 Check.typeOf.object('scene', scene);34 //>>includeEnd('debug');3536 container = getElement(container);37 var element = document.createElement('div');38 var performanceContainer = document.createElement('div');39 performanceContainer.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-show" : performance, "cesium-cesiumInspector-hide" : !performance}');40 var viewModel = new Cesium3DTilesInspectorViewModel(scene, performanceContainer);4142 this._viewModel = viewModel;43 this._container = container;44 this._element = element;4546 var text = document.createElement('div');47 text.textContent = '3D Tiles Inspector';48 text.className = 'cesium-cesiumInspector-button';49 text.setAttribute('data-bind', 'click: toggleInspector');50 element.appendChild(text);51 element.className = 'cesium-cesiumInspector cesium-3DTilesInspector';52 element.setAttribute('data-bind', 'css: { "cesium-cesiumInspector-visible" : inspectorVisible, "cesium-cesiumInspector-hidden" : !inspectorVisible}');53 container.appendChild(element);5455 var tilesetPanelContents = document.createElement('div');56 var displayPanelContents = document.createElement('div');57 var updatePanelContents = document.createElement('div');58 var loggingPanelContents = document.createElement('div');59 var tileDebugLabelsPanelContents = document.createElement('div');60 var stylePanelContents = document.createElement('div');61 var optimizationPanelContents = document.createElement('div');6263 var properties = document.createElement('div');64 properties.className = 'field-group';65 var propertiesLabel = document.createElement('label');66 propertiesLabel.className = 'field-label';67 propertiesLabel.appendChild(document.createTextNode('Properties: '));68 var propertiesField = document.createElement('div');69 propertiesField.setAttribute('data-bind', 'text: properties');70 properties.appendChild(propertiesLabel);71 properties.appendChild(propertiesField);72 tilesetPanelContents.appendChild(properties);73 tilesetPanelContents.appendChild(makeButton('togglePickTileset', 'Pick Tileset', 'pickActive'));74 tilesetPanelContents.appendChild(makeButton('trimTilesCache', 'Trim Tiles Cache'));75 tilesetPanelContents.appendChild(makeCheckbox('picking', 'Enable Picking'));7677 displayPanelContents.appendChild(makeCheckbox('colorize', 'Colorize'));78 displayPanelContents.appendChild(makeCheckbox('wireframe', 'Wireframe'));79 displayPanelContents.appendChild(makeCheckbox('showBoundingVolumes', 'Bounding Volumes'));80 displayPanelContents.appendChild(makeCheckbox('showContentBoundingVolumes', 'Content Volumes'));81 displayPanelContents.appendChild(makeCheckbox('showRequestVolumes', 'Request Volumes'));8283 updatePanelContents.appendChild(makeCheckbox('freezeFrame', 'Freeze Frame'));84 updatePanelContents.appendChild(makeCheckbox('dynamicScreenSpaceError', 'Dynamic Screen Space Error'));85 var sseContainer = document.createElement('div');86 sseContainer.appendChild(makeRangeInput('maximumScreenSpaceError', 0, 128, 1, 'Maximum Screen Space Error'));87 updatePanelContents.appendChild(sseContainer);88 var dynamicScreenSpaceErrorContainer = document.createElement('div');89 dynamicScreenSpaceErrorContainer.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-show" : dynamicScreenSpaceError, "cesium-cesiumInspector-hide" : !dynamicScreenSpaceError}');90 dynamicScreenSpaceErrorContainer.appendChild(makeRangeInput('dynamicScreenSpaceErrorDensitySliderValue', 0, 1, 0.005, 'Screen Space Error Density', 'dynamicScreenSpaceErrorDensity'));91 dynamicScreenSpaceErrorContainer.appendChild(makeRangeInput('dynamicScreenSpaceErrorFactor', 1, 10, 0.1, 'Screen Space Error Factor'));92 updatePanelContents.appendChild(dynamicScreenSpaceErrorContainer);9394 loggingPanelContents.appendChild(makeCheckbox('performance', 'Performance'));95 loggingPanelContents.appendChild(performanceContainer);96 loggingPanelContents.appendChild(makeCheckbox('showStatistics', 'Statistics'));97 var statistics = document.createElement('div');98 statistics.className = 'cesium-3dTilesInspector-statistics';99 statistics.setAttribute('data-bind', 'html: statisticsText, visible: showStatistics');100 loggingPanelContents.appendChild(statistics);101 loggingPanelContents.appendChild(makeCheckbox('showPickStatistics', 'Pick Statistics'));102 var pickStatistics = document.createElement('div');103 pickStatistics.className = 'cesium-3dTilesInspector-statistics';104 pickStatistics.setAttribute('data-bind', 'html: pickStatisticsText, visible: showPickStatistics');105 loggingPanelContents.appendChild(pickStatistics);106107 stylePanelContents.appendChild(document.createTextNode('Color Blend Mode: '));108 var blendDropdown = document.createElement('select');109 blendDropdown.setAttribute('data-bind', 'options: colorBlendModes, ' +110 'optionsText: "text", ' +111 'optionsValue: "value", ' +112 'value: colorBlendMode');113 stylePanelContents.appendChild(blendDropdown);114 var styleEditor = document.createElement('textarea');115 styleEditor.setAttribute('data-bind', 'textInput: styleString, event: { keydown: styleEditorKeyPress }');116 stylePanelContents.className = 'cesium-cesiumInspector-styleEditor';117 stylePanelContents.appendChild(styleEditor);118 var closeStylesBtn = makeButton('compileStyle', 'Compile (Ctrl+Enter)');119 stylePanelContents.appendChild(closeStylesBtn);120 var errorBox = document.createElement('div');121 errorBox.className = 'cesium-cesiumInspector-error';122 errorBox.setAttribute('data-bind', 'text: editorError');123 stylePanelContents.appendChild(errorBox);124125 tileDebugLabelsPanelContents.appendChild(makeCheckbox('showOnlyPickedTileDebugLabel', 'Show Picked Only'));126 tileDebugLabelsPanelContents.appendChild(makeCheckbox('showGeometricError', 'Geometric Error'));127 tileDebugLabelsPanelContents.appendChild(makeCheckbox('showRenderingStatistics', 'Rendering Statistics'));128 tileDebugLabelsPanelContents.appendChild(makeCheckbox('showMemoryUsage', 'Memory Usage (MB)'));129 tileDebugLabelsPanelContents.appendChild(makeCheckbox('showUrl', 'Url'));130131 optimizationPanelContents.appendChild(makeCheckbox('skipLevelOfDetail', 'Skip Tile LODs'));132 var skipScreenSpaceErrorFactorContainer = document.createElement('div');133 skipScreenSpaceErrorFactorContainer.appendChild(makeRangeInput('skipScreenSpaceErrorFactor', 1, 50, 1, 'Skip SSE Factor'));134 optimizationPanelContents.appendChild(skipScreenSpaceErrorFactorContainer);135 var baseScreenSpaceError = document.createElement('div');136 baseScreenSpaceError.appendChild(makeRangeInput('baseScreenSpaceError', 0, 4096, 1, 'SSE before skipping LOD'));137 optimizationPanelContents.appendChild(baseScreenSpaceError);138 var skipLevelsContainer = document.createElement('div');139 skipLevelsContainer.appendChild(makeRangeInput('skipLevels', 0, 10, 1, 'Min. levels to skip'));140 optimizationPanelContents.appendChild(skipLevelsContainer);141 optimizationPanelContents.appendChild(makeCheckbox('immediatelyLoadDesiredLevelOfDetail', 'Load only tiles that meet the max. SSE.'));142 optimizationPanelContents.appendChild(makeCheckbox('loadSiblings', 'Load siblings of visible tiles.'));143144 var tilesetPanel = makeSection('Tileset', 'tilesetVisible', 'toggleTileset', tilesetPanelContents);145 var displayPanel = makeSection('Display', 'displayVisible', 'toggleDisplay', displayPanelContents);146 var updatePanel = makeSection('Update', 'updateVisible', 'toggleUpdate', updatePanelContents);147 var loggingPanel = makeSection('Logging', 'loggingVisible', 'toggleLogging', loggingPanelContents);148 var tileDebugLabelsPanel = makeSection('Tile Debug Labels', 'tileDebugLabelsVisible', 'toggleTileDebugLabels', tileDebugLabelsPanelContents);149 var stylePanel = makeSection('Style', 'styleVisible', 'toggleStyle', stylePanelContents);150 var optimizationPanel = makeSection('Optimization', 'optimizationVisible', 'toggleOptimization', optimizationPanelContents);151152 // first add and bind all the toggleable panels153 element.appendChild(tilesetPanel);154 element.appendChild(displayPanel);155 element.appendChild(updatePanel);156 element.appendChild(loggingPanel);157 element.appendChild(tileDebugLabelsPanel);158 element.appendChild(stylePanel);159 element.appendChild(optimizationPanel);160161 knockout.applyBindings(viewModel, element);162 }163164 defineProperties(Cesium3DTilesInspector.prototype, {165 /**166 * Gets the parent container.167 * @memberof Cesium3DTilesInspector.prototype168 *169 * @type {Element}170 */171 container : {172 get : function() {173 return this._container;174 }175 },176177 /**178 * Gets the view model.179 * @memberof Cesium3DTilesInspector.prototype180 *181 * @type {Cesium3DTilesInspectorViewModel}182 */183 viewModel : {184 get : function() {185 return this._viewModel;186 }187 }188 });189190 /**191 * @returns {Boolean} true if the object has been destroyed, false otherwise.192 */193 Cesium3DTilesInspector.prototype.isDestroyed = function() {194 return false;195 };196197 /**198 * Destroys the widget. Should be called if permanently199 * removing the widget from layout.200 */201 Cesium3DTilesInspector.prototype.destroy = function() {202 knockout.cleanNode(this._element);203 this._container.removeChild(this._element);204 this.viewModel.destroy();205206 return destroyObject(this);207 };208209 function makeSection(name, visibleProp, toggleProp, contents) {210 var toggle = document.createElement('span');211 toggle.className = 'cesium-cesiumInspector-toggleSwitch';212 toggle.setAttribute('data-bind', 'text: ' + visibleProp + ' ? "-" : "+", click: ' + toggleProp);213214 var header = document.createElement('div');215 header.className = 'cesium-cesiumInspector-sectionHeader';216 header.appendChild(toggle);217 header.appendChild(document.createTextNode(name));218219 var section = document.createElement('div');220 section.className = 'cesium-cesiumInspector-section';221 section.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-show" : ' + visibleProp + ', "cesium-cesiumInspector-hide" : !' + visibleProp + '}');222 section.appendChild(contents);223224 var panel = document.createElement('div');225 panel.className = 'cesium-cesiumInspector-dropDown';226 panel.appendChild(header);227 panel.appendChild(section);228229 return panel;230 }231232 function makeCheckbox(property, text) {233 var checkbox = document.createElement('input');234 checkbox.type = 'checkbox';235 checkbox.setAttribute('data-bind', 'checked: ' + property);236237 var container = document.createElement('div');238 container.appendChild(checkbox);239 container.appendChild(document.createTextNode(text));240241 return container;242 }243244 function makeRangeInput(property, min, max, step, text, displayProperty) {245 displayProperty = defaultValue(displayProperty, property);246 var input = document.createElement('input');247 input.setAttribute('data-bind', 'value: ' + displayProperty);248 input.type = 'number';249250 var slider = document.createElement('input');251 slider.type = 'range';252 slider.min = min;253 slider.max = max;254 slider.step = step;255 slider.setAttribute('data-bind', 'valueUpdate: "input", value: ' + property);256257 var wrapper = document.createElement('div');258 wrapper.appendChild(slider);259260 var container = document.createElement('div');261 container.className = 'cesium-cesiumInspector-slider';262 container.appendChild(document.createTextNode(text));263 container.appendChild(input);264 container.appendChild(wrapper);265266 return container;267 }268269 function makeButton(action, text, active) {270 var button = document.createElement('button');271 button.type = 'button';272 button.textContent = text;273 button.className = 'cesium-cesiumInspector-pickButton';274 var binding = 'click: ' + action;275 if (defined(active)) {276 binding += ', css: {"cesium-cesiumInspector-pickButtonHighlight" : ' + active + '}';277 }278 button.setAttribute('data-bind', binding);279280 return button;281 }282283 return Cesium3DTilesInspector;
...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!