~cherojeong/ubuntu-keyboard/korean-layout

« back to all changes in this revision

Viewing changes to tests/unittests/ut_language-layout-loading/ut_language-layout-loading.cpp

  • Committer: Michael Terry
  • Date: 2013-11-04 17:48:55 UTC
  • mfrom: (96 trunk)
  • mto: This revision was merged to the branch mainline in revision 97.
  • Revision ID: michael.terry@canonical.com-20131104174855-mtmwbdavrq77nl1r
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
277
277
        COMPARE_KEYBOARDS(stringToKeyboard(string_desc), expected_keyboard);
278
278
    }
279
279
 
280
 
    Q_SLOT void testGeneral_data()
281
 
    {
282
 
        QTest::addColumn<QString>("keyboard_id");
283
 
        QTest::addColumn<QString>("expected_keyboard");
284
 
        QTest::addColumn<QString>("expected_shifted_keyboard");
285
 
        QTest::addColumn<QString>("expected_number_keyboard");
286
 
        QTest::addColumn<QString>("expected_phone_number_keyboard");
287
 
        QTest::addColumn<Dictionary>("expected_dead_keyboards");
288
 
        QTest::addColumn<Dictionary>("expected_shifted_dead_keyboards");
289
 
        QTest::addColumn<Dictionary>("expected_extended_keyboards");
290
 
        QTest::addColumn<QStringList>("expected_symbols_keyboards");
291
 
 
292
 
        Dictionary dead;
293
 
        Dictionary sdead;
294
 
        Dictionary ext;
295
 
 
296
 
        QTest::newRow("General test")
297
 
            << "general_test1"
298
 
            << "|q|w|\n p a "
299
 
            << "|Q|W|\n p a "
300
 
            << "|0|1|\n 2 3 "
301
 
            << " 9 8 \n 7|6 "
302
 
            << (dead
303
 
                << DictionaryValue(QString::fromUtf8("Ā“"), "|q|e|\n p a ")
304
 
                << DictionaryValue(";", "|q|r|\n p a ")
305
 
                << DictionaryValue("'", "|q|t|\n p a "))
306
 
            << (sdead
307
 
                << DictionaryValue(QString::fromUtf8("Ā“"), "|Q|E|\n p a ")
308
 
                << DictionaryValue(";", "|Q|r|\n p a ")
309
 
                << DictionaryValue("'", "|Q|T|\n p a "))
310
 
            << (ext
311
 
                << DictionaryValue("q", "|y|u|\n|i|o|")
312
 
                << DictionaryValue("Q", "|Y|U|\n|I|O|"))
313
 
            << (QStringList()
314
 
                << "|1|\n|2|"
315
 
                << "|3|\n|4|");
316
 
        dead.clear();
317
 
        sdead.clear();
318
 
        ext.clear();
319
 
    }
320
 
 
321
 
    Q_SLOT void testGeneral()
