~ubuntu-sdk-team/ubuntu-ui-toolkit/trunk

« back to all changes in this revision

Viewing changes to tests/unit/tst_components/tst_textarea.qml

  • Committer: Tarmac
  • Author(s): Zsombor Egri
  • Date: 2013-04-17 19:56:40 UTC
  • mfrom: (423.1.5 textarea-focus)
  • Revision ID: tarmac-20130417195640-oeg7bkbgieppa8cj
Workaround for TextArea and TextField removing OSK when active focus is transferred from one instance to another using focus property. . Fixes: https://bugs.launchpad.net/bugs/1163371.

Approved by PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
        }
59
59
    }
60
60
 
 
61
    Item {
 
62
        TextArea {
 
63
            id: t1
 
64
            objectName: "t1"
 
65
        }
 
66
        TextArea {
 
67
            id: t2
 
68
            objectName: "t2"
 
69
        }
 
70
    }
 
71
 
61
72
    TestCase {
62
73
        name: "TextAreaAPI"
63
74
        when: windowShown
380
391
            tryCompare(listItemSpy, "count", 0, 100);
381
392
        }
382
393
 
 
394
        function test_OneActiveFocus() {
 
395
            t1.focus = true;
 
396
            compare(t1.activeFocus, true, "T1 has activeFocus");
 
397
            compare(t2.activeFocus, false, "T1 has activeFocus");
 
398
            t2.focus = true;
 
399
            compare(t1.activeFocus, false, "T1 has activeFocus");
 
400
            compare(t2.activeFocus, true, "T1 has activeFocus");
 
401
        }
 
402
 
 
403
        function test_OSK_ShownWhenNextTextAreaIsFocused() {
 
404
            // detect whether we have OSK support
 
405
            Qt.inputMethod.show();
 
406
            if (!Qt.inputMethod.visible)
 
407
                expectFail("", "OSK can be tested only when present");
 
408
            else
 
409
                Qt.inputMethod.hide();
 
410
            t1.focus = true;
 
411
            compare(Qt.inputMethod.visible, true, "OSK is shown for the first TextArea");
 
412
            t2.focus = true;
 
413
            compare(Qt.inputMethod.visible, true, "OSK is shown for the second TextArea");
 
414
        }
 
415
 
 
416
        function test_RemoveOSKWhenFocusLost() {
 
417
            // detect whether we have OSK support
 
418
            Qt.inputMethod.show();
 
419
            if (!Qt.inputMethod.visible)
 
420
                expectFail("", "OSK can be tested only when present");
 
421
            else
 
422
                Qt.inputMethod.hide();
 
423
            t1.focus = true;
 
424
            compare(Qt.inputMethod.visible, true, "OSK is shown when TextArea gains focus");
 
425
            t1.focus = false;
 
426
            compare(Qt.inputMethod.visible, false, "OSK is hidden when TextArea looses focus");
 
427
        }
 
428
 
383
429
        // make it to b ethe last test case executed
384
430
        function test_zz_TextareaInListItem_RichTextEnterCaptured() {
385
431
            textArea.text = "a<br />b";