Bug 1120231 - Cleanup browser_flame-graph-04.js a bit and reduce more dt orange introduced by changeset 6b85abb2bc19 on a CLOSED TREE, r=me
authorVictor Porof <vporof@mozilla.com>
Mon, 12 Jan 2015 16:31:20 -0500
changeset 223417 7a0291140e8e1e2939a4f007f4051a7bf127c2ae
parent 223416 3c53c0e799019455ec1bca4fcb8a5250deb5eb55
child 223418 57bc13854952172e8e5f49184d581764c6b7e2e3
push id28093
push userkwierso@gmail.com
push dateTue, 13 Jan 2015 04:00:18 +0000
treeherdermozilla-central@3d846527576f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1120231
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1120231 - Cleanup browser_flame-graph-04.js a bit and reduce more dt orange introduced by changeset 6b85abb2bc19 on a CLOSED TREE, r=me
browser/devtools/shared/test/browser_flame-graph-04.js
--- a/browser/devtools/shared/test/browser_flame-graph-04.js
+++ b/browser/devtools/shared/test/browser_flame-graph-04.js
@@ -33,38 +33,43 @@ function* performTest() {
 }
 
 function testGraph(graph) {
   is(graph._averageCharWidth, getAverageCharWidth(),
     "The average char width was calculated correctly.");
   is(graph._overflowCharWidth, getCharWidth(L10N.ellipsis),
     "The ellipsis char width was calculated correctly.");
 
-  is(graph._getTextWidthApprox("This text is maybe overflowing"),
-    getAverageCharWidth() * 30,
+  let text = "This text is maybe overflowing";
+  let text1000px = graph._getFittedText(text, 1000);
+  let text50px = graph._getFittedText(text, 50);
+  let text10px = graph._getFittedText(text, 10);
+  let text1px = graph._getFittedText(text, 1);
+
+  is(graph._getTextWidthApprox(text), getAverageCharWidth() * text.length,
     "The approximate width was calculated correctly.");
 
-  is(graph._getFittedText("This text is maybe overflowing", 1000),
-    "This text is maybe overflowing",
+  info("Text at 1000px width: " + text1000px);
+  info("Text at 50px width  : " + text50px);
+  info("Text at 10px width  : " + text10px);
+  info("Text at 1px width   : " + text1px);
+
+  is(text1000px, text,
     "The fitted text for 1000px width is correct.");
 
-  isnot(graph._getFittedText("This text is maybe overflowing", 100),
-    "This text is maybe overflowing",
-    "The fitted text for 100px width is correct (1).");
+  isnot(text50px, text,
+    "The fitted text for 50px width is correct (1).");
 
-  ok(graph._getFittedText("This text is maybe overflowing", 100)
-    .contains(L10N.ellipsis),
-    "The fitted text for 100px width is correct (2).");
+  ok(text50px.contains(L10N.ellipsis),
+    "The fitted text for 50px width is correct (2).");
 
-  is(graph._getFittedText("This text is maybe overflowing", 10),
-    L10N.ellipsis,
+  is(graph._getFittedText(text, 10), L10N.ellipsis,
     "The fitted text for 10px width is correct.");
 
-  is(graph._getFittedText("This text is maybe overflowing", 1),
-    "",
+  is(graph._getFittedText(text, 1), "",
     "The fitted text for 1px width is correct.");
 }
 
 function getAverageCharWidth() {
   let letterWidthsSum = 0;
   let start = 32; // space
   let end = 123; // "z"