Android: Unblacklist textMargin test from tst_QLineEdit
Older devices may have lower screen resolution. In this case, the hardcoded width may not work as expected. For example, all text may not fit in QLineEdit. This was the reason why the tst_qlineedit::textMargin test failed on some Android devices (especially x86 emulator with Android API 29). When the left and right margins were set to 20, all tested text did not fit in QLineEdit. When we clicked at the beginning of QLineEdit, we clicked on the second character of the text. The cursor was moved to position 1, which caused the test to fail. This commit updates textMargin test to make sure that tested text will fit in to the QLineEdit. Task-number: QTBUG-87417 Fixes: QTQAINFRA-6897 Pick-to: 6.9 6.8 Change-Id: I35352ac1e6f975e72d5c9638f8520f8ddd1d56ae Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
This commit is contained in:
parent
4d31372a86
commit
0a017308cc
@ -1,5 +1,3 @@
|
||||
# QTBUG-87417
|
||||
[textMargin]
|
||||
android
|
||||
[testQuickSelectionWithMouse]
|
||||
android
|
||||
|
@ -3555,8 +3555,10 @@ void tst_QLineEdit::textMargin()
|
||||
// resizing by the window system.
|
||||
QWidget tlw;
|
||||
QLineEdit testWidget(&tlw);
|
||||
testWidget.setGeometry(100, 100, 100, 30);
|
||||
testWidget.setText("MMM MMM MMM");
|
||||
QFontMetrics metrics(testWidget.font());
|
||||
const int minimumWidth = metrics.horizontalAdvance(testWidget.text());
|
||||
testWidget.setGeometry(100, 100, qMax(minimumWidth, 100) , 30);
|
||||
testWidget.setCursorPosition(6);
|
||||
|
||||
QSize sizeHint = testWidget.sizeHint();
|
||||
|
Loading…
x
Reference in New Issue
Block a user