equal
deleted
inserted
replaced
116 void setNumColumnsWordWrap(); |
116 void setNumColumnsWordWrap(); |
117 void smallTextLengthNoWrap(); |
117 void smallTextLengthNoWrap(); |
118 void smallTextLengthWordWrap(); |
118 void smallTextLengthWordWrap(); |
119 void smallTextLengthWrapAtWordBoundaryOrAnywhere(); |
119 void smallTextLengthWrapAtWordBoundaryOrAnywhere(); |
120 void testLineBreakingAllSpaces(); |
120 void testLineBreakingAllSpaces(); |
|
121 void lineWidthFromBOM(); |
121 |
122 |
122 |
123 |
123 private: |
124 private: |
124 QFont testFont; |
125 QFont testFont; |
125 }; |
126 }; |
1112 QTextLayout layout("text1\ttext2\ttext3\tend", testFont, &pd); |
1113 QTextLayout layout("text1\ttext2\ttext3\tend", testFont, &pd); |
1113 |
1114 |
1114 QTextOption option = layout.textOption(); |
1115 QTextOption option = layout.textOption(); |
1115 QList<QTextOption::Tab> tabs; |
1116 QList<QTextOption::Tab> tabs; |
1116 QTextOption::Tab tab; |
1117 QTextOption::Tab tab; |
1117 tab.position = 200; |
1118 tab.position = 300; |
1118 tabs.append(tab); |
1119 tabs.append(tab); |
1119 |
1120 |
1120 tab.position = 400; |
1121 tab.position = 600; |
1121 tab.type = QTextOption::RightTab; |
1122 tab.type = QTextOption::RightTab; |
1122 tabs.append(tab); |
1123 tabs.append(tab); |
1123 |
1124 |
1124 tab.position = 600; |
1125 tab.position = 800; |
1125 tab.type = QTextOption::CenterTab; |
1126 tab.type = QTextOption::CenterTab; |
1126 tabs.append(tab); |
1127 tabs.append(tab); |
1127 option.setTabs(tabs); |
1128 option.setTabs(tabs); |
1128 layout.setTextOption(option); |
1129 layout.setTextOption(option); |
1129 |
1130 |
1304 textLayout.endLayout(); |
1305 textLayout.endLayout(); |
1305 } |
1306 } |
1306 |
1307 |
1307 } |
1308 } |
1308 |
1309 |
|
1310 void tst_QTextLayout::lineWidthFromBOM() |
|
1311 { |
|
1312 const QString string(QChar(0xfeff)); // BYTE ORDER MARK |
|
1313 QTextLayout layout(string); |
|
1314 layout.beginLayout(); |
|
1315 QTextLine line = layout.createLine(); |
|
1316 line.setLineWidth(INT_MAX / 256); |
|
1317 layout.endLayout(); |
|
1318 |
|
1319 // Don't spin into an infinite loop |
|
1320 } |
|
1321 |
1309 |
1322 |
1310 QTEST_MAIN(tst_QTextLayout) |
1323 QTEST_MAIN(tst_QTextLayout) |
1311 #include "tst_qtextlayout.moc" |
1324 #include "tst_qtextlayout.moc" |