322
 
    {
323
 
        QFETCH(QString, keyboard_id);
324
 
        QFETCH(QString, expected_keyboard);
325
 
        QFETCH(QString, expected_shifted_keyboard);
326
 
        QFETCH(QString, expected_number_keyboard);
327
 
        QFETCH(QString, expected_phone_number_keyboard);
328
 
        QFETCH(Dictionary, expected_dead_keyboards);
329
 
        QFETCH(Dictionary, expected_shifted_dead_keyboards);
330
 
        QFETCH(Dictionary, expected_extended_keyboards);
331
 
        QFETCH(QStringList, expected_symbols_keyboards);
332
 
 
333
 
        SharedKeyboardLoader loader(getLoader(keyboard_id));
334
 
 
335
 
        QVERIFY(loader->ids().indexOf(keyboard_id) != -1);
336
 
        qDebug() << "Keyboard";
337
 
        COMPARE_KEYBOARDS(loader->keyboard(), stringToKeyboard(expected_keyboard));
338
 
        qDebug() << "Shifted eyboard";
339
 
        COMPARE_KEYBOARDS(loader->shiftedKeyboard(), stringToKeyboard(expected_shifted_keyboard));
340
 
        qDebug() << "Number keyboard";
341
 
        COMPARE_KEYBOARDS(loader->numberKeyboard(), stringToKeyboard(expected_number_keyboard));
342
 
        qDebug() << "Phonenumber keyboard";
343
 
        COMPARE_KEYBOARDS(loader->phoneNumberKeyboard(), stringToKeyboard(expected_phone_number_keyboard));
344
 
 
345
 
        Q_FOREACH(const QString &dead_text, expected_dead_keyboards.keys()) {
346
 
            Key dead_key;
347
 
            Label dead_label;
348
 
 
349
 
            dead_label.setText(dead_text);
350
 
            dead_key.setLabel(dead_label);
351
 
            qDebug() << "Dead keyboard for:" << dead_text;
352
 
            COMPARE_KEYBOARDS(loader->deadKeyboard(dead_key), stringToKeyboard(expected_dead_keyboards[dead_text]));
353
 
        }
354
 
 
355
 
        Q_FOREACH(const QString &dead_text, expected_shifted_dead_keyboards.keys()) {
356
 
            Key dead_key;
357
 
            Label dead_label;
358
 
 
359
 
            dead_label.setText(dead_text);
360
 
            dead_key.setLabel(dead_label);
361
 
            qDebug() << "Shifted dead keyboard for:" << dead_text;
362
 
            COMPARE_KEYBOARDS(loader->shiftedDeadKeyboard(dead_key), stringToKeyboard(expected_shifted_dead_keyboards[dead_text]));
363
 
        }
364
 
 
365
 
        for (int iter(0); iter <= expected_symbols_keyboards.size(); ++iter) {
366
 
            int index(iter % expected_symbols_keyboards.size());
367
 
 
368
 
            qDebug() << "Symbols keyboard, page:" << iter << "(expected page:" << index << ")";
369
 
            COMPARE_KEYBOARDS(loader->symbolsKeyboard(iter), stringToKeyboard(expected_symbols_keyboards[index]));
370
 
        }
371
 
    }
372
 
 
373
 
    Q_SLOT void testStyle_data()
374
 
    {
375
 
        QTest::addColumn<QString>("keyboard_id");
376
 
        QTest::addColumn<QString>("expected_style");
377
 
 
378
 
        QTest::newRow("No style given in xml")
379
 
            << "style_test1"
380
 
            << "keys4";
381
 
 
382
 
        QTest::newRow("Style given in xml")
383
 
            << "style_test2"
384
 
            << "four_symbols";
385
 
    }
386
 
 
387
 
    Q_SLOT void testStyle()
388
 
    {
389
 
        QFETCH(QString, keyboard_id);
390
 
        QFETCH(QString, expected_style);
391
 
 
392
 
        SharedKeyboardLoader loader(getLoader(keyboard_id));
393
 
        QCOMPARE(loader->keyboard().style_name, expected_style);
394
 
    }
395
 
 
396
 
    Q_SLOT void testAction_data()
397
 
    {
398
 
        QTest::addColumn<QString>("keyboard_id");
399
 
        QTest::addColumn<Keyboard>("expected_keyboard");
400
 
 
401
 
        Keyboard kb;
402
 
 
403
 
        QTest::newRow("Implicit insert action")
404
 
            << "action_test1"
405
 
            << (kb
406
 
                << createActionPair());
407
 
        clearKeyboard(kb);
408
 
 
409
 
        QTest::newRow("Explicit actions")
410
 
            << "action_test2"
411
 
            << (kb
412
 
                << createActionPair()
413
 
                << createActionPair(Key::ActionShift)
414
 
                << createActionPair(Key::ActionBackspace)
415
 
                << createActionPair(Key::ActionReturn));
416
 
        clearKeyboard(kb);
417
 
 
418
 
        QTest::newRow("Dead action")
419
 
            << "action_test3"
420
 
            << (kb
421
 
                << createActionPair(Key::ActionDead));
422
 
        clearKeyboard(kb);
423
 
    }
424
 
 
425
 
    Q_SLOT void testAction()
426
 
    {
427
 
        QFETCH(QString, keyboard_id);
428
 
        QFETCH(Keyboard, expected_keyboard);
429
 
 
430
 
        SharedKeyboardLoader loader(getLoader(keyboard_id));
431
 
        Keyboard gotten_keyboard(loader->keyboard());
432
 
 
433
 
        QCOMPARE(gotten_keyboard.keys.size(), expected_keyboard.keys.size());
434
 
 
435
 
        for (int iter(0); iter < expected_keyboard.keys.size(); ++iter) {
436
 
            const Key &gotten_key(gotten_keyboard.keys[iter]);
437
 
            const Key &expected_key(expected_keyboard.keys[iter]);
438
 
 
439
 
            QCOMPARE(gotten_key.action(), expected_key.action());
440
 
        }
441
 
    }
442
 
 
443
 
    Q_SLOT void testIcon_data()
444
 
    {
445
 
        QTest::addColumn<QString>("keyboard_id");
446
 
        QTest::addColumn<Keyboard>("expected_keyboard");
447
 
 
448
 
        Keyboard kb;
449
 
        QTest::newRow("Default icons")
450
 
            << "icon_test1"
451
 
            << (kb
452
 
                << createActionPair(Key::ActionBackspace, KeyDescription::BackspaceIcon)
453
 
                << createActionPair(Key::ActionReturn, KeyDescription::ReturnIcon)
454
 
                << createActionPair(Key::ActionShift, KeyDescription::ShiftIcon)
455
 
                << createActionPair(Key::ActionClose, KeyDescription::CloseIcon));
456
 
        clearKeyboard(kb);
457
 
 
458
 
        QTest::newRow("Custom or empty icons")
459
 
            << "icon_test2"
460
 
            << (kb
461
 
                << createActionPair()
462
 
                << createActionPair(Key::ActionInsert, KeyDescription::CustomIcon, "overriden_icon"));
463
 
        clearKeyboard(kb);
464
 
 
465
 
        /* TODO: Commented out for now, as it is not not possible to override
466
 
           icons for some action keys and I don't know if we want to allow
467
 
           this. I would say that we indeed do want.
468
 
 
469
 
        QTest::newRow("Overriden icons")
470
 
            << "icon_test3"
471
 
            << (kb
472
 
                << actionPair(Key::ActionClose, KeyDescription::CustomIcon, "overriden_icon"));
473
 
        clearKeyboard(kb);
474
 
        */
475
 
    }
476
 
 
477
 
    Q_SLOT void testIcon()
478
 
    {
479
 
        QFETCH(QString, keyboard_id);
480
 
        QFETCH(Keyboard, expected_keyboard);
481
 
 
482
 
        SharedKeyboardLoader loader(getLoader(keyboard_id));
483
 
        Keyboard gotten_keyboard(loader->keyboard());
484
 
 
485
 
        QCOMPARE(gotten_keyboard.keys.size(), expected_keyboard.keys.size());
486
 
 
487
 
        for (int iter(0); iter < expected_keyboard.keys.size(); ++iter) {
488
 
            const Key& gotten_key(gotten_keyboard.keys[iter]);
489
 
            const Key& expected_key(expected_keyboard.keys[iter]);
490
 
            const KeyDescription& gotten_desc(gotten_keyboard.key_descriptions[iter]);
491
 
            const KeyDescription& expected_desc(expected_keyboard.key_descriptions[iter]);
492
 
 
493
 
            QCOMPARE(gotten_key.action(), expected_key.action());
494
 
            QCOMPARE(gotten_desc.icon, expected_desc.icon);
495
 
            QCOMPARE(gotten_key.icon(), expected_key.icon());
496
 
        }
497
 
    }
 
280
//    Q_SLOT void testGeneral_data()
 
281
//    {
 
282
//        QTest::addColumn<QString>("keyboard_id");
 
283
//        QTest::addColumn<QString>("expected_keyboard");
 
284
//        QTest::addColumn<QString>("expected_shifted_keyboard");
 
285
//        QTest::addColumn<QString>("expected_number_keyboard");
 
286
//        QTest::addColumn<QString>("expected_phone_number_keyboard");
 
287
//        QTest::addColumn<Dictionary>("expected_dead_keyboards");
 
288
//        QTest::addColumn<Dictionary>("expected_shifted_dead_keyboards");
 
289
//        QTest::addColumn<Dictionary>("expected_extended_keyboards");
 
290
//        QTest::addColumn<QStringList>("expected_symbols_keyboards");
 
291
 
 
292
//        Dictionary dead;
 
293
//        Dictionary sdead;
 
294
//        Dictionary ext;
 
295
 
 
296
//        QTest::newRow("General test")
 
297
//            << "general_test1"
 
298
//            << "|q|w|\n p a "
 
299
//            << "|Q|W|\n p a "
 
300
//            << "|0|1|\n 2 3 "
 
301
//            << " 9 8 \n 7|6 "
 
302
//            << (dead
 
