@@ -262,8 +262,8 @@ PanelTest {
262262
263263 // Wait for the indicators to get into position.
264264 // (switches between normal and fullscreen modes are animated)
265− var indicatorArea = findChild(panel, "indicatorArea");
266− tryCompare(indicatorArea, "y", 0);
265+ var panelArea = findChild(panel, "panelArea");
266+ tryCompare(panelArea, "y", 0);
267267
268268 backgroundPressedSpy.clear();
269269 compare(backgroundPressedSpy.valid, true);
@@ -298,16 +298,12 @@ PanelTest {
298298 tryCompare(panel.applicationMenus, "fullyOpened", true);
299299 }
300300
301− function test_drag_show_data() {
301+ function test_drag_indicator_item_down_shows_menu_data() {
302302 return [
303− { tag: "pinned", fullscreen: false, call: null,
304− indicatorY: 0 },
305− { tag: "fullscreen", fullscreen: true, call: null,
306− indicatorY: -panel.indicators.minimizedPanelHeight },
307− { tag: "pinned-callActive", fullscreen: false, call: phoneCall,
308− indicatorY: 0},
309− { tag: "fullscreen-callActive", fullscreen: true, call: phoneCall,
310− indicatorY: -panel.indicators.minimizedPanelHeight }
303+ { tag: "pinned", fullscreen: false, call: null, y: 0 },
304+ { tag: "fullscreen", fullscreen: true, call: null, y: -panel.minimizedPanelHeight },
305+ { tag: "pinned-callActive", fullscreen: false, call: phoneCall, y: 0},
306+ { tag: "fullscreen-callActive", fullscreen: true, call: phoneCall, y: -panel.minimizedPanelHeight }
311307 ];
312308 }
313309
@@ -315,7 +311,7 @@ PanelTest {
315311 // indicators, first by running the hint animation, then after dragging down will
316312 // expose more of the panel, binding it to the selected indicator and opening it's menu.
317313 // 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) {
319315 panel.fullscreenMode = data.fullscreen;
320316 callManager.foregroundCall = data.call;
321317
@@ -325,12 +321,12 @@ PanelTest {
325321 var menuContent = findChild(panel.indicators, "menuContent");
326322 verify(menuContent !== null);
327323
328− var indicatorArea = findChild(panel, "indicatorArea");
329− verify(indicatorArea !== null);
324+ var panelArea = findChild(panel, "panelArea");
325+ verify(panelArea !== null);
330326
331327 // Wait for the indicators to get into position.
332328 // (switches between normal and fullscreen modes are animated)
333− tryCompareFunction(function() { return indicatorArea.y }, data.indicatorY);
329+ tryCompareFunction(function() { return panelArea.y }, data.y);
334330
335331 for (var i = 0; i < root.originalModelData.length; i++) {
336332 var indicatorItem = get_indicator_item(i);
@@ -360,95 +356,144 @@ PanelTest {
360356 }
361357 }
362358
363− function test_drag_hide_data() {
359+ function test_drag_panel_handle_up_hides_menu_data() {
364360 return [
365− { tag: "pinned", fullscreen: false, call: null,
366− indicatorY: 0 },
367− { tag: "fullscreen", fullscreen: true, call: null,
368− indicatorY: -panel.indicators.minimizedPanelHeight },
369− { tag: "pinned-callActive", fullscreen: false, call: phoneCall,
370− indicatorY: 0},
371− { tag: "fullscreen-callActive", fullscreen: true, call: phoneCall,
372− indicatorY: -panel.indicators.minimizedPanelHeight }
361+ { tag: "indicators-pinned", section: panel.indicators, fullscreen: false, call: null },
362+ { tag: "indicators-fullscreen", section: panel.indicators, fullscreen: true, call: null },
363+ { tag: "indicators-pinned-callActive", section: panel.indicators, fullscreen: false, call: phoneCall },
364+ { tag: "indicators-fullscreen-callActive", section: panel.indicators, fullscreen: true, call: phoneCall },
365+ { tag: "appMenus-pinned", section: panel.applicationMenus, fullscreen: false, call: null },
366+ { tag: "appMenus-fullscreen", section: panel.applicationMenus, fullscreen: true, call: null },
367+ { tag: "appMenus-pinned-callActive", section: panel.applicationMenus, fullscreen: false, call: phoneCall },
368+ { tag: "appMenus-fullscreen-callActive", section: panel.applicationMenus, fullscreen: true, call: phoneCall }
373369 ];
374370 }
375371
376372 // Dragging the shown indicators up from bottom of panel will hide the indicators
377373 // 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) {
379375 panel.fullscreenMode = data.fullscreen;
380376 callManager.foregroundCall = data.call;
381377
382− var panelRow = findChild(panel.indicators, "panelItemRow");
378+ var panelRow = findChild(data.section, "panelItemRow");
383379 verify(panelRow !== null);
384380
385− var menuContent = findChild(panel.indicators, "menuContent");
386− verify(menuContent !== null);
387−
388− var indicatorArea = findChild(panel, "indicatorArea");
389− verify(indicatorArea !== null);
381+ var panelArea = findChild(panel, "panelArea");
382+ verify(panelArea !== null);
390383
391384 // Wait for the indicators to get into position.
392385 // (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);
394387
395− panel.indicators.show();
396− tryCompare(panel.indicators.showAnimation, "running", false);
397− tryCompare(panel.indicators, "unitProgress", 1);
388+ data.section.show();
389+ tryCompare(data.section.showAnimation, "running", false);
390+ tryCompare(data.section, "unitProgress", 1);
398391
399− touchFlick(panel.indicators,
400− panel.indicators.width / 2, panel.height,
401− panel.indicators.width / 2, 0,
392+ touchFlick(data.section,
393+ data.section.width / 2, panel.height,
394+ data.section.width / 2, 0,
402395 true /* beginTouch */, false /* endTouch */, units.gu(5), 15);
403396
404397 // Indicators height should follow the drag, and therefore increase accordingly.
405398 // They should be at least half-way through the screen
406399 tryCompareFunction(
407− function() {return panel.indicators.height <= panel.height * 0.5},
400+ function() {return data.section.height <= panel.height * 0.5},
408401 true);
409402
410− touchRelease(panel.indicators, panel.indicators.width / 2, 0);
403+ touchRelease(data.section, data.section.width / 2, 0);
411404
412− tryCompare(panel.indicators.hideAnimation, "running", true);
413− tryCompare(panel.indicators.hideAnimation, "running", false);
414− tryCompare(panel.indicators, "state", "initial");
405+ tryCompare(data.section.hideAnimation, "running", true);
406+ tryCompare(data.section.hideAnimation, "running", false);
407+ tryCompare(data.section, "state", "initial");
415408 }
416409
417410 function test_hint_data() {
418411 return [
419− { tag: "normal", fullscreen: false, call: null, hintExpected: true},
420− { tag: "fullscreen", fullscreen: true, call: null, hintExpected: false},
421− { tag: "call hint", fullscreen: false, call: phoneCall, hintExpected: false},
412+ { tag: "indicators-normal", section: panel.indicators, fullscreen: false, call: null, hintExpected: true},
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},
417+ { tag: "appMenus-callActive", section: panel.applicationMenus, fullscreen: false, call: phoneCall, hintExpected: false},
422418 ];
423419 }
424420
425421 function test_hint(data) {
422+ PanelState.title = "Fake Title"
426423 panel.fullscreenMode = data.fullscreen;
427424 callManager.foregroundCall = data.call;
428425
429426 if (data.fullscreen) {
430427 // Wait for the indicators to get into position.
431428 // (switches between normal and fullscreen modes are animated)
432− var indicatorArea = findChild(panel, "indicatorArea");
433− tryCompare(indicatorArea, "y", -panel.panelHeight);
429+ var panelArea = findChild(panel, "panelArea");
430+ tryCompare(panelArea, "y", -panel.minimizedPanelHeight);
434431 }
435432
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);
438435
439− touchPress(panel, mappedPosition.x, panel.indicators.minimizedPanelHeight / 2);
436+ touchPress(panel, mappedPosition.x, panel.minimizedPanelHeight / 2);
440437
441− // Give some time for a hint animation to change things, if any
442− wait(500);
438+ var showDragHandle = findChild(data.section, "showDragHandle")
439+ var hintingAnimation = findInvisibleChild(showDragHandle, "hintingAnimation");
440+ verify(hintingAnimation);
441+
442+ compare(hintingAnimation.running, data.hintExpected)
443+ tryCompare(hintingAnimation, "running", false); // wait till animation completes
443444
444445 // 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");
447− compare(panel.indicators.fullyOpened, false, "Indicator should not be fully opened");
446+ compare(data.section.partiallyOpened, data.hintExpected, "Indicator should be partialy opened");
447+ compare(data.section.fullyOpened, false, "Indicator should not be fully opened");
448448
449449 touchRelease(panel, mappedPosition.x, panel.minimizedPanelHeight / 2);
450450 }
451451
452+ function test_drag_applicationMenu_down_shows_menu_data() {
453+ return [
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}
457+ ];
458+ }
459+
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;
467+
468+ var panelRow = findChild(panel.indicators, "panelItemRow");
469+ verify(panelRow !== null);
470+
471+ var menuContent = findChild(panel.indicators, "menuContent");
472+ verify(menuContent !== null);
473+
474+ var panelArea = findChild(panel, "panelArea");
475+ verify(panelArea !== null);
476+
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);
480+
481+ touchFlick(panel,
482+ units.gu(1), 0,
483+ units.gu(1), panel.height,
484+ true /* beginTouch */, false /* endTouch */, units.gu(5), 15);
485+
486+ // Indicators height should follow the drag, and therefore increase accordingly.
487+ // They should be at least half-way through the screen
488+ tryCompareFunction(
489+ function() {return panel.applicationMenus.height >= panel.height * 0.5},
490+ true);
491+
492+ touchRelease(panel, units.gu(1), panel.height);
493+
494+ tryCompare(panel.applicationMenus, "fullyOpened", true)
495+ }
496+
452497 /* Checks that no input reaches items behind the indicator bar.
453498 Ie., the indicator bar should eat all input events that hit it.
454499 */
@@ -457,7 +502,7 @@ PanelTest {
457502 // that it doesn't have a "weak spot" from where taps pass through.
458503 var numTaps = 5;
459504 var stepLength = (panel.width / (numTaps + 1));
460− var tapY = panel.indicators.minimizedPanelHeight / 2;
505+ var tapY = panel.minimizedPanelHeight / 2;
461506 for (var i = 1; i <= numTaps; ++i) {
462507 tap(panel, stepLength * i, tapY);
463508 tryCompare(panel.indicators, "fullyClosed", true);
@@ -469,8 +514,8 @@ PanelTest {
469514 // The center of the area not covered by the indicators menu
470515 // Ie, the visible darkened area behind the menu
471516 var touchPosX = (panel.width - panel.indicators.width) / 2
472− var touchPosY = panel.indicators.minimizedPanelHeight +
473− ((panel.height - panel.indicators.minimizedPanelHeight) / 2)
517+ var touchPosY = panel.minimizedPanelHeight +
518+ ((panel.height - panel.minimizedPanelHeight) / 2)
474519
475520 // input goes through while the indicators menu is closed
476521 tryCompare(panel.indicators, "fullyClosed", true);
@@ -512,8 +557,8 @@ PanelTest {
512557 // The center of the area not covered by the indicators menu
513558 // Ie, the visible darkened area behind the menu
514559 var touchPosX = panel.applicationMenus.width + (panel.width - panel.applicationMenus.width) / 2
515− var touchPosY = panel.applicationMenus.minimizedPanelHeight +
516− ((panel.height - panel.applicationMenus.minimizedPanelHeight) / 2)
560+ var touchPosY = panel.minimizedPanelHeight +
561+ ((panel.height - panel.minimizedPanelHeight) / 2)
517562
518563 // input goes through while the indicators menu is closed
519564 tryCompare(panel.applicationMenus, "fullyClosed", true);
@@ -557,12 +602,12 @@ PanelTest {
557602 panel.
558603 */
559604 function test_tapNearTopEdgeWithPanelInFullscreenMode() {
560− var indicatorArea = findChild(panel, "indicatorArea");
561− verify(indicatorArea);
605+ var panelArea = findChild(panel, "panelArea");
606+ verify(panelArea);
562607
563608 panel.fullscreenMode = true;
564609 // wait until if finishes hiding itself
565− tryCompare(indicatorArea, "y", -panel.minimizedPanelHeight);
610+ tryCompare(panelArea, "y", -panel.minimizedPanelHeight);
566611
567612 compare(panel.indicators.shown, false);
568613 verify(panel.indicators.fullyClosed);
@@ -591,7 +636,7 @@ PanelTest {
591636
592637 mouseClick(panel.indicators,
593638 panel.indicators.width / 2,
594− panel.indicators.minimizedPanelHeight / 2);
639+ panel.minimizedPanelHeight / 2);
595640
596641 compare(panel.indicators.shown, false);
597642 verify(panel.indicators.fullyClosed);
@@ -603,7 +648,7 @@ PanelTest {
603648
604649 mouseClick(panel.indicators,
605650 panel.indicators.width / 2,
606− panel.indicators.minimizedPanelHeight / 2);
651+ panel.minimizedPanelHeight / 2);
607652
608653 compare(panel.indicators.shown, true);
609654 tryCompare(panel.indicators, "fullyOpened", true);