summaryrefslogtreecommitdiffstats
path: root/tests/auto/qstatictext
Commit message (Collapse)AuthorAgeFilesLines
* Fix crash when using unprintable chars in QStaticTextEskil Abrahamsen Blomfeldt2010-09-101-0/+11
| | | | | | | | | The assumption that the output glyph array and input glyph array is of equal size is wrong when unprintable characters are used (and discarded in getGlyphPositions()) Task-number: QTBUG-12614 Reviewed-by: Jiang Jiang
* Fix QStaticText copy constructor to also copy text option propertyEskil Abrahamsen Blomfeldt2010-09-031-0/+27
| | | | | | | | | The text option property of QStaticText was not copied in the copy constructor, so when the text was detached, the property would be reset to the default. Task-number: QTBUG-13368 Reviewed-by: Gunnar
* Add text decoration support to QStaticTextJiang Jiang2010-08-101-0/+106
| | | | | | | | | | | | The original code path of QStaticText does not include decoration drawing, this patch generalized the drawTextItemDecoration() function to draw decoration for drawText(), then use that to draw decoration for QStaticText. A helper function called drawDecorationForGlyphs() is made to allow easier extension for direct glyphs drawing support. Task-number: QTBUG-12121 Reviewed-by: Eskil
* Speed up QStaticText with affine transformation on GL2 engineEskil Abrahamsen Blomfeldt2010-06-011-4/+3
| | | | | | | | | | | | | | | | | | | | Since the OpenGL2 paint engine supports transforming the prerendered glyphs rather than rasterizing the glyphs with the transformation applied, we don't need to recalculate the QStaticText layout whenever the transformation changes. This means that we can do fast animated transforms for QStaticText on this paint engine. A quick test yields something like 100x speed-up on Windows. This also give visually better results, as we previously would animate the hinting of the glyphs, thus causing jittering. The autotest has been updated to reflect the fact that drawText() and drawStaticText() now go through identical paths on GL, also when transforms are set on the painter. However, the scale was changed in one test, because it was so great that drawText() would fall back to paths. With QStaticText the idea is speed, so you'll get a poor, but fast result instead, which is better than tricking people. Reviewed-by: Samuel
* Fix QStaticText test on MacEskil Abrahamsen Blomfeldt2010-03-301-5/+5
| | | | | | | | | | Avoid taking fast path in drawText() since this is optimized and does not draw text completely accurate on a floating point font engine. Rather we use the slightly slower but more accurate drawText() which takes a rectangle so that the results are identical to the ones produced by drawStaticText(). Reviewed-by: TrustMe
* Make QStaticText layout lazyEskil Abrahamsen Blomfeldt2010-03-291-1/+1
| | | | | | | | | | | | To avoid the unnecessary overhead of doing the text layout every time a part of the QStaticText object is changed, we mark it as invalid instead and do the layout when we have to. This means an overhead on the first paint event for most users. The overhead can be avoided by using the QStaticText::prepare() function and will probably not be noticable anyway, since it's a one-time thing. Task-number: QTBUG-9030 Reviewed-by: Gunnar
* Change QStaticText::setMaximumSize() to setTextWidth()Eskil Abrahamsen Blomfeldt2010-03-291-19/+32
| | | | | | | | | | | | | | | | | | To avoid having to precalculate the height of the laid out text, we now only supply a maximum text width to QStaticText. The only usage of the maximum height would be to clip the results, and clipping should be set separately from the QStaticText call, since this has no impact on the layout of the glyphs. The tests have been updated to reflect the change in logic. We also need a consistent way of specifying the position of the text. Before, the position meant "baseline position" for unbroken text and "top left position" for text with a specified layout width. We want to be consistent, and since baseline position makes no sense for multiline text, we standardize on top left position. Task-number: QTBUG-9029 Reviewed-by: Gunnar
* Respect QPainter::pen() in QPainter::drawStaticText()Eskil Abrahamsen Blomfeldt2010-03-291-0/+90
| | | | | | | | | | QStaticText needs to support changing the pen on the painter to support rich text, but it should not override the pen unless it has been explicitly set in the rich text. We do this by marking the pen as dirty in updateState() when we record the text items. Task-number: QTBUG-8908 Reviewed-by: Gunnar
* Synchronize rich text and plain text code paths in QStaticTextEskil Abrahamsen Blomfeldt2010-03-261-0/+36
| | | | | | | | | | | Drawing a string as plain text and rich text should have identical results unless special formatting information is added in the html. This means we should not have any implicit margin on the QTextDocument used to paint the text, and we should make up for the fact that the drawStaticText() call currently takes the position of the baseline and QTextDocument::drawContents() takes the top-left corner. Reviewed-by: Gunnar
* Better check in QStaticText testcase if xformed text is supportedGunnar Sletta2010-02-251-5/+12
| | | | Reviewed-by: Eskil
* Fix QStaticText test on QWSEskil Abrahamsen Blomfeldt2010-02-241-1/+29
| | | | | | | | | | Windows has the only font engine which supports transforming the glyphs in the glyph cache currently. All other engines fall back to drawing paths instead when using the raster engine. We disable the transformation tests for platforms which aren't either Windows or running a native graphics system. Reviewed-by: Olivier
* CompilePaul Olav Tvete2010-02-221-1/+1
| | | | | | | This test no longer uses QtOpenGL, therefore it doesn't need to try to link with it. Reviewed-by: Eskil
* Fix fallback for QStaticText when it's unsupported in paint engineEskil Abrahamsen Blomfeldt2010-02-191-2/+16
| | | | | | | | When the paint engine does not support QStaticText, we fall back to regular drawText() calls. This fallback would previously paint all text to (0, 0). This fixes the qstatictext autotest on Linux. Reviewed-by: Olivier
* Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2Jason McDonald2010-02-161-10/+11
|\
| * Rename QStaticText::setUseBackendOptimizations to setPerformanceHint()Eskil Abrahamsen Blomfeldt2010-02-161-10/+11
| | | | | | | | | | | | | | Make the API more general and more readable by using a PerformanceHint enum instead of an on/off-trigger for the OpenGL-specific caching. Reviewed-by: Samuel
* | Fix license headers.Jason McDonald2010-02-161-16/+16
|/ | | | Reviewed-by: Trust Me
* Remove fluxuating tests for QStaticTextEskil Abrahamsen Blomfeldt2010-02-101-209/+0
| | | | | | | The QGLWidget tests would fail at random. The use case has been confirmed to work through manual tests, but I haven't found any good way to test them automatically. They have been removed until time permits.
* Make QStaticText public API againEskil Abrahamsen Blomfeldt2010-02-101-17/+17
| | | | | QStaticText was previously made private API to support inclusion in Qt 4.6.x. This change turns it back into public API for Qt 4.7.0.
* Add tests for using QStaticText with a QGLWidgetEskil Abrahamsen Blomfeldt2010-02-052-1/+212
| | | | Some tests with and without VBO caching.
* Temporarily remove QPainter::drawStaticText() for Qt 4.6.x integrationEskil Abrahamsen Blomfeldt2010-02-051-14/+15
| | | | | | | | | | | We can't add new symbols to QPainter for Qt 4.6.x, as we would not be able to remove them again if we regretted the API. Hence, I've made removable symbols instead, a private global function and a drawStaticText() in QPainterPrivate. In order to tie things together, I needed a static private-getter in QPainterPrivate, and hence it had to be a friend of QPainter. Reviewed-by: Trond
* Fix one test and add tests for backend optimizationsEskil Abrahamsen Blomfeldt2010-02-011-3/+32
| | | | | | The rotatedTranslatedScaled-test would transform the text out of the destination rect, so we'd just confirm two blank images. Also added input to the two basic tests for backend optimizations.
* Make QStaticText private APIEskil Abrahamsen Blomfeldt2010-02-011-1/+1
| | | | | | | | Turns QStaticText into private API in preparation for Qt 4.6.x. The related functions in QPainter are marked as internal in the docs. There are already internal functions in QPainter, so this seemed like a reasonable solution. Since the functions require QStaticText they will not be accessible to anyone who does not include private API.
* Use fallback when drawing projected textEskil Abrahamsen Blomfeldt2010-01-151-0/+29
| | | | | Projected text always has to go via paths, so we use the fall back for this.
* Test current graphics system + initialize memoryEskil Abrahamsen Blomfeldt2010-01-151-23/+44
| | | | | | | Using QImage would only let us test the raster engine. Substitute QPixmap, so we can test different graphics systems. Also initialize the memory in the pixmaps (this was missed because memory is initialized by default in debug builds.)
* Remove translationDoesNotCauseRelayout testEskil Abrahamsen Blomfeldt2010-01-151-45/+0
| | | | | This is more suited to be a benchmark, as it doesn't cover the functionality of the class.
* Add tests for QStaticText::prepare()Eskil Abrahamsen Blomfeldt2010-01-151-0/+51
|
* Remove font property in QStaticText and fix handling translation onEskil Abrahamsen Blomfeldt2010-01-141-4/+15
| | | | | | | | | | | | | painter 1. The font property in QStaticText has been removed. Rather than set a font on the text explicitly, it picks up the font from the painter. If you change the font on the painter, the text layout will have to be updated, like with a matrix. 2. The translation might not be the only transformation on the painter, so rather than translate back to origo, we explicitly set dx and dy on the transform to 0.0 for the duration of the function. 3. Update test to reflect changes
* Ignore rounding errors in QStaticText testEskil Abrahamsen Blomfeldt2010-01-141-11/+4
| | | | | | Combining rotations and translations will cause minor differences between drawText() and drawStaticText(). This is not what the function is testing, so it has been massaged to pass.
* Remove debug outputEskil Abrahamsen Blomfeldt2010-01-141-1/+1
| | | | Don't save images by default.
* Ignore rounding error when painting to rotated painterEskil Abrahamsen Blomfeldt2010-01-141-15/+17
| | | | | | | | There are tiny rounding errors in the matrix rotations which cause tiny differences in drawText() and drawStaticText(). I've chosen to ignore these. Instead of having a threshold on the comparison between the two images, I've chosen to take the easy way out and avoid the problem by not passing in any position for the text.
* Add autotests for transformed static textEskil Abrahamsen Blomfeldt2010-01-141-0/+184
| | | | | Most of these tests currently fail revealing som offset bugs in the painting code.
* Add test for QStaticTextEskil Abrahamsen Blomfeldt2010-01-142-0/+162
Tests that QStaticText rendering is identical to the same operations done with regular QPainter::drawText()