303
//                << DictionaryValue(QString::fromUtf8("Ā“"), "|q|e|\n p a ")
 
304
//                << DictionaryValue(";", "|q|r|\n p a ")
 
305
//                << DictionaryValue("'", "|q|t|\n p a "))
 
306
//            << (sdead
 
307
//                << DictionaryValue(QString::fromUtf8("Ā“"), "|Q|E|\n p a ")
 
308
//                << DictionaryValue(";", "|Q|r|\n p a ")
 
309
//                << DictionaryValue("'", "|Q|T|\n p a "))
 
310
//            << (ext
 
311
//                << DictionaryValue("q", "|y|u|\n|i|o|")
 
312
//                << DictionaryValue("Q", "|Y|U|\n|I|O|"))
 
313
//            << (QStringList()
 
314
//                << "|1|\n|2|"
 
315
//                << "|3|\n|4|");
 
316
//        dead.clear();
 
317
//        sdead.clear();
 
318
//        ext.clear();
 
319
//    }
 
320
 
 
321
//    Q_SLOT void testGeneral()
 
322
//    {
 
323
//        QFETCH(QString, keyboard_id);
 
324
//        QFETCH(QString, expected_keyboard);
 
325
//        QFETCH(QString, expected_shifted_keyboard);
 
326
//        QFETCH(QString, expected_number_keyboard);
 
327
//        QFETCH(QString, expected_phone_number_keyboard);
 
328
//        QFETCH(Dictionary, expected_dead_keyboards);
 
329
//        QFETCH(Dictionary, expected_shifted_dead_keyboards);
 
330
//        QFETCH(Dictionary, expected_extended_keyboards);
 
331
//        QFETCH(QStringList, expected_symbols_keyboards);
 
332
 
 
333
//        SharedKeyboardLoader loader(getLoader(keyboard_id));
 
334
 
 
335
//        QVERIFY(loader->ids().indexOf(keyboard_id) != -1);
 
336
//        qDebug() << "Keyboard";
 
337
//        COMPARE_KEYBOARDS(loader->keyboard(), stringToKeyboard(expected_keyboard));
 
338
//        qDebug() << "Shifted eyboard";
 
339
//        COMPARE_KEYBOARDS(loader->shiftedKeyboard(), stringToKeyboard(expected_shifted_keyboard));
 
340
//        qDebug() << "Number keyboard";
 
341
//        COMPARE_KEYBOARDS(loader->numberKeyboard(), stringToKeyboard(expected_number_keyboard));
 
342
//        qDebug() << "Phonenumber keyboard";
 
343
//        COMPARE_KEYBOARDS(loader->phoneNumberKeyboard(), stringToKeyboard(expected_phone_number_keyboard));
 
344
 
 
345
//        Q_FOREACH(const QString &dead_text, expected_dead_keyboards.keys()) {
 
346
//            Key dead_key;
 
347
//            Label dead_label;
 
348
 
 
349
//            dead_label.setText(dead_text);
 
350
//            dead_key.setLabel(dead_label);
 
351
//            qDebug() << "Dead keyboard for:" << dead_text;
 
352
//            COMPARE_KEYBOARDS(loader->deadKeyboard(dead_key), stringToKeyboard(expected_dead_keyboards[dead_text]));
 
353
//        }
 
354
 
 
355
//        Q_FOREACH(const QString &dead_text, expected_shifted_dead_keyboards.keys()) {
 
356
//            Key dead_key;
 
357
//            Label dead_label;
 
358
 
 
359
//            dead_label.setText(dead_text);
 
360
//            dead_key.setLabel(dead_label);
 
361
//            qDebug() << "Shifted dead keyboard for:" << dead_text;
 
362
//            COMPARE_KEYBOARDS(loader->shiftedDeadKeyboard(dead_key), stringToKeyboard(expected_shifted_dead_keyboards[dead_text]));
 
363
//        }
 
364
 
 
365
//        for (int iter(0); iter <= expected_symbols_keyboards.size(); ++iter) {
 
366
//            int index(iter % expected_symbols_keyboards.size());
 
367
 
 
368
//            qDebug() << "Symbols keyboard, page:" << iter << "(expected page:" << index << ")";
 
369
//            COMPARE_KEYBOARDS(loader->symbolsKeyboard(iter), stringToKeyboard(expected_symbols_keyboards[index]));
 
370
//        }
 
371
//    }
 
372
 
 
373
//    Q_SLOT void testStyle_data()
 
