~zsombi/ubuntu-ui-toolkit/dialogFacelift

« back to all changes in this revision

Viewing changes to tests/unit_x11/tst_components/tst_textinput_common.qml

  • Committer: Tarmac
  • Author(s): Christian Dywan
  • Date: 2015-11-25 16:59:41 UTC
  • mfrom: (1724.2.1 uut.monologs)
  • Revision ID: tarmac-20151125165941-z2pyfn43jj1celwy
Explicitly handle keyboard anchoring in dialog foreground. Fixes: https://bugs.launchpad.net/bugs/1376763.

Approved by PS Jenkins bot, Zsombor Egri.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
Item {
24
24
    id: testMain
25
25
    width: units.gu(40)
26
 
    height: units.gu(71)
 
26
    height: units.gu(50)
27
27
 
28
28
    Component {
29
29
        id: popoverComponent
445
445
                verify(popoverY >= 0, 'Popover went off-screen: %1'.arg(popoverY));
446
446
        }
447
447
 
 
448
        function test_osk_shrinks_dialog() {
 
449
            var popover = PopupUtils.open(dialogComponent, dialogButton);
 
450
            waitForRendering(popover);
 
451
            // Original height before showing OSK
 
452
            var originalHeight = popover.height;
 
453
            // Subtract OSK
 
454
            var expectedHeight = originalHeight - UbuntuApplication.inputMethod.keyboardRectangle.height;
 
455
            popover.textField.forceActiveFocus();
 
456
            waitForRendering(popover.textField);
 
457
            // Only get the value here so in case of failure the popover won't get stuck
 
458
            var foreground = findChild(popover, "dialogForeground")
 
459
            var availableHeight = foreground.height;
 
460
 
 
461
            // dismiss popover
 
462
            PopupUtils.close(popover);
 
463
            // add some timeout to get the event buffer cleaned
 
464
            wait(500);
 
465
 
 
466
            verify(availableHeight <= expectedHeight, 'Dialog did not shrink (%1 > %2)'.arg(availableHeight).arg(expectedHeight));
 
467
        }
 
468
 
448
469
    }
449
470
}