@@ -262,8 +262,8 @@ PanelTest {
263 // Wait for the indicators to get into position.
263 // Wait for the indicators to get into position.
264 // (switches between normal and fullscreen modes are animated)
264 // (switches between normal and fullscreen modes are animated)
265− var indicatorArea = findChild(panel, "indicatorArea");
265+ var panelArea = findChild(panel, "panelArea");
266− tryCompare(indicatorArea, "y", 0);
266+ tryCompare(panelArea, "y", 0);
268 backgroundPressedSpy.clear();
268 backgroundPressedSpy.clear();
269 compare(backgroundPressedSpy.valid, true);
269 compare(backgroundPressedSpy.valid, true);
@@ -298,16 +298,12 @@ PanelTest {
298 tryCompare(panel.applicationMenus, "fullyOpened", true);
298 tryCompare(panel.applicationMenus, "fullyOpened", true);
301− function test_drag_show_data() {
301+ function test_drag_indicator_item_down_shows_menu_data() {
303− { tag: "pinned", fullscreen: false, call: null,
303+ { tag: "pinned", fullscreen: false, call: null, y: 0 },
305− { tag: "fullscreen", fullscreen: true, call: null,
304+ { tag: "fullscreen", fullscreen: true, call: null, y: -panel.minimizedPanelHeight },
306− indicatorY: -panel.indicators.minimizedPanelHeight },
307− { tag: "pinned-callActive", fullscreen: false, call: phoneCall,
305+ { tag: "pinned-callActive", fullscreen: false, call: phoneCall, y: 0},
309− { tag: "fullscreen-callActive", fullscreen: true, call: phoneCall,
306+ { tag: "fullscreen-callActive", fullscreen: true, call: phoneCall, y: -panel.minimizedPanelHeight }
310− indicatorY: -panel.indicators.minimizedPanelHeight }
@@ -315,7 +311,7 @@ PanelTest {
315 // indicators, first by running the hint animation, then after dragging down will
311 // indicators, first by running the hint animation, then after dragging down will
316 // expose more of the panel, binding it to the selected indicator and opening it's menu.
312 // expose more of the panel, binding it to the selected indicator and opening it's menu.
317 // Tested from first Y pixel to check for swipe from offscreen.
313 // Tested from first Y pixel to check for swipe from offscreen.
318− function test_drag_show(data) {
314+ function test_drag_indicator_item_down_shows_menu(data) {
319 panel.fullscreenMode = data.fullscreen;
315 panel.fullscreenMode = data.fullscreen;
320 callManager.foregroundCall = data.call;
316 callManager.foregroundCall = data.call;
@@ -325,12 +321,12 @@ PanelTest {
325 var menuContent = findChild(panel.indicators, "menuContent");
321 var menuContent = findChild(panel.indicators, "menuContent");
326 verify(menuContent !== null);
322 verify(menuContent !== null);
328− var indicatorArea = findChild(panel, "indicatorArea");
324+ var panelArea = findChild(panel, "panelArea");
329− verify(indicatorArea !== null);
325+ verify(panelArea !== null);
331 // Wait for the indicators to get into position.
327 // Wait for the indicators to get into position.
332 // (switches between normal and fullscreen modes are animated)
328 // (switches between normal and fullscreen modes are animated)
333− tryCompareFunction(function() { return indicatorArea.y }, data.indicatorY);
329+ tryCompareFunction(function() { return panelArea.y }, data.y);
335 for (var i = 0; i < root.originalModelData.length; i++) {
331 for (var i = 0; i < root.originalModelData.length; i++) {
336 var indicatorItem = get_indicator_item(i);
332 var indicatorItem = get_indicator_item(i);
@@ -360,95 +356,144 @@ PanelTest {
363− function test_drag_hide_data() {
359+ function test_drag_panel_handle_up_hides_menu_data() {
365− { tag: "pinned", fullscreen: false, call: null,
361+ { tag: "indicators-pinned", section: panel.indicators, fullscreen: false, call: null },
367− { tag: "fullscreen", fullscreen: true, call: null,
362+ { tag: "indicators-fullscreen", section: panel.indicators, fullscreen: true, call: null },
368− indicatorY: -panel.indicators.minimizedPanelHeight },
363+ { tag: "indicators-pinned-callActive", section: panel.indicators, fullscreen: false, call: phoneCall },
369− { tag: "pinned-callActive", fullscreen: false, call: phoneCall,
364+ { tag: "indicators-fullscreen-callActive", section: panel.indicators, fullscreen: true, call: phoneCall },
370− indicatorY: 0},
365+ { tag: "appMenus-pinned", section: panel.applicationMenus, fullscreen: false, call: null },
366+ { tag: "appMenus-fullscreen", section: panel.applicationMenus, fullscreen: true, call: null },
371− { tag: "fullscreen-callActive", fullscreen: true, call: phoneCall,
367+ { tag: "appMenus-pinned-callActive", section: panel.applicationMenus, fullscreen: false, call: phoneCall },
372− indicatorY: -panel.indicators.minimizedPanelHeight }
368+ { tag: "appMenus-fullscreen-callActive", section: panel.applicationMenus, fullscreen: true, call: phoneCall }
376 // Dragging the shown indicators up from bottom of panel will hide the indicators
372 // Dragging the shown indicators up from bottom of panel will hide the indicators
377 // Tested from last Y pixel to check for swipe from offscreen.
373 // Tested from last Y pixel to check for swipe from offscreen.
378− function test_drag_hide(data) {
374+ function test_drag_panel_handle_up_hides_menu(data) {
379 panel.fullscreenMode = data.fullscreen;
375 panel.fullscreenMode = data.fullscreen;
380 callManager.foregroundCall = data.call;
376 callManager.foregroundCall = data.call;
382− var panelRow = findChild(panel.indicators, "panelItemRow");
378+ var panelRow = findChild(data.section, "panelItemRow");
383 verify(panelRow !== null);
379 verify(panelRow !== null);
385− var menuContent = findChild(panel.indicators, "menuContent");
381+ var panelArea = findChild(panel, "panelArea");
386− verify(menuContent !== null);
382+ verify(panelArea !== null);
388− var indicatorArea = findChild(panel, "indicatorArea");
389− verify(indicatorArea !== null);
391 // Wait for the indicators to get into position.
384 // Wait for the indicators to get into position.
392 // (switches between normal and fullscreen modes are animated)
385 // (switches between normal and fullscreen modes are animated)
393− tryCompareFunction(function() { return indicatorArea.y }, data.indicatorY);
386+ tryCompareFunction(function() { return panelArea.y }, data.fullscreen ? -panel.minimizedPanelHeight : 0);
395− panel.indicators.show();
388+ data.section.show();
396− tryCompare(panel.indicators.showAnimation, "running", false);
389+ tryCompare(data.section.showAnimation, "running", false);
397− tryCompare(panel.indicators, "unitProgress", 1);
390+ tryCompare(data.section, "unitProgress", 1);
399− touchFlick(panel.indicators,
392+ touchFlick(data.section,
400− panel.indicators.width / 2, panel.height,
393+ data.section.width / 2, panel.height,
401− panel.indicators.width / 2, 0,
394+ data.section.width / 2, 0,
402 true /* beginTouch */, false /* endTouch */, units.gu(5), 15);
395 true /* beginTouch */, false /* endTouch */, units.gu(5), 15);
404 // Indicators height should follow the drag, and therefore increase accordingly.
397 // Indicators height should follow the drag, and therefore increase accordingly.
405 // They should be at least half-way through the screen
398 // They should be at least half-way through the screen
406 tryCompareFunction(
399 tryCompareFunction(
407− function() {return panel.indicators.height <= panel.height * 0.5},
400+ function() {return data.section.height <= panel.height * 0.5},
410− touchRelease(panel.indicators, panel.indicators.width / 2, 0);
403+ touchRelease(data.section, data.section.width / 2, 0);
412− tryCompare(panel.indicators.hideAnimation, "running", true);
405+ tryCompare(data.section.hideAnimation, "running", true);
413− tryCompare(panel.indicators.hideAnimation, "running", false);
406+ tryCompare(data.section.hideAnimation, "running", false);
414− tryCompare(panel.indicators, "state", "initial");
407+ tryCompare(data.section, "state", "initial");
417 function test_hint_data() {
410 function test_hint_data() {
419− { tag: "normal", fullscreen: false, call: null, hintExpected: true},
412+ { tag: "indicators-normal", section: panel.indicators, fullscreen: false, call: null, hintExpected: true},
420− { tag: "fullscreen", fullscreen: true, call: null, hintExpected: false},
413+ { tag: "indicators-fullscreen", section: panel.indicators, fullscreen: true, call: null, hintExpected: false},
414+ { tag: "indicators-callActive", section: panel.indicators, fullscreen: false, call: phoneCall, hintExpected: false},
415+ { tag: "appMenus-normal", section: panel.applicationMenus, fullscreen: false, call: null, hintExpected: true},
416+ { tag: "appMenus-fullscreen", section: panel.applicationMenus, fullscreen: true, call: null, hintExpected: false},
421− { tag: "call hint", fullscreen: false, call: phoneCall, hintExpected: false},
417+ { tag: "appMenus-callActive", section: panel.applicationMenus, fullscreen: false, call: phoneCall, hintExpected: false},
425 function test_hint(data) {
421 function test_hint(data) {
422+ PanelState.title = "Fake Title"
426 panel.fullscreenMode = data.fullscreen;
423 panel.fullscreenMode = data.fullscreen;
427 callManager.foregroundCall = data.call;
424 callManager.foregroundCall = data.call;
429 if (data.fullscreen) {
426 if (data.fullscreen) {
430 // Wait for the indicators to get into position.
427 // Wait for the indicators to get into position.
431 // (switches between normal and fullscreen modes are animated)
428 // (switches between normal and fullscreen modes are animated)
432− var indicatorArea = findChild(panel, "indicatorArea");
429+ var panelArea = findChild(panel, "panelArea");
433− tryCompare(indicatorArea, "y", -panel.panelHeight);
430+ tryCompare(panelArea, "y", -panel.minimizedPanelHeight);
436− var indicatorItem = get_indicator_item(0);
437− var mappedPosition = root.mapFromItem(indicatorItem, indicatorItem.width / 2, indicatorItem.height / 2);
433+ var mappedPosition = root.mapFromItem(data.section,
434+ data.section.barWidth / 2, data.section.minimizedPanelHeight / 2);
439− touchPress(panel, mappedPosition.x, panel.indicators.minimizedPanelHeight / 2);
436+ touchPress(panel, mappedPosition.x, panel.minimizedPanelHeight / 2);
441− // Give some time for a hint animation to change things, if any
438+ var showDragHandle = findChild(data.section, "showDragHandle")
442− wait(500);
439+ var hintingAnimation = findInvisibleChild(showDragHandle, "hintingAnimation");
440+ verify(hintingAnimation);
442+ compare(hintingAnimation.running, data.hintExpected)
443+ tryCompare(hintingAnimation, "running", false); // wait till animation completes
444 // no hint animation when fullscreen
445 // no hint animation when fullscreen
445− compare(panel.indicators.fullyClosed, !data.hintExpected, "Indicator should be fully closed");
446− compare(panel.indicators.partiallyOpened, data.hintExpected, "Indicator should be partialy opened");
446+ compare(data.section.partiallyOpened, data.hintExpected, "Indicator should be partialy opened");
447− compare(panel.indicators.fullyOpened, false, "Indicator should not be fully opened");
447+ compare(data.section.fullyOpened, false, "Indicator should not be fully opened");
449 touchRelease(panel, mappedPosition.x, panel.minimizedPanelHeight / 2);
449 touchRelease(panel, mappedPosition.x, panel.minimizedPanelHeight / 2);
452+ function test_drag_applicationMenu_down_shows_menu_data() {
454+ { tag: "normal", fullscreen: false, call: null, hintExpected: true},
455+ { tag: "fullscreen", fullscreen: true, call: null, hintExpected: false},
456+ { tag: "callActive", fullscreen: false, call: phoneCall, hintExpected: false}
460+ // Dragging the application menu will gradually expose the
461+ // menus, first by running the hint animation, then after dragging down will
462+ // expose more of the panel. Releasing the touch will complete the show.
463+ function test_drag_applicationMenu_down_shows_menu(data) {
464+ PanelState.title = "Fake Title";
465+ panel.fullscreenMode = data.fullscreen;
466+ callManager.foregroundCall = data.call;
468+ var panelRow = findChild(panel.indicators, "panelItemRow");
469+ verify(panelRow !== null);
471+ var menuContent = findChild(panel.indicators, "menuContent");
472+ verify(menuContent !== null);
474+ var panelArea = findChild(panel, "panelArea");
475+ verify(panelArea !== null);
477+ // Wait for the indicators to get into position.
478+ // (switches between normal and fullscreen modes are animated)
479+ tryCompareFunction(function() { return panelArea.y }, data.fullscreen ? -panel.minimizedPanelHeight : 0);
483+ units.gu(1), panel.height,
484+ true /* beginTouch */, false /* endTouch */, units.gu(5), 15);
486+ // Indicators height should follow the drag, and therefore increase accordingly.
487+ // They should be at least half-way through the screen
489+ function() {return panel.applicationMenus.height >= panel.height * 0.5},
492+ touchRelease(panel, units.gu(1), panel.height);
494+ tryCompare(panel.applicationMenus, "fullyOpened", true)
452 /* Checks that no input reaches items behind the indicator bar.
497 /* Checks that no input reaches items behind the indicator bar.
453 Ie., the indicator bar should eat all input events that hit it.
498 Ie., the indicator bar should eat all input events that hit it.
@@ -457,7 +502,7 @@ PanelTest {
457 // that it doesn't have a "weak spot" from where taps pass through.
502 // that it doesn't have a "weak spot" from where taps pass through.
458 var numTaps = 5;
503 var numTaps = 5;
459 var stepLength = (panel.width / (numTaps + 1));
504 var stepLength = (panel.width / (numTaps + 1));
460− var tapY = panel.indicators.minimizedPanelHeight / 2;
505+ var tapY = panel.minimizedPanelHeight / 2;
461 for (var i = 1; i <= numTaps; ++i) {
506 for (var i = 1; i <= numTaps; ++i) {
462 tap(panel, stepLength * i, tapY);
507 tap(panel, stepLength * i, tapY);
463 tryCompare(panel.indicators, "fullyClosed", true);
508 tryCompare(panel.indicators, "fullyClosed", true);
@@ -469,8 +514,8 @@ PanelTest {
469 // The center of the area not covered by the indicators menu
514 // The center of the area not covered by the indicators menu
470 // Ie, the visible darkened area behind the menu
515 // Ie, the visible darkened area behind the menu
471 var touchPosX = (panel.width - panel.indicators.width) / 2
516 var touchPosX = (panel.width - panel.indicators.width) / 2
472− var touchPosY = panel.indicators.minimizedPanelHeight +
517+ var touchPosY = panel.minimizedPanelHeight +
473− ((panel.height - panel.indicators.minimizedPanelHeight) / 2)
518+ ((panel.height - panel.minimizedPanelHeight) / 2)
475 // input goes through while the indicators menu is closed
520 // input goes through while the indicators menu is closed
476 tryCompare(panel.indicators, "fullyClosed", true);
521 tryCompare(panel.indicators, "fullyClosed", true);
@@ -512,8 +557,8 @@ PanelTest {
512 // The center of the area not covered by the indicators menu
557 // The center of the area not covered by the indicators menu
513 // Ie, the visible darkened area behind the menu
558 // Ie, the visible darkened area behind the menu
514 var touchPosX = panel.applicationMenus.width + (panel.width - panel.applicationMenus.width) / 2
559 var touchPosX = panel.applicationMenus.width + (panel.width - panel.applicationMenus.width) / 2
515− var touchPosY = panel.applicationMenus.minimizedPanelHeight +
560+ var touchPosY = panel.minimizedPanelHeight +
516− ((panel.height - panel.applicationMenus.minimizedPanelHeight) / 2)
561+ ((panel.height - panel.minimizedPanelHeight) / 2)
518 // input goes through while the indicators menu is closed
563 // input goes through while the indicators menu is closed
519 tryCompare(panel.applicationMenus, "fullyClosed", true);
564 tryCompare(panel.applicationMenus, "fullyClosed", true);
@@ -557,12 +602,12 @@ PanelTest {
559 function test_tapNearTopEdgeWithPanelInFullscreenMode() {
604 function test_tapNearTopEdgeWithPanelInFullscreenMode() {
560− var indicatorArea = findChild(panel, "indicatorArea");
605+ var panelArea = findChild(panel, "panelArea");
561− verify(indicatorArea);
606+ verify(panelArea);
563 panel.fullscreenMode = true;
608 panel.fullscreenMode = true;
564 // wait until if finishes hiding itself
609 // wait until if finishes hiding itself
565− tryCompare(indicatorArea, "y", -panel.minimizedPanelHeight);
610+ tryCompare(panelArea, "y", -panel.minimizedPanelHeight);
567 compare(panel.indicators.shown, false);
612 compare(panel.indicators.shown, false);
568 verify(panel.indicators.fullyClosed);
613 verify(panel.indicators.fullyClosed);
@@ -591,7 +636,7 @@ PanelTest {
592 mouseClick(panel.indicators,
637 mouseClick(panel.indicators,
593 panel.indicators.width / 2,
638 panel.indicators.width / 2,
594− panel.indicators.minimizedPanelHeight / 2);
639+ panel.minimizedPanelHeight / 2);
596 compare(panel.indicators.shown, false);
641 compare(panel.indicators.shown, false);
597 verify(panel.indicators.fullyClosed);
642 verify(panel.indicators.fullyClosed);
@@ -603,7 +648,7 @@ PanelTest {
604 mouseClick(panel.indicators,
649 mouseClick(panel.indicators,
605 panel.indicators.width / 2,
650 panel.indicators.width / 2,
606− panel.indicators.minimizedPanelHeight / 2);
651+ panel.minimizedPanelHeight / 2);
608 compare(panel.indicators.shown, true);
653 compare(panel.indicators.shown, true);
609 tryCompare(panel.indicators, "fullyOpened", true);
654 tryCompare(panel.indicators, "fullyOpened", true);