3 <script src="../http/tests/inspector/inspector-test.js"></script>
4 <script type="text/javascript">
7 function createFakeTab(title, width)
13 return { width: width, title: title, toString: toString };
16 var dropDownButtonMeasuredWidth = 10;
17 function getTabsToShowAndDumpResults(tabsOrdered, tabsHistory, totalWidth)
19 var tabsToShowIndexes = WebInspector.TabbedPane.prototype._tabsToShowIndexes(tabsOrdered, tabsHistory, totalWidth, dropDownButtonMeasuredWidth);
20 InspectorTest.addResult(" tabsToShowIndexes = [" + String(tabsToShowIndexes) + "]");
23 function testWidthsAndHistory(widths, history, totalWidth)
27 for (var i = 0; i < widths.length; i++)
28 tabsOrdered.push(createFakeTab("tab " + i, widths[i]));
29 for (var i = 0; i < history.length; i++)
30 tabsHistory.push(tabsOrdered[history[i]]);
31 InspectorTest.addResult("Running tabs to show test:");
32 InspectorTest.addResult(" widths = [" + String(widths) + "]");
33 InspectorTest.addResult(" tabsHistory = [" + String(tabsHistory) + "]");
34 InspectorTest.addResult(" totalWidth = " + totalWidth + ", dropDownButtonMeasuredWidth = " + dropDownButtonMeasuredWidth);
35 getTabsToShowAndDumpResults(tabsOrdered, tabsHistory, totalWidth);
38 function testWithDifferentTotalWidths(widths, history)
40 testWidthsAndHistory(widths, history, 370);
41 testWidthsAndHistory(widths, history, 360);
42 testWidthsAndHistory(widths, history, 350);
43 testWidthsAndHistory(widths, history, 300);
44 testWidthsAndHistory(widths, history, 250);
45 testWidthsAndHistory(widths, history, 200);
46 testWidthsAndHistory(widths, history, 150);
47 testWidthsAndHistory(widths, history, 100);
48 testWidthsAndHistory(widths, history, 60);
49 testWidthsAndHistory(widths, history, 50);
50 InspectorTest.addResult("");
53 var widths = [50, 50, 60, 60, 70, 70];
54 testWithDifferentTotalWidths(widths, [0, 1, 2, 3, 4, 5]);
55 testWithDifferentTotalWidths(widths, [5, 4, 3, 2, 1, 0]);
56 testWithDifferentTotalWidths(widths, [0, 2, 4, 1, 3, 5]);
57 testWithDifferentTotalWidths(widths, [5, 3, 1, 4, 2, 0]);
59 InspectorTest.completeTest();
63 <body onload="runTest()">
64 <p>Tests tabbed pane tabs to show calculation.</p>
65 <a href="https://bugs.webkit.org/show_bug.cgi?id=75085">Bug 75085</a>