374
//    {
 
375
//        QTest::addColumn<QString>("keyboard_id");
 
376
//        QTest::addColumn<QString>("expected_style");
 
377
 
 
378
//        QTest::newRow("No style given in xml")
 
379
//            << "style_test1"
 
380
//            << "keys4";
 
381
 
 
382
//        QTest::newRow("Style given in xml")
 
383
//            << "style_test2"
 
384
//            << "four_symbols";
 
385
//    }
 
386
 
 
387
//    Q_SLOT void testStyle()
 
388
//    {
 
389
//        QFETCH(QString, keyboard_id);
 
390
//        QFETCH(QString, expected_style);
 
391
 
 
392
//        SharedKeyboardLoader loader(getLoader(keyboard_id));
 
393
//        QCOMPARE(loader->keyboard().style_name, expected_style);
 
394
//    }
 
395
 
 
396
//    Q_SLOT void testAction_data()
 
397
//    {
 
398
//        QTest::addColumn<QString>("keyboard_id");
 
399
//        QTest::addColumn<Keyboard>("expected_keyboard");
 
400
 
 
401
//        Keyboard kb;
 
402
 
 
403
//        QTest::newRow("Implicit insert action")
 
404
//            << "action_test1"
 
405
//            << (kb
 
406
//                << createActionPair());
 
407
//        clearKeyboard(kb);
 
408
 
 
409
//        QTest::newRow("Explicit actions")
 
410
//            << "action_test2"
 
411
//            << (kb
 
412
//                << createActionPair()
 
413
//                << createActionPair(Key::ActionShift)
 
414
//                << createActionPair(Key::ActionBackspace)
 
415
//                << createActionPair(Key::ActionReturn));
 
416
//        clearKeyboard(kb);
 
417
 
 
418
//        QTest::newRow("Dead action")
 
419
//            << "action_test3"
 
420
//            << (kb
 
421
//                << createActionPair(Key::ActionDead));
 
422
//        clearKeyboard(kb);
 
423
//    }
 
424
 
 
425
//    Q_SLOT void testAction()
 
426
//    {
 
427
//        QFETCH(QString, keyboard_id);
 
428
//        QFETCH(Keyboard, expected_keyboard);
 
429
 
 
430
//        SharedKeyboardLoader loader(getLoader(keyboard_id));
 
431
//        Keyboard gotten_keyboard(loader->keyboard());
 
432
 
 
433
//        QCOMPARE(gotten_keyboard.keys.size(), expected_keyboard.keys.size());
 
434
 
 
435
//        for (int iter(0); iter < expected_keyboard.keys.size(); ++iter) {
 
436
//            const Key &gotten_key(gotten_keyboard.keys[iter]);
 
437
//            const Key &expected_key(expected_keyboard.keys[iter]);
 
438
 
 
439
//            QCOMPARE(gotten_key.action(), expected_key.action());
 
440
//        }
 
441
//    }
 
442
 
 
443
//    Q_SLOT void testIcon_data()
 
444
//    {
 
445
//        QTest::addColumn<QString>("keyboard_id");
 
446
//        QTest::addColumn<Keyboard>("expected_keyboard");
 
447
 
 
448
//        Keyboard kb;
 
449
//        QTest::newRow("Default icons")
 
450
//            << "icon_test1"
 
451
//            << (kb
 
452
//                << createActionPair(Key::ActionBackspace, KeyDescription::BackspaceIcon)
 
453
//                << createActionPair(Key::ActionReturn, KeyDescription::ReturnIcon)
 
454
//                << createActionPair(Key::ActionShift, KeyDescription::ShiftIcon)
 
455
//                << createActionPair(Key::ActionClose, KeyDescription::CloseIcon));
 
456
//        clearKeyboard(kb);
 
457
 
 
458
//        QTest::newRow("Custom or empty icons")
 
459
//            << "icon_test2"
 
460
//            << (kb
 
461
//                << createActionPair()
 
462
//                << createActionPair(Key::ActionInsert, KeyDescription::CustomIcon, "overriden_icon"));
 
463
//        clearKeyboard(kb);
 
464
 
 
465
//        /* TODO: Commented out for now, as it is not not possible to override
 
466
//           icons for some action keys and I don't know if we want to allow
 
467
//           this. I would say that we indeed do want.
 
468
 
 
469
//        QTest::newRow("Overriden icons")
 
470
//            << "icon_test3"
 
471
//            << (kb
 
472
//                << actionPair(Key::ActionClose, KeyDescription::CustomIcon, "overriden_icon"));
 
473
//        clearKeyboard(kb);
 
474
//        */
 
475
//    }
 
476
 
 
477
//    Q_SLOT void testIcon()
 
478
//    {
 
479
//        QFETCH(QString, keyboard_id);
 
480
//        QFETCH(Keyboard, expected_keyboard);
 
481
 
 
482
//        SharedKeyboardLoader loader(getLoader(keyboard_id));
 
483
//        Keyboard gotten_keyboard(loader->keyboard());
 
484
 
 
485
//        QCOMPARE(gotten_keyboard.keys.size(), expected_keyboard.keys.size());
 
486
 
 
487
//        for (int iter(0); iter < expected_keyboard.keys.size(); ++iter) {
 
488
//            const Key& gotten_key(gotten_keyboard.keys[iter]);
 
489
//            const Key& expected_key(expected_keyboard.keys[iter]);
 
490
//            const KeyDescription& gotten_desc(gotten_keyboard.key_descriptions[iter]);
 
491
//            const KeyDescription& expected_desc(expected_keyboard.key_descriptions[iter]);
 
492
 
 
493
//            QCOMPARE(gotten_key.action(), expected_key.action());
 
494
//            QCOMPARE(gotten_desc.icon, expected_desc.icon);
 
495
//            QCOMPARE(gotten_key.icon(), expected_key.icon());
 
496
//        }
 
497
//    }
498
498
 
499
499
    Q_SLOT void testExtended_data()
500
500
    {
511
511
            << "|a|b|c|";
512
512
        */
513
513
 
514
 
        QTest::newRow("Extended keyboard for shifted key (also notice prepending)")
515
 
            << "extended_test"
516
 
            << getKey("A")
517
 
            << "|A|B|C|";
518
 
 
519
 
        QTest::newRow("Ignore spacers in extended keyboard")
520
 
            << "extended_test"
521
 
            << getKey("d")
522
 
            << "|d|e|f|";
523
 
 
524
 
        QTest::newRow("Extended keyboard with multiple rows (also notice lack of prepending)")
525
 
            << "extended_test"
526
 
            << getKey("g")
527
 
            << "|h|i|\n|j|k|";
528
 
 
529
 
        QTest::newRow("Extended keyboard for empty label (also notice lack of prepending the key with empty label)")
530
 
            << "extended_test"
531
 
            << getKey("")
532
 
            << "|x|";
 
514
//        QTest::newRow("Extended keyboard for shifted key (also notice prepending)")
 
515
//            << "extended_test"
 
516
//            << getKey("A")
 
517
//            << "|A|B|C|";
 
518
 
 
519
//        QTest::newRow("Ignore spacers in extended keyboard")
 
520
//            << "extended_test"
 
521
//            << getKey("d")
 
522
//            << "|d|e|f|";
 
523
 
 
524
//        QTest::newRow("Extended keyboard with multiple rows (also notice lack of prepending)")
 
525
//            << "extended_test"
 
526
//            << getKey("g")
 
527
//            << "|h|i|\n|j|k|";
 
528
 
 
529
//        QTest::newRow("Extended keyboard for empty label (also notice lack of prepending the key with empty label)")
 
530
//            << "extended_test"
 
531
//            << getKey("")
 
532
//            << "|x|";
533
533
 
534
534
        QTest::newRow("No extended keyboard for spacebars.")
535
535
            << "extended_test"
536
536
            << getKey("", Key::ActionSpace)
537
537
            << "";
538
538
 
539
 
        QTest::newRow("No non-action-insert prepending")
540
 
            << "extended_test"
541
 
            << getKey("close", Key::ActionClose)
542
 
            << "|X|";
 
539
//        QTest::newRow("No non-action-insert prepending")
 
540
//            << "extended_test"
 
541
//            << getKey("close", Key::ActionClose)
 
542
//            << "|X|";
543
543
    }
544
544
 
545
545
    Q_SLOT void testExtended()
580
580
        QCOMPARE(style.directory(Style::Sounds), test_profile_dir + "/sounds");
581
581
    }
582
582
 
583
 
    void disabled_testKeyGeometryStyling_data()
584
 
    {
585
 
        QTest::addColumn<int>("key_index");
586
 
        QTest::addColumn<QString>("expected_label");
587
 
        QTest::addColumn<int>("expected_left_distance");
588
 
        QTest::addColumn<int>("expected_right_distance");
589
 
        QTest::addColumn<int>("expected_left_edge");
590
 
        QTest::addColumn<int>("expected_right_edge");
591
 
 
592
 
        QTest::newRow("1st row: ' a|b ', testing geometry of 'a'.")
593
 
            << 0 << QString("a") << 25 << 5 << 0 << 50;
594
 
 
595
 
        QTest::newRow("1st row: ' a|b ', testing geometry of 'b'.")
596
 
            << 1 << QString("b") << 5 << 25 << 50 << 100;
597
 
    }
598
 
 
599
 
    void disabled_testKeyGeometryStyling()
600
 
    {
601
 
        QFETCH(int, key_index);
602
 
        QFETCH(QString, expected_label);
603
 
        QFETCH(int, expected_left_distance);
604
 
        QFETCH(int, expected_right_distance);
605
 
        QFETCH(int, expected_left_edge);
606
 
        QFETCH(int, expected_right_edge);
607
 
 
608
 
        Style style;
609
 
        style.setProfile("test-profile");
610
 
        StyleAttributes *attributes = style.attributes();
611
 
        SharedKeyboardLoader loader(getLoader("styling_profile_test"));
612
 
        Logic::KeyAreaConverter converter(attributes, loader.data());
613
 
 
614
 
        const KeyArea key_area(converter.keyArea());
615
 
        const Key key(key_area.keys().at(key_index));
616
 
 
617
 
        QCOMPARE(key.label().text(), expected_label);
618
 
        QCOMPARE(key.margins().left(), expected_left_distance);
619
 
        QCOMPARE(key.margins().right(), expected_right_distance);
620
 
        QCOMPARE(key.rect().x(), expected_left_edge);
621
 
        QCOMPARE(key.rect().x() + key.rect().width(), expected_right_edge);
622
 
    }
 
583
//    Q_SLOT void testKeyGeometryStyling_data()
 
584
//    {
 
585
//        QTest::addColumn<int>("key_index");
 
586
//        QTest::addColumn<QString>("expected_label");
 
587
//        QTest::addColumn<int>("expected_left_distance");
 
588
//        QTest::addColumn<int>("expected_right_distance");
 
589
//        QTest::addColumn<int>("expected_left_edge");
 
590
//        QTest::addColumn<int>("expected_right_edge");
 
591
 
 
592
//        QTest::newRow("1st row: ' a|b ', testing geometry of 'a'.")
 
593
//            << 0 << QString("a") << 25 << 5 << 0 << 50;
 
594
 
 
595
//        QTest::newRow("1st row: ' a|b ', testing geometry of 'b'.")
 
596
//            << 1 << QString("b") << 5 << 25 << 50 << 100;
 
597
//    }
 
598
 
 
599
//    Q_SLOT void testKeyGeometryStyling()
 
600
//    {
 
601
//        QFETCH(int, key_index);
 
602
//        QFETCH(QString, expected_label);
 
603
//        QFETCH(int, expected_left_distance);
 
604
//        QFETCH(int, expected_right_distance);
 
605
//        QFETCH(int, expected_left_edge);
 
606
//        QFETCH(int, expected_right_edge);
 
607
 
 
608
//        Style style;
 
609
//        style.setProfile("test-profile");
 
610
//        StyleAttributes *attributes = style.attributes();
 
611
//        SharedKeyboardLoader loader(getLoader("styling_profile_test"));
 
612
//        Logic::KeyAreaConverter converter(attributes, loader.data());
 
613
 
 
614
//        const KeyArea key_area(converter.keyArea());
 
615
//        const Key key(key_area.keys().at(key_index));
 
616
 
 
617
//        QCOMPARE(key.label().text(), expected_label);
 
618
//        QCOMPARE(key.margins().left(), expected_left_distance);
 
619
//        QCOMPARE(key.margins().right(), expected_right_distance);
 
620
//        QCOMPARE(key.rect().x(), expected_left_edge);
 
621
//        QCOMPARE(key.rect().x() + key.rect().width(), expected_right_edge);
 
622
//    }
623
623
};
624
624
 
625
625
QTEST_MAIN(TestLanguageLayoutLoading)
626
 
#include "main.moc"
 
626
#include "ut_language-layout-loading.moc"