From c771dd1e4a84108e3c345cf2696a6bb4a3aa4157 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 20 Nov 2009 10:43:33 +1000 Subject: Implement TextInput::horizontalAlignment Includes visual autotest. --- .../graphicsitems/qmlgraphicstextinput.cpp | 18 +++- .../visual/qmlgraphicstextinput/data/hAlign.0.png | Bin 0 -> 1245 bytes .../visual/qmlgraphicstextinput/data/hAlign.qml | 107 +++++++++++++++++++++ .../visual/qmlgraphicstextinput/hAlign.qml | 39 ++++++++ 4 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/visual/qmlgraphicstextinput/data/hAlign.0.png create mode 100644 tests/auto/declarative/visual/qmlgraphicstextinput/data/hAlign.qml create mode 100644 tests/auto/declarative/visual/qmlgraphicstextinput/hAlign.qml diff --git a/src/declarative/graphicsitems/qmlgraphicstextinput.cpp b/src/declarative/graphicsitems/qmlgraphicstextinput.cpp index 56f59d8..b7d4e8c 100644 --- a/src/declarative/graphicsitems/qmlgraphicstextinput.cpp +++ b/src/declarative/graphicsitems/qmlgraphicstextinput.cpp @@ -212,8 +212,9 @@ QmlGraphicsTextInput::HAlignment QmlGraphicsTextInput::hAlign() const void QmlGraphicsTextInput::setHAlign(HAlignment align) { Q_D(QmlGraphicsTextInput); + if(align == d->hAlign) + return; d->hAlign = align; - //TODO: implement } bool QmlGraphicsTextInput::isReadOnly() const @@ -650,6 +651,21 @@ void QmlGraphicsTextInput::drawContents(QPainter *p, const QRect &r) } QPoint offset = QPoint(0,0); + if(d->hAlign != AlignLeft){ + QFontMetrics fm = QFontMetrics(d->font); + //###Is this using bearing appropriately? + int minLB = qMax(0, -fm.minLeftBearing()); + int minRB = qMax(0, -fm.minRightBearing()); + int widthUsed = qRound(d->control->naturalTextWidth()) + 1 + minRB; + int hOffset = 0; + if(d->hAlign == AlignRight){ + hOffset = width() - widthUsed; + }else if(d->hAlign == AlignHCenter){ + hOffset = (width() - widthUsed) / 2; + } + hOffset -= minLB; + offset = QPoint(hOffset, 0); + } QRect clipRect = r; d->control->draw(p, offset, clipRect, flags); diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/hAlign.0.png b/tests/auto/declarative/visual/qmlgraphicstextinput/data/hAlign.0.png new file mode 100644 index 0000000..87c2e07 Binary files /dev/null and b/tests/auto/declarative/visual/qmlgraphicstextinput/data/hAlign.0.png differ diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/hAlign.qml b/tests/auto/declarative/visual/qmlgraphicstextinput/data/hAlign.qml new file mode 100644 index 0000000..e29ac56 --- /dev/null +++ b/tests/auto/declarative/visual/qmlgraphicstextinput/data/hAlign.qml @@ -0,0 +1,107 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 32 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 48 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 64 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 80 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 96 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 112 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 128 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 144 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 160 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 176 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 192 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 208 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 224 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 240 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 256 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 272 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 288 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 304 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 320 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 336 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 352 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 368 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 384 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 400 + hash: "7619ed68aca3544f373777e11a4bfefa" + } +} diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/hAlign.qml b/tests/auto/declarative/visual/qmlgraphicstextinput/hAlign.qml new file mode 100644 index 0000000..2d65adf --- /dev/null +++ b/tests/auto/declarative/visual/qmlgraphicstextinput/hAlign.qml @@ -0,0 +1,39 @@ +import Qt 4.6 + +Item{ + width:600; + height:300; + Column{ + TextInput{ + text: "Jackdaws love my big sphinx of quartz"; + horizontalAlignment: TextInput.AlignLeft; + } + TextInput{ + text: "Jackdaws love my big sphinx of quartz"; + horizontalAlignment: TextInput.AlignHCenter; + } + TextInput{ + text: "Jackdaws love my big sphinx of quartz"; + horizontalAlignment: TextInput.AlignRight; + } + Rectangle{ width: 600; height: 10; color: "pink" } + TextInput{ + height: 30; + width: 600; + text: "Jackdaws love my big sphinx of quartz"; + horizontalAlignment: TextInput.AlignLeft; + } + TextInput{ + height: 30; + width: 600; + text: "Jackdaws love my big sphinx of quartz"; + horizontalAlignment: TextInput.AlignHCenter; + } + TextInput{ + height: 30; + width: 600; + text: "Jackdaws love my big sphinx of quartz"; + horizontalAlignment: TextInput.AlignRight; + } + } +} -- cgit v0.12 From 9b4b6301803cacd288547f8de1fd0370afd83ee3 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 20 Nov 2009 11:57:07 +1000 Subject: Doc tweaks Minor touchups for the samegame tutorial --- doc/src/declarative/advtutorial.qdoc | 2 ++ doc/src/declarative/advtutorial1.qdoc | 2 +- doc/src/declarative/advtutorial2.qdoc | 6 +++--- doc/src/declarative/advtutorial3.qdoc | 18 +++++++++--------- doc/src/declarative/advtutorial4.qdoc | 10 +++++----- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc index c796633..60dc0e6 100644 --- a/doc/src/declarative/advtutorial.qdoc +++ b/doc/src/declarative/advtutorial.qdoc @@ -47,6 +47,8 @@ This tutorial goes step-by-step through creating a full application using just Q It is assumed that you already know basic QML (such as from doing the simple tutorial) and the focus is on showing how to turn that knowledge into a complete and functioning application. +This tutorial involves a significant amount of javascript to implement the game logic. An understanding of javascript is helpful to understand the javascript parts of this tutorial, but if you don't understand javascript you can still get a feel for how to integrate QML elements with backend logic which creates and controls them. From the QML perspective, there is little difference between integrating with backend logic written in C++ and backend logic written in javascript. + In this tutorial we recreate, step by step, the Same Game demo in $QTDIR/demos/declarative/samegame.qml. The results of the individual steps are in the $QTDIR/examples/declarative/tutorials/samegame directory. diff --git a/doc/src/declarative/advtutorial1.qdoc b/doc/src/declarative/advtutorial1.qdoc index 66fa607..a96485c 100644 --- a/doc/src/declarative/advtutorial1.qdoc +++ b/doc/src/declarative/advtutorial1.qdoc @@ -70,7 +70,7 @@ And here is a simple block: Since it doesn't do anything yet it's very simple, just an image. As the tutorial progresses and the block starts doing things the file will become -more than just an image. Note that we've set the image to be the size of the itm. +more than just an image. Note that we've set the image to be the size of the item. This will be used later, when we dynamically create and size the block items the image will be scaled automatically to the correct size. diff --git a/doc/src/declarative/advtutorial2.qdoc b/doc/src/declarative/advtutorial2.qdoc index abfdbc6..9fab289 100644 --- a/doc/src/declarative/advtutorial2.qdoc +++ b/doc/src/declarative/advtutorial2.qdoc @@ -62,15 +62,15 @@ The \c initBoard function will be hooked up to the new game button soon, and sho The \c createBlock function is a lot bigger, and I'll explain it block by block. First we ensure that the component has been constructed. QML elements, including composite ones like the \c Block.qml that we've written, are never created directly in script. While there is a function to parse and create an arbitrary QML string, -in the case where you are repeatedly creating the sme item you will want to use the \c createComponent function. \c createComponent is +in the case where you are repeatedly creating the same item you will want to use the \c createComponent function. \c createComponent is a built-in function in the declarative ECMAScript, and returns a component object. A component object prepares and stores a QML element (usually a composite element) for easy and efficient use. When the component is ready, you can create a new instance of the loaded QML with the \c createObject method. If the component is loaded remotely (over HTTP for example) then you will have to wait for the component to finish loading -before calling \c createObject. Since we don't wait here (the waiting is a syncronous, the component object has a signal to tell +before calling \c createObject. Since we don't wait here (the waiting is asyncronous, the component object will send a signal to tell you when it's done) this code will only work if the block QML is a local file. -As we aren't waiting for he component, the next block of code creates a game block with \c{component.createObject}. +As we aren't waiting for the component, the next block of code creates a game block with \c{component.createObject}. Since there could be an error in the QML file you are trying to load, success is not guaranteed. The first bit of error checkign code comes right after \c{createObject()}, to ensure that the object loaded correctly. If it did not load correctly the function returns false, but we don't have that hooked up to the main UI to indicate diff --git a/doc/src/declarative/advtutorial3.qdoc b/doc/src/declarative/advtutorial3.qdoc index 0d236e4..5ac1be3 100644 --- a/doc/src/declarative/advtutorial3.qdoc +++ b/doc/src/declarative/advtutorial3.qdoc @@ -44,7 +44,7 @@ \example declarative/tutorials/samegame/samegame3 \title Advanced Tutorial 3 - Implementing the Game Logic -To the \c initBoard function we added clearing the board beforehand, so that clicking new game won't leave the previous game +First we add to the \c initBoard function clearing of the board before filling it up again, so that clicking new game won't leave the previous game lying around in the background. To the \c createComponent function we have added setting the type of the block to a number between one and three - it's fundamental to the game logic that the blocks be different types if you want a fun game. @@ -58,33 +58,33 @@ The main change was adding the following game logic functions: \endlist As this is a tutorial about QML, not game design, these functions will not be discussed in detail. The game logic here -was written in script, but it could have been written in C++ and had these functions exposed just as well (in fact, probably faster). -The interfacing between these funcions and QML is of interest though. Of these functions, only \c handleClick and \c victoryCheck +was written in script, but it could have been written in C++ and had these functions exposed in the same way (except probably faster). +The interfacing of these functions and QML is what we will focus on. Of these functions, only \c handleClick and \c victoryCheck interface closely with the QML. Those functions are shown below (the rest are still in the code for this tutorial located at \c{$QTDIR/examples/declarative/tutorials/samegame}). \snippet declarative/tutorials/samegame/samegame3/samegame.js 1 \snippet declarative/tutorials/samegame/samegame3/samegame.js 2 -You'll notice them referring to the \c gameCanvas item. This is an item that has been added to the QML for easy interfacing. +You'll notice them referring to the \c gameCanvas item. This is an item that has been added to the QML for easier interfacing with the game logic. It is placed next to the background image and replaces the background as the item to create the blocks in. Its code is shown below: \snippet declarative/tutorials/samegame/samegame3/samegame.qml 1 This item is the exact size of the board, contains a score property, and a mouse region for input. -The blocks are now created as its children, and its size is used to determining the board size. +The blocks are now created as its children, and its size is used to determining the board size, so as to scale to the available screen size. Since it needs to bind its size to a multiple of \c tileSize, \c tileSize needs to be moved into a QML property and out of the script file. -It can still be accessed from the script. +Note that it can still be accessed from the script. The mouse region simply calls \c{handleClick()}, which deals with the input events. Should those events cause the player to score, \c{gameCanvas.score} is updated. The score display text item has also been changed to bind its text property to \c{gamecanvas.score}. Note that if score was a global variable in the \c{samegame.js} file you could not bind to it. You can only bind to QML properties. -\c victoryCheck() mostly just updates score. But it also pops up a dialog saying \e {Game Over} when the game is over. +\c victoryCheck() primarily updates the score variable. But it also pops up a dialog saying \e {Game Over} when the game is over. In this example we wanted a pure-QML, animated dialog, and since QML doesn't contain one, we wrote our own. -Below is the code for the \c Dialog element, note how it's designed so as to be quite usable imperatively from within the script file: +Below is the code for the \c Dialog element, note how it's designed so as to be usable imperatively from within the script file (via the functions and signals): \snippet declarative/tutorials/samegame/samegame3/Dialog.qml 0 @@ -107,7 +107,7 @@ And the code for the block: \snippet declarative/tutorials/samegame/samegame3/Block.qml 0 -The game works, but it's a little boring right now. Where's the smooth animated transitions? Where's the high scores? +The game works, but it's a little boring right now. Where are the smooth animated transitions? Where are the high scores? If you were a QML expert you could have written these in for the first iteration, but in this tutorial they've been saved until the next chapter - where your application becomes alive! diff --git a/doc/src/declarative/advtutorial4.qdoc b/doc/src/declarative/advtutorial4.qdoc index f4724d8..2599e32 100644 --- a/doc/src/declarative/advtutorial4.qdoc +++ b/doc/src/declarative/advtutorial4.qdoc @@ -71,7 +71,7 @@ parameters specified). This is shown in the below snippet of code from \c Block. We also have to change the \c{samegame.js} code, so that wherever it was setting the \c x or \c y it now sets \c targetX and \c targetY (including when creating the block). This simple change is all you need to get spring moving blocks that no longer teleport around the board. If you try doing just this though, you'll notice that they now never jump from one point to another, even in -the initialization! This gives an odd effect of having them all jump out of the corner (0,0) on start up. We'd rather that they +the initialization! This gives an odd effect of having them all slide out of the corner (0,0) on start up. We'd rather that they fall down from the top in rows. To do this, we disable the \c x follow (but not the \c y follow) and only enable it after we've set the \c x in the \c createBlock function. The above snippet now becomes: @@ -84,7 +84,7 @@ image's opacity, like so: \snippet declarative/tutorials/samegame/samegame4/content/BoomBlock.qml 2 -Note that the \c{opacity: 0} makes it start out transparent. We could set the opacity in the script file when we create the blocks, +Note that the \c{opacity: 0} makes it start out transparent. We could set the opacity in the script file when we create and destroy the blocks, but instead we use states (as this is useful for the next animation we'll implement). The below snippet is set on the root element of \c{Block.qml}: \code @@ -129,7 +129,7 @@ if they exit this dialog without entering it they have a way to opt out of posti For offline storage, we use the HTML 5 offline storage javascript API to maintain a persistant SQL database unique to this application. This first line in this function calls the function for the web-based high scores, described later, if it has been setup. Next we create an offline storage database for the high scores using openDatabase and prepare the data and SQL query that we want to use to save it. The offline storage API uses SQL queries for data manipulation and retrival, and in the db.transaction call we use three SQL queries to initialize the database (if necessary), and then add to and retrieve high scores. To use the returned data, we turn it into a string with one line per row returned, and show a dialog containing that string. For a more detailed explanation of the offline storage API in QML, consult the global object documentation. -This is one way of storing and displaying high scores locally, but not the only way. A more complex alternative would have been to create a high score dialog component, and pass the results to it for processing and display (instead of resusing the Dialog). This would allow a more themable dialog that could present the high scores better. If your QML is the UI for a C++ application, you could also have passed the score to a C++ function to store it locally in a variety of ways, including a simple format without SQL. +This is one way of storing and displaying high scores locally, but not the only way. A more complex alternative would have been to create a high score dialog component, and pass the results to it for processing and display (instead of resusing the Dialog). This would allow a more themable dialog that could present the high scores better. If your QML is the UI for a C++ application, you could also have passed the score to a C++ function to store it locally in a variety of ways, including a simple format without SQL or in another SQL database. \section2 Web-based High Scores @@ -143,7 +143,7 @@ if the player entered their name we can send the data to the web service in the \snippet declarative/tutorials/samegame/samegame4/content/samegame.js 1 This is the same \c XMLHttpRequest() as you'll find in browser javascript, and can be used in the same way to dynamically get XML -or QML from the web service to display the high scores. We don't worry about the response here though, we just post the high +or QML from the web service to display the high scores. We don't worry about the response in this case, we just post the high score data to the web server. If it had returned a QML file (or a URL to a QML file) you could instantiate it in much the same way as you did the blocks. @@ -152,7 +152,7 @@ makes it very easy to fetch and display XML based data such as RSS in a QML appl By following this tutorial you've now ben shown how to write a fully functional application in QML, with the application logic written in a script file and with both many fluid animations and being web-enabled. Congratulations, you should now be skilled -enough to write your own QML applications. +enough to write entire applications in QML. [Previous: \l {Advanced Tutorial 3 - Implementing the Game Logic}] [\l {advtutorial.html}{Advanced Tutorial}] */ -- cgit v0.12 From b5f566badd1d7232bc9be36f7d0f9797ad1019e9 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Fri, 20 Nov 2009 13:02:14 +1000 Subject: remove warnings --- tests/auto/declarative/qmlgraphicspathview/data/pathview3.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/auto/declarative/qmlgraphicspathview/data/pathview3.qml b/tests/auto/declarative/qmlgraphicspathview/data/pathview3.qml index a8c1e91..412cca2 100644 --- a/tests/auto/declarative/qmlgraphicspathview/data/pathview3.qml +++ b/tests/auto/declarative/qmlgraphicspathview/data/pathview3.qml @@ -47,11 +47,10 @@ PathView { Rectangle { id: wrapper width: 85; height: 85; color: lColor - scale: wrapper.PathView.scale transform: Rotation { id: itemRotation; origin.x: wrapper.width/2; origin.y: wrapper.height/2 - axis.y: 1; axis.z: 0; angle: wrapper.PathView.angle + axis.y: 1; axis.z: 0 } } } -- cgit v0.12 From 1158bf03676258ea09bda3439a9c21abe669d090 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 20 Nov 2009 13:37:15 +1000 Subject: TextInput echoMode visual test --- .../qmlgraphicstextinput/data-X11/echoMode.0.png | Bin 0 -> 999 bytes .../qmlgraphicstextinput/data-X11/echoMode.1.png | Bin 0 -> 1880 bytes .../qmlgraphicstextinput/data-X11/echoMode.2.png | Bin 0 -> 2962 bytes .../qmlgraphicstextinput/data-X11/echoMode.3.png | Bin 0 -> 2827 bytes .../qmlgraphicstextinput/data-X11/echoMode.4.png | Bin 0 -> 2827 bytes .../qmlgraphicstextinput/data-X11/echoMode.qml | 1043 ++++++++++++++++++++ .../qmlgraphicstextinput/data-X11/hAlign.0.png | Bin 0 -> 1245 bytes .../qmlgraphicstextinput/data-X11/hAlign.qml | 107 ++ .../qmlgraphicstextinput/data/echoMode.0.png | Bin 0 -> 999 bytes .../qmlgraphicstextinput/data/echoMode.1.png | Bin 0 -> 1880 bytes .../qmlgraphicstextinput/data/echoMode.2.png | Bin 0 -> 2962 bytes .../qmlgraphicstextinput/data/echoMode.3.png | Bin 0 -> 2827 bytes .../qmlgraphicstextinput/data/echoMode.4.png | Bin 0 -> 2827 bytes .../visual/qmlgraphicstextinput/data/echoMode.qml | 1043 ++++++++++++++++++++ .../visual/qmlgraphicstextinput/echoMode.qml | 10 + 15 files changed, 2203 insertions(+) create mode 100644 tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.0.png create mode 100644 tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.1.png create mode 100644 tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.2.png create mode 100644 tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.3.png create mode 100644 tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.4.png create mode 100644 tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.qml create mode 100644 tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/hAlign.0.png create mode 100644 tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/hAlign.qml create mode 100644 tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.0.png create mode 100644 tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.1.png create mode 100644 tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.2.png create mode 100644 tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.3.png create mode 100644 tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.4.png create mode 100644 tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.qml create mode 100644 tests/auto/declarative/visual/qmlgraphicstextinput/echoMode.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.0.png b/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.0.png new file mode 100644 index 0000000..2b45a06 Binary files /dev/null and b/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.0.png differ diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.1.png b/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.1.png new file mode 100644 index 0000000..1f5bae0 Binary files /dev/null and b/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.1.png differ diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.2.png b/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.2.png new file mode 100644 index 0000000..cb2b5a4 Binary files /dev/null and b/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.2.png differ diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.3.png b/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.3.png new file mode 100644 index 0000000..aa24805 Binary files /dev/null and b/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.3.png differ diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.4.png b/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.4.png new file mode 100644 index 0000000..aa24805 Binary files /dev/null and b/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.4.png differ diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.qml b/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.qml new file mode 100644 index 0000000..dd7b291 --- /dev/null +++ b/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.qml @@ -0,0 +1,1043 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 32 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Key { + type: 6 + key: 16777248 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 48 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 64 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 80 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 96 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 112 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 128 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 144 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 160 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 176 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 192 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 208 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 224 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 240 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 256 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 272 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 288 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 304 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 320 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 336 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 352 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Key { + type: 6 + key: 74 + modifiers: 33554432 + text: "4a" + autorep: false + count: 1 + } + Frame { + msec: 368 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 384 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 400 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 416 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 432 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Key { + type: 7 + key: 74 + modifiers: 33554432 + text: "4a" + autorep: false + count: 1 + } + Frame { + msec: 448 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 464 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 480 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 496 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 512 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 528 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Key { + type: 7 + key: 16777248 + modifiers: 33554432 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 544 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 560 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 576 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 592 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 608 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 624 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 640 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 656 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 672 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 688 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Key { + type: 6 + key: 65 + modifiers: 0 + text: "61" + autorep: false + count: 1 + } + Frame { + msec: 704 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Frame { + msec: 720 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Frame { + msec: 736 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Frame { + msec: 752 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Frame { + msec: 768 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Key { + type: 7 + key: 65 + modifiers: 0 + text: "61" + autorep: false + count: 1 + } + Frame { + msec: 784 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Frame { + msec: 800 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Frame { + msec: 816 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Frame { + msec: 832 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Frame { + msec: 848 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Key { + type: 6 + key: 67 + modifiers: 0 + text: "63" + autorep: false + count: 1 + } + Frame { + msec: 864 + hash: "a4b81c526a5bf8902fde9b8721980977" + } + Frame { + msec: 880 + hash: "a4b81c526a5bf8902fde9b8721980977" + } + Frame { + msec: 896 + hash: "a4b81c526a5bf8902fde9b8721980977" + } + Key { + type: 7 + key: 67 + modifiers: 0 + text: "63" + autorep: false + count: 1 + } + Frame { + msec: 912 + hash: "a4b81c526a5bf8902fde9b8721980977" + } + Frame { + msec: 928 + hash: "a4b81c526a5bf8902fde9b8721980977" + } + Frame { + msec: 944 + hash: "a4b81c526a5bf8902fde9b8721980977" + } + Frame { + msec: 960 + image: "echoMode.0.png" + } + Frame { + msec: 976 + hash: "a4b81c526a5bf8902fde9b8721980977" + } + Key { + type: 6 + key: 75 + modifiers: 0 + text: "6b" + autorep: false + count: 1 + } + Frame { + msec: 992 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1008 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1024 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1040 + hash: "d072aebc2314a149a856634786b208a0" + } + Key { + type: 7 + key: 75 + modifiers: 0 + text: "6b" + autorep: false + count: 1 + } + Frame { + msec: 1056 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1072 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1088 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1104 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1120 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1136 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1152 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1168 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1184 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1200 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1216 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1232 + hash: "d072aebc2314a149a856634786b208a0" + } + Key { + type: 6 + key: 68 + modifiers: 0 + text: "64" + autorep: false + count: 1 + } + Frame { + msec: 1248 + hash: "94defec2865529f185d02cfcbfe166cc" + } + Frame { + msec: 1264 + hash: "94defec2865529f185d02cfcbfe166cc" + } + Frame { + msec: 1280 + hash: "94defec2865529f185d02cfcbfe166cc" + } + Key { + type: 7 + key: 68 + modifiers: 0 + text: "64" + autorep: false + count: 1 + } + Frame { + msec: 1296 + hash: "94defec2865529f185d02cfcbfe166cc" + } + Frame { + msec: 1312 + hash: "94defec2865529f185d02cfcbfe166cc" + } + Frame { + msec: 1328 + hash: "94defec2865529f185d02cfcbfe166cc" + } + Key { + type: 6 + key: 65 + modifiers: 0 + text: "61" + autorep: false + count: 1 + } + Frame { + msec: 1344 + hash: "f625a2a82879df96141000e6931d4487" + } + Frame { + msec: 1360 + hash: "f625a2a82879df96141000e6931d4487" + } + Frame { + msec: 1376 + hash: "f625a2a82879df96141000e6931d4487" + } + Frame { + msec: 1392 + hash: "f625a2a82879df96141000e6931d4487" + } + Frame { + msec: 1408 + hash: "f625a2a82879df96141000e6931d4487" + } + Frame { + msec: 1424 + hash: "f625a2a82879df96141000e6931d4487" + } + Frame { + msec: 1440 + hash: "f625a2a82879df96141000e6931d4487" + } + Frame { + msec: 1456 + hash: "f625a2a82879df96141000e6931d4487" + } + Frame { + msec: 1472 + hash: "f625a2a82879df96141000e6931d4487" + } + Key { + type: 7 + key: 65 + modifiers: 0 + text: "61" + autorep: false + count: 1 + } + Frame { + msec: 1488 + hash: "f625a2a82879df96141000e6931d4487" + } + Key { + type: 6 + key: 87 + modifiers: 0 + text: "77" + autorep: false + count: 1 + } + Frame { + msec: 1504 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Frame { + msec: 1520 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Frame { + msec: 1536 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Frame { + msec: 1552 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Key { + type: 7 + key: 87 + modifiers: 0 + text: "77" + autorep: false + count: 1 + } + Frame { + msec: 1568 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Frame { + msec: 1584 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Frame { + msec: 1600 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Frame { + msec: 1616 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Frame { + msec: 1632 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Frame { + msec: 1648 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Key { + type: 6 + key: 83 + modifiers: 0 + text: "73" + autorep: false + count: 1 + } + Frame { + msec: 1664 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Frame { + msec: 1680 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Frame { + msec: 1696 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Frame { + msec: 1712 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Frame { + msec: 1728 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Key { + type: 6 + key: 32 + modifiers: 0 + text: "20" + autorep: false + count: 1 + } + Frame { + msec: 1744 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Key { + type: 7 + key: 83 + modifiers: 0 + text: "73" + autorep: false + count: 1 + } + Frame { + msec: 1760 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Frame { + msec: 1776 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Frame { + msec: 1792 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Key { + type: 7 + key: 32 + modifiers: 0 + text: "20" + autorep: false + count: 1 + } + Frame { + msec: 1808 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Frame { + msec: 1824 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Frame { + msec: 1840 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Frame { + msec: 1856 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Key { + type: 6 + key: 76 + modifiers: 0 + text: "6c" + autorep: false + count: 1 + } + Frame { + msec: 1872 + hash: "cb2dc1c4fc4e213841b873561f404a4f" + } + Frame { + msec: 1888 + hash: "cb2dc1c4fc4e213841b873561f404a4f" + } + Frame { + msec: 1904 + hash: "cb2dc1c4fc4e213841b873561f404a4f" + } + Frame { + msec: 1920 + image: "echoMode.1.png" + } + Key { + type: 7 + key: 76 + modifiers: 0 + text: "6c" + autorep: false + count: 1 + } + Frame { + msec: 1936 + hash: "cb2dc1c4fc4e213841b873561f404a4f" + } + Frame { + msec: 1952 + hash: "cb2dc1c4fc4e213841b873561f404a4f" + } + Frame { + msec: 1968 + hash: "cb2dc1c4fc4e213841b873561f404a4f" + } + Frame { + msec: 1984 + hash: "cb2dc1c4fc4e213841b873561f404a4f" + } + Frame { + msec: 2000 + hash: "cb2dc1c4fc4e213841b873561f404a4f" + } + Frame { + msec: 2016 + hash: "cb2dc1c4fc4e213841b873561f404a4f" + } + Key { + type: 6 + key: 79 + modifiers: 0 + text: "6f" + autorep: false + count: 1 + } + Frame { + msec: 2032 + hash: "c2aff1ebdee69cca7dc67a102fce5e8e" + } + Frame { + msec: 2048 + hash: "c2aff1ebdee69cca7dc67a102fce5e8e" + } + Key { + type: 7 + key: 79 + modifiers: 0 + text: "6f" + autorep: false + count: 1 + } + Frame { + msec: 2064 + hash: "c2aff1ebdee69cca7dc67a102fce5e8e" + } + Frame { + msec: 2080 + hash: "c2aff1ebdee69cca7dc67a102fce5e8e" + } + Key { + type: 6 + key: 86 + modifiers: 0 + text: "76" + autorep: false + count: 1 + } + Frame { + msec: 2096 + hash: "c82441813af6ff577687f29f6a09da38" + } + Frame { + msec: 2112 + hash: "c82441813af6ff577687f29f6a09da38" + } + Frame { + msec: 2128 + hash: "c82441813af6ff577687f29f6a09da38" + } + Frame { + msec: 2144 + hash: "c82441813af6ff577687f29f6a09da38" + } + Key { + type: 6 + key: 69 + modifiers: 0 + text: "65" + autorep: false + count: 1 + } + Key { + type: 7 + key: 86 + modifiers: 0 + text: "76" + autorep: false + count: 1 + } + Frame { + msec: 2160 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Frame { + msec: 2176 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Frame { + msec: 2192 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Frame { + msec: 2208 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Key { + type: 6 + key: 32 + modifiers: 0 + text: "20" + autorep: false + count: 1 + } + Frame { + msec: 2224 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Key { + type: 7 + key: 69 + modifiers: 0 + text: "65" + autorep: false + count: 1 + } + Frame { + msec: 2240 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Frame { + msec: 2256 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Frame { + msec: 2272 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Frame { + msec: 2288 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Frame { + msec: 2304 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Key { + type: 7 + key: 32 + modifiers: 0 + text: "20" + autorep: false + count: 1 + } + Frame { + msec: 2320 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Frame { + msec: 2336 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Key { + type: 6 + key: 77 + modifiers: 0 + text: "6d" + autorep: false + count: 1 + } + Frame { + msec: 2352 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Frame { + msec: 2368 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Frame { + msec: 2384 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Frame { + msec: 2400 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Frame { + msec: 2416 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Frame { + msec: 2432 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Key { + type: 7 + key: 77 + modifiers: 0 + text: "6d" + autorep: false + count: 1 + } + Frame { + msec: 2448 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Frame { + msec: 2464 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Frame { + msec: 2480 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Frame { + msec: 2496 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Key { + type: 6 + key: 89 + modifiers: 0 + text: "79" + autorep: false + count: 1 + } + Frame { + msec: 2512 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2528 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2544 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Key { + type: 7 + key: 89 + modifiers: 0 + text: "79" + autorep: false + count: 1 + } + Frame { + msec: 2560 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2576 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2592 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2608 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2624 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2640 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2656 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2672 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2688 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2704 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2720 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2736 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2752 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2768 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2784 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2800 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2816 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2832 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2848 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2864 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2880 + image: "echoMode.2.png" + } + Frame { + msec: 2896 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2912 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2928 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2944 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2960 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2976 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2992 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 3008 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 3024 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 3040 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 3056 + hash: "316f2ba46d059755576e6822dc77afb2" + } +} diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/hAlign.0.png b/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/hAlign.0.png new file mode 100644 index 0000000..87c2e07 Binary files /dev/null and b/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/hAlign.0.png differ diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/hAlign.qml b/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/hAlign.qml new file mode 100644 index 0000000..e29ac56 --- /dev/null +++ b/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/hAlign.qml @@ -0,0 +1,107 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 32 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 48 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 64 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 80 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 96 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 112 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 128 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 144 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 160 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 176 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 192 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 208 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 224 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 240 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 256 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 272 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 288 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 304 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 320 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 336 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 352 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 368 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 384 + hash: "7619ed68aca3544f373777e11a4bfefa" + } + Frame { + msec: 400 + hash: "7619ed68aca3544f373777e11a4bfefa" + } +} diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.0.png b/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.0.png new file mode 100644 index 0000000..2b45a06 Binary files /dev/null and b/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.0.png differ diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.1.png b/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.1.png new file mode 100644 index 0000000..1f5bae0 Binary files /dev/null and b/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.1.png differ diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.2.png b/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.2.png new file mode 100644 index 0000000..cb2b5a4 Binary files /dev/null and b/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.2.png differ diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.3.png b/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.3.png new file mode 100644 index 0000000..aa24805 Binary files /dev/null and b/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.3.png differ diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.4.png b/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.4.png new file mode 100644 index 0000000..aa24805 Binary files /dev/null and b/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.4.png differ diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.qml b/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.qml new file mode 100644 index 0000000..873a86d --- /dev/null +++ b/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.qml @@ -0,0 +1,1043 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 32 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Key { + type: 6 + key: 16777248 + modifiers: 33554432 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 48 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 64 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 80 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 96 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 112 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 128 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 144 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 160 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 176 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 192 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 208 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 224 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 240 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 256 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 272 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 288 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 304 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 320 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 336 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Frame { + msec: 352 + hash: "b73bd9c2fef8812591fff9f43b73da13" + } + Key { + type: 6 + key: 74 + modifiers: 33554432 + text: "4a" + autorep: false + count: 1 + } + Frame { + msec: 368 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 384 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 400 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 416 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 432 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Key { + type: 7 + key: 74 + modifiers: 33554432 + text: "4a" + autorep: false + count: 1 + } + Frame { + msec: 448 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 464 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 480 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 496 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 512 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 528 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Key { + type: 7 + key: 16777248 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 544 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 560 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 576 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 592 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 608 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 624 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 640 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 656 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 672 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Frame { + msec: 688 + hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + } + Key { + type: 6 + key: 65 + modifiers: 0 + text: "61" + autorep: false + count: 1 + } + Frame { + msec: 704 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Frame { + msec: 720 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Frame { + msec: 736 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Frame { + msec: 752 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Frame { + msec: 768 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Key { + type: 7 + key: 65 + modifiers: 0 + text: "61" + autorep: false + count: 1 + } + Frame { + msec: 784 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Frame { + msec: 800 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Frame { + msec: 816 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Frame { + msec: 832 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Frame { + msec: 848 + hash: "fbc09d695e0b47aae6e977c13f535bfd" + } + Key { + type: 6 + key: 67 + modifiers: 0 + text: "63" + autorep: false + count: 1 + } + Frame { + msec: 864 + hash: "a4b81c526a5bf8902fde9b8721980977" + } + Frame { + msec: 880 + hash: "a4b81c526a5bf8902fde9b8721980977" + } + Frame { + msec: 896 + hash: "a4b81c526a5bf8902fde9b8721980977" + } + Key { + type: 7 + key: 67 + modifiers: 0 + text: "63" + autorep: false + count: 1 + } + Frame { + msec: 912 + hash: "a4b81c526a5bf8902fde9b8721980977" + } + Frame { + msec: 928 + hash: "a4b81c526a5bf8902fde9b8721980977" + } + Frame { + msec: 944 + hash: "a4b81c526a5bf8902fde9b8721980977" + } + Frame { + msec: 960 + image: "echoMode.0.png" + } + Frame { + msec: 976 + hash: "a4b81c526a5bf8902fde9b8721980977" + } + Key { + type: 6 + key: 75 + modifiers: 0 + text: "6b" + autorep: false + count: 1 + } + Frame { + msec: 992 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1008 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1024 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1040 + hash: "d072aebc2314a149a856634786b208a0" + } + Key { + type: 7 + key: 75 + modifiers: 0 + text: "6b" + autorep: false + count: 1 + } + Frame { + msec: 1056 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1072 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1088 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1104 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1120 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1136 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1152 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1168 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1184 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1200 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1216 + hash: "d072aebc2314a149a856634786b208a0" + } + Frame { + msec: 1232 + hash: "d072aebc2314a149a856634786b208a0" + } + Key { + type: 6 + key: 68 + modifiers: 0 + text: "64" + autorep: false + count: 1 + } + Frame { + msec: 1248 + hash: "94defec2865529f185d02cfcbfe166cc" + } + Frame { + msec: 1264 + hash: "94defec2865529f185d02cfcbfe166cc" + } + Frame { + msec: 1280 + hash: "94defec2865529f185d02cfcbfe166cc" + } + Key { + type: 7 + key: 68 + modifiers: 0 + text: "64" + autorep: false + count: 1 + } + Frame { + msec: 1296 + hash: "94defec2865529f185d02cfcbfe166cc" + } + Frame { + msec: 1312 + hash: "94defec2865529f185d02cfcbfe166cc" + } + Frame { + msec: 1328 + hash: "94defec2865529f185d02cfcbfe166cc" + } + Key { + type: 6 + key: 65 + modifiers: 0 + text: "61" + autorep: false + count: 1 + } + Frame { + msec: 1344 + hash: "f625a2a82879df96141000e6931d4487" + } + Frame { + msec: 1360 + hash: "f625a2a82879df96141000e6931d4487" + } + Frame { + msec: 1376 + hash: "f625a2a82879df96141000e6931d4487" + } + Frame { + msec: 1392 + hash: "f625a2a82879df96141000e6931d4487" + } + Frame { + msec: 1408 + hash: "f625a2a82879df96141000e6931d4487" + } + Frame { + msec: 1424 + hash: "f625a2a82879df96141000e6931d4487" + } + Frame { + msec: 1440 + hash: "f625a2a82879df96141000e6931d4487" + } + Frame { + msec: 1456 + hash: "f625a2a82879df96141000e6931d4487" + } + Frame { + msec: 1472 + hash: "f625a2a82879df96141000e6931d4487" + } + Key { + type: 7 + key: 65 + modifiers: 0 + text: "61" + autorep: false + count: 1 + } + Frame { + msec: 1488 + hash: "f625a2a82879df96141000e6931d4487" + } + Key { + type: 6 + key: 87 + modifiers: 0 + text: "77" + autorep: false + count: 1 + } + Frame { + msec: 1504 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Frame { + msec: 1520 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Frame { + msec: 1536 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Frame { + msec: 1552 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Key { + type: 7 + key: 87 + modifiers: 0 + text: "77" + autorep: false + count: 1 + } + Frame { + msec: 1568 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Frame { + msec: 1584 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Frame { + msec: 1600 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Frame { + msec: 1616 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Frame { + msec: 1632 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Frame { + msec: 1648 + hash: "1cf29837a4ea63bbb06c15382680d1b6" + } + Key { + type: 6 + key: 83 + modifiers: 0 + text: "73" + autorep: false + count: 1 + } + Frame { + msec: 1664 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Frame { + msec: 1680 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Frame { + msec: 1696 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Frame { + msec: 1712 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Frame { + msec: 1728 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Key { + type: 6 + key: 32 + modifiers: 0 + text: "20" + autorep: false + count: 1 + } + Frame { + msec: 1744 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Key { + type: 7 + key: 83 + modifiers: 0 + text: "73" + autorep: false + count: 1 + } + Frame { + msec: 1760 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Frame { + msec: 1776 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Frame { + msec: 1792 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Key { + type: 7 + key: 32 + modifiers: 0 + text: "20" + autorep: false + count: 1 + } + Frame { + msec: 1808 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Frame { + msec: 1824 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Frame { + msec: 1840 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Frame { + msec: 1856 + hash: "6eabb6d168ecc9ac604dcf2db0075380" + } + Key { + type: 6 + key: 76 + modifiers: 0 + text: "6c" + autorep: false + count: 1 + } + Frame { + msec: 1872 + hash: "cb2dc1c4fc4e213841b873561f404a4f" + } + Frame { + msec: 1888 + hash: "cb2dc1c4fc4e213841b873561f404a4f" + } + Frame { + msec: 1904 + hash: "cb2dc1c4fc4e213841b873561f404a4f" + } + Frame { + msec: 1920 + image: "echoMode.1.png" + } + Key { + type: 7 + key: 76 + modifiers: 0 + text: "6c" + autorep: false + count: 1 + } + Frame { + msec: 1936 + hash: "cb2dc1c4fc4e213841b873561f404a4f" + } + Frame { + msec: 1952 + hash: "cb2dc1c4fc4e213841b873561f404a4f" + } + Frame { + msec: 1968 + hash: "cb2dc1c4fc4e213841b873561f404a4f" + } + Frame { + msec: 1984 + hash: "cb2dc1c4fc4e213841b873561f404a4f" + } + Frame { + msec: 2000 + hash: "cb2dc1c4fc4e213841b873561f404a4f" + } + Frame { + msec: 2016 + hash: "cb2dc1c4fc4e213841b873561f404a4f" + } + Key { + type: 6 + key: 79 + modifiers: 0 + text: "6f" + autorep: false + count: 1 + } + Frame { + msec: 2032 + hash: "c2aff1ebdee69cca7dc67a102fce5e8e" + } + Frame { + msec: 2048 + hash: "c2aff1ebdee69cca7dc67a102fce5e8e" + } + Key { + type: 7 + key: 79 + modifiers: 0 + text: "6f" + autorep: false + count: 1 + } + Frame { + msec: 2064 + hash: "c2aff1ebdee69cca7dc67a102fce5e8e" + } + Frame { + msec: 2080 + hash: "c2aff1ebdee69cca7dc67a102fce5e8e" + } + Key { + type: 6 + key: 86 + modifiers: 0 + text: "76" + autorep: false + count: 1 + } + Frame { + msec: 2096 + hash: "c82441813af6ff577687f29f6a09da38" + } + Frame { + msec: 2112 + hash: "c82441813af6ff577687f29f6a09da38" + } + Frame { + msec: 2128 + hash: "c82441813af6ff577687f29f6a09da38" + } + Frame { + msec: 2144 + hash: "c82441813af6ff577687f29f6a09da38" + } + Key { + type: 6 + key: 69 + modifiers: 0 + text: "65" + autorep: false + count: 1 + } + Key { + type: 7 + key: 86 + modifiers: 0 + text: "76" + autorep: false + count: 1 + } + Frame { + msec: 2160 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Frame { + msec: 2176 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Frame { + msec: 2192 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Frame { + msec: 2208 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Key { + type: 6 + key: 32 + modifiers: 0 + text: "20" + autorep: false + count: 1 + } + Frame { + msec: 2224 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Key { + type: 7 + key: 69 + modifiers: 0 + text: "65" + autorep: false + count: 1 + } + Frame { + msec: 2240 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Frame { + msec: 2256 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Frame { + msec: 2272 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Frame { + msec: 2288 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Frame { + msec: 2304 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Key { + type: 7 + key: 32 + modifiers: 0 + text: "20" + autorep: false + count: 1 + } + Frame { + msec: 2320 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Frame { + msec: 2336 + hash: "d7da9862980b99e97a1fcd1b5c4c976f" + } + Key { + type: 6 + key: 77 + modifiers: 0 + text: "6d" + autorep: false + count: 1 + } + Frame { + msec: 2352 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Frame { + msec: 2368 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Frame { + msec: 2384 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Frame { + msec: 2400 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Frame { + msec: 2416 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Frame { + msec: 2432 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Key { + type: 7 + key: 77 + modifiers: 0 + text: "6d" + autorep: false + count: 1 + } + Frame { + msec: 2448 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Frame { + msec: 2464 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Frame { + msec: 2480 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Frame { + msec: 2496 + hash: "8f36e26d8685fe55e7a1dd294188f649" + } + Key { + type: 6 + key: 89 + modifiers: 0 + text: "79" + autorep: false + count: 1 + } + Frame { + msec: 2512 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2528 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2544 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Key { + type: 7 + key: 89 + modifiers: 0 + text: "79" + autorep: false + count: 1 + } + Frame { + msec: 2560 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2576 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2592 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2608 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2624 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2640 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2656 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2672 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2688 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2704 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2720 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2736 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2752 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2768 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2784 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2800 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2816 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2832 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2848 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2864 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2880 + image: "echoMode.2.png" + } + Frame { + msec: 2896 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2912 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2928 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2944 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2960 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2976 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 2992 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 3008 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 3024 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 3040 + hash: "316f2ba46d059755576e6822dc77afb2" + } + Frame { + msec: 3056 + hash: "316f2ba46d059755576e6822dc77afb2" + } +} diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/echoMode.qml b/tests/auto/declarative/visual/qmlgraphicstextinput/echoMode.qml new file mode 100644 index 0000000..b0b50e4 --- /dev/null +++ b/tests/auto/declarative/visual/qmlgraphicstextinput/echoMode.qml @@ -0,0 +1,10 @@ +import Qt 4.6 + +Item{ + height: 50; width: 200 + Column{ + //Not an exhaustive echo mode test, that's in QLineEdit (since the functionality is in QLineControl) + TextInput{ id: main; focus: true; echoMode: TextInput.Password } + Text{ text: main.text } + } +} -- cgit v0.12 From f81667cacadc0d7ffa18a19c4574cd43f3ad4272 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 20 Nov 2009 15:43:59 +1000 Subject: More SQL tests. Less non-spec functionality in API. --- src/declarative/qml/qmlsqldatabase.cpp | 127 +++------------------ tests/auto/declarative/sql/data/error-b.js | 13 +++ .../declarative/sql/data/error-notransaction.js | 15 +++ tests/auto/declarative/sql/data/readonly-error.js | 28 +++++ tests/auto/declarative/sql/data/readonly.js | 24 ++++ tests/auto/declarative/sql/data/reopen1.js | 14 +++ tests/auto/declarative/sql/data/reopen2.js | 16 +++ tests/auto/declarative/sql/sql.pro | 1 + tests/auto/declarative/sql/tst_sql.cpp | 84 ++++++++------ 9 files changed, 174 insertions(+), 148 deletions(-) create mode 100644 tests/auto/declarative/sql/data/error-b.js create mode 100644 tests/auto/declarative/sql/data/error-notransaction.js create mode 100644 tests/auto/declarative/sql/data/readonly-error.js create mode 100644 tests/auto/declarative/sql/data/readonly.js create mode 100644 tests/auto/declarative/sql/data/reopen1.js create mode 100644 tests/auto/declarative/sql/data/reopen2.js diff --git a/src/declarative/qml/qmlsqldatabase.cpp b/src/declarative/qml/qmlsqldatabase.cpp index dfe3982..933eb92 100644 --- a/src/declarative/qml/qmlsqldatabase.cpp +++ b/src/declarative/qml/qmlsqldatabase.cpp @@ -63,8 +63,6 @@ Q_DECLARE_METATYPE(QSqlDatabase) Q_DECLARE_METATYPE(QSqlQuery) -class QmlSqlQueryScriptClassPropertyIterator; - class QmlSqlQueryScriptClass: public QScriptClass { public: QmlSqlQueryScriptClass(QScriptEngine *engine) : QScriptClass(engine) @@ -75,22 +73,13 @@ public: QueryFlags queryProperty(const QScriptValue &object, const QScriptString &name, - QueryFlags flags, uint *id) + QueryFlags flags, uint *) { if (flags & HandlesReadAccess) { if (name == str_length) { return HandlesReadAccess; } else if (name == str_forwardOnly) { return flags; - } else { - bool ok; - qint32 pos = name.toString().toInt(&ok); - if (pos < 0 || !ok) - return 0; - QSqlQuery query = qscriptvalue_cast(object.data()); - *id = pos; - if (*id < (uint)query.size()) - return HandlesReadAccess; } } if (flags & HandlesWriteAccess) @@ -100,7 +89,7 @@ public: } QScriptValue property(const QScriptValue &object, - const QScriptString &name, uint id) + const QScriptString &name, uint) { QSqlQuery query = qscriptvalue_cast(object.data()); if (name == str_length) { @@ -117,15 +106,6 @@ public: } } else if (name == str_forwardOnly) { return query.isForwardOnly(); - } else { - if ((uint)query.at() == id || query.seek(id)) { // Qt 4.6 doesn't optimize seek(at()) - QSqlRecord r = query.record(); - QScriptValue row = engine()->newObject(); - for (int j=0; jundefinedValue(); } @@ -148,83 +128,15 @@ public: return QScriptValue::Undeletable; } - //QScriptClassPropertyIterator *newIterator(const QScriptValue &object); - private: QScriptString str_length; QScriptString str_forwardOnly; }; -/* -class QmlSqlQueryScriptClassPropertyIterator : public QScriptClassPropertyIterator -{ -public: - QmlSqlQueryScriptClassPropertyIterator(const QScriptValue &object) - : QScriptClassPropertyIterator(object) - { - toFront(); - } - - ~QmlSqlQueryScriptClassPropertyIterator() - { - } - - bool hasNext() const - { - QSqlQuery query = qscriptvalue_cast(object().data()); - return query.at() == m_index || query.seek(m_index); // Qt 4.6 doesn't optimize seek(at()) - } - - void next() - { - m_last = m_index; - ++m_index; - } +// If the spec changes to allow iteration, check git history... +// class QmlSqlQueryScriptClassPropertyIterator : public QScriptClassPropertyIterator - bool hasPrevious() const - { - return (m_index > 0); - } - - void previous() - { - --m_index; - m_last = m_index; - } - void toFront() - { - m_index = 0; - m_last = -1; - } - - void toBack() - { - QSqlQuery query = qscriptvalue_cast(object().data()); - m_index = query.size(); - m_last = -1; - } - - QScriptString name() const - { - return object().engine()->toStringHandle(QString::number(m_last)); - } - - uint id() const - { - return m_last; - } - -private: - int m_index; - int m_last; -}; - -QScriptClassPropertyIterator *QmlSqlQueryScriptClass::newIterator(const QScriptValue &object) -{ - return new QmlSqlQueryScriptClassPropertyIterator(object); -} -*/ enum SqlException { UNKNOWN_ERR, @@ -328,11 +240,10 @@ static QScriptValue qmlsqldatabase_executeSql_readonly(QScriptContext *context, { QString sql = context->argument(0).toString(); if (sql.startsWith(QLatin1String("SELECT"),Qt::CaseInsensitive)) { - qmlsqldatabase_executeSql(context,engine); + return qmlsqldatabase_executeSql(context,engine); } else { THROW_SQL(SYNTAX_ERR,QmlEngine::tr("Read-only Transaction")) } - return engine->undefinedValue(); } static QScriptValue qmlsqldatabase_change_version(QScriptContext *context, QScriptEngine *engine) @@ -380,7 +291,7 @@ static QScriptValue qmlsqldatabase_change_version(QScriptContext *context, QScri return engine->undefinedValue(); } -static QScriptValue qmlsqldatabase_transaction(QScriptContext *context, QScriptEngine *engine) +static QScriptValue qmlsqldatabase_transaction_shared(QScriptContext *context, QScriptEngine *engine, bool readOnly) { QSqlDatabase db = qscriptvalue_cast(context->thisObject()); QScriptValue callback = context->argument(0); @@ -388,7 +299,8 @@ static QScriptValue qmlsqldatabase_transaction(QScriptContext *context, QScriptE THROW_SQL(UNKNOWN_ERR,QmlEngine::tr("transaction: missing callback")); QScriptValue instance = engine->newObject(); - instance.setProperty(QLatin1String("executeSql"), engine->newFunction(qmlsqldatabase_executeSql,1)); + instance.setProperty(QLatin1String("executeSql"), + engine->newFunction(readOnly ? qmlsqldatabase_executeSql_readonly : qmlsqldatabase_executeSql,1)); QScriptValue tx = engine->newVariant(instance,qVariantFromValue(db)); db.transaction(); @@ -402,26 +314,13 @@ static QScriptValue qmlsqldatabase_transaction(QScriptContext *context, QScriptE return engine->undefinedValue(); } +static QScriptValue qmlsqldatabase_transaction(QScriptContext *context, QScriptEngine *engine) +{ + return qmlsqldatabase_transaction_shared(context,engine,false); +} static QScriptValue qmlsqldatabase_read_transaction(QScriptContext *context, QScriptEngine *engine) { - QSqlDatabase db = qscriptvalue_cast(context->thisObject()); - QScriptValue callback = context->argument(0); - if (!callback.isFunction()) - return engine->undefinedValue(); - - QScriptValue instance = engine->newObject(); - instance.setProperty(QLatin1String("executeSql"), engine->newFunction(qmlsqldatabase_executeSql_readonly,1)); - QScriptValue tx = engine->newVariant(instance,qVariantFromValue(db)); - - db.transaction(); - callback.call(QScriptValue(), QScriptValueList() << tx); - if (engine->hasUncaughtException()) { - db.rollback(); - } else { - if (!db.commit()) - db.rollback(); - } - return engine->undefinedValue(); + return qmlsqldatabase_transaction_shared(context,engine,true); } /* diff --git a/tests/auto/declarative/sql/data/error-b.js b/tests/auto/declarative/sql/data/error-b.js new file mode 100644 index 0000000..4dd0ecf --- /dev/null +++ b/tests/auto/declarative/sql/data/error-b.js @@ -0,0 +1,13 @@ +function test() { + var db = openDatabaseSync("QmlTestDB-error-b", "1.0", "Test database from Qt autotests", 1000000); + var r="transaction_not_finished"; + + db.transaction( + function(tx) { + tx.executeSql('INSERT INTO Greeting VALUES("junk","junk")'); + notexist[123] = "oops" + } + ); + + return r; +} diff --git a/tests/auto/declarative/sql/data/error-notransaction.js b/tests/auto/declarative/sql/data/error-notransaction.js new file mode 100644 index 0000000..b9cc647 --- /dev/null +++ b/tests/auto/declarative/sql/data/error-notransaction.js @@ -0,0 +1,15 @@ +function test() { + var db = openDatabaseSync("QmlTestDB-data/error-notransaction", "1.0", "Test database from Qt autotests", 1000000); + var r="transaction_not_finished"; + + try { + db.transaction(); + } catch (err) { + if (err.message == "transaction: missing callback") + r = "passed"; + else + r = "WRONG ERROR="+err.message; + } + + return r; +} diff --git a/tests/auto/declarative/sql/data/readonly-error.js b/tests/auto/declarative/sql/data/readonly-error.js new file mode 100644 index 0000000..ab82712 --- /dev/null +++ b/tests/auto/declarative/sql/data/readonly-error.js @@ -0,0 +1,28 @@ +function test() { + var r="transaction_not_finished"; + var db = openDatabaseSync("QmlTestDB-readonly-error", "1.0", "Test database from Qt autotests", 1000000); + + db.transaction( + function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)'); + tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]); + r = "passed"; + } + ); + + try { + db.readTransaction( + function(tx) { + tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]); + r = "FAILED"; + } + ); + } catch (err) { + if (err.message == "Read-only Transaction") + r = "passed"; + else + r = "WRONG ERROR="+err.message; + } + + return r; +} diff --git a/tests/auto/declarative/sql/data/readonly.js b/tests/auto/declarative/sql/data/readonly.js new file mode 100644 index 0000000..5ee862c --- /dev/null +++ b/tests/auto/declarative/sql/data/readonly.js @@ -0,0 +1,24 @@ +function test() { + var r="transaction_not_finished"; + var db = openDatabaseSync("QmlTestDB-readonly", "1.0", "Test database from Qt autotests", 1000000); + + db.transaction( + function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)'); + tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]); + r = "passed"; + } + ); + + db.readTransaction( + function(tx) { + var rs = tx.executeSql('SELECT * FROM Greeting'); + if (rs.rows.item(0).salutation == 'hello') + r = "passed"; + else + r = "FAILED"; + } + ); + + return r; +} diff --git a/tests/auto/declarative/sql/data/reopen1.js b/tests/auto/declarative/sql/data/reopen1.js new file mode 100644 index 0000000..c1a8157 --- /dev/null +++ b/tests/auto/declarative/sql/data/reopen1.js @@ -0,0 +1,14 @@ +function test() { + var r="transaction_not_finished"; + var db = openDatabaseSync("QmlTestDB-reopen", "1.0", "Test database from Qt autotests", 1000000); + + db.transaction( + function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)'); + tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]); + r = "passed"; + } + ); + + return r; +} diff --git a/tests/auto/declarative/sql/data/reopen2.js b/tests/auto/declarative/sql/data/reopen2.js new file mode 100644 index 0000000..4f7248f --- /dev/null +++ b/tests/auto/declarative/sql/data/reopen2.js @@ -0,0 +1,16 @@ +function test() { + var r="transaction_not_finished"; + var db = openDatabaseSync("QmlTestDB-reopen", "1.0", "Test database from Qt autotests", 1000000); + + db.transaction( + function(tx) { + var rs = tx.executeSql('SELECT * FROM Greeting'); + if (rs.rows.item(0).salutation == 'hello') + r = "passed"; + else + r = "FAILED"; + } + ); + + return r; +} diff --git a/tests/auto/declarative/sql/sql.pro b/tests/auto/declarative/sql/sql.pro index 48e06a2..875e9d8 100644 --- a/tests/auto/declarative/sql/sql.pro +++ b/tests/auto/declarative/sql/sql.pro @@ -1,5 +1,6 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative +QT += script macx:CONFIG -= app_bundle SOURCES += tst_sql.cpp diff --git a/tests/auto/declarative/sql/tst_sql.cpp b/tests/auto/declarative/sql/tst_sql.cpp index b5f98e3..d51b91c 100644 --- a/tests/auto/declarative/sql/tst_sql.cpp +++ b/tests/auto/declarative/sql/tst_sql.cpp @@ -43,10 +43,13 @@ #include #include #include +#include +#include #include #include #include #include +#include #include #include @@ -72,11 +75,11 @@ private slots: void checkDatabasePath(); - void validateAgainstWebkit_data(); - void validateAgainstWebkit(); - void testQml_data(); void testQml(); + void testQml_cleanopen_data(); + void testQml_cleanopen(); + void totalDatabases(); void cleanupTestCase(); @@ -109,7 +112,6 @@ void tst_sql::initTestCase() { removeRecursive(dbDir()); QDir().mkpath(dbDir()); - } void tst_sql::cleanupTestCase() @@ -131,44 +133,37 @@ void tst_sql::checkDatabasePath() QVERIFY(engine->offlineStoragePath().contains("OfflineStorage")); } +static const int total_databases_created_by_tests = 10; void tst_sql::testQml_data() { QTest::addColumn("jsfile"); // The input file - QTest::addColumn("result"); // The required output from the js test() function - QTest::addColumn("databases"); // The number of databases that should have been created - QTest::addColumn("qmlextension"); // Things WebKit can't do // Each test should use a newly named DB to avoid inter-test dependencies - QTest::newRow("creation") << "data/creation.js" << "passed" << 1 << false; - QTest::newRow("creation-a") << "data/creation-a.js" << "passed" << 2 << false; - QTest::newRow("changeversion") << "data/changeversion.js" << "passed" << 3 << false; - QTest::newRow("selection") << "data/selection.js" << "passed" << 4 << false; - QTest::newRow("selection-bindnames") << "data/selection-bindnames.js" << "passed" << 5 << true; - QTest::newRow("iteration") << "data/iteration.js" << "passed" << 6 << false; - QTest::newRow("error-a") << "data/error-a.js" << "passed" << 7 << false; -} - -void tst_sql::validateAgainstWebkit_data() -{ - QTest::addColumn("jsfile"); // The input file - QTest::addColumn("result"); // The required output from the js test() function - QTest::addColumn("databases"); // The number of databases that should have been created - QTest::addColumn("qmlextension"); // Things WebKit can't do - QTest::newRow("creation") << "data/creation.js" << "passed" << 1 << false; + QTest::newRow("creation") << "data/creation.js"; + QTest::newRow("creation-a") << "data/creation-a.js"; + QTest::newRow("changeversion") << "data/changeversion.js"; + QTest::newRow("readonly") << "data/readonly.js"; + QTest::newRow("readonly-error") << "data/readonly-error.js"; + QTest::newRow("selection") << "data/selection.js"; + QTest::newRow("selection-bindnames") << "data/selection-bindnames.js"; + QTest::newRow("iteration") << "data/iteration.js"; + QTest::newRow("error-a") << "data/error-a.js"; + QTest::newRow("error-notransaction") << "data/error-notransaction.js"; + QTest::newRow("reopen1") << "data/reopen1.js"; + QTest::newRow("reopen2") << "data/reopen2.js"; + + // If you add a test, you should usually use a new database in the + // test - in which case increment total_databases_created_by_tests above. } +/* void tst_sql::validateAgainstWebkit() { // Validates tests against WebKit (HTML5) support. // - QFETCH(QString, jsfile); QFETCH(QString, result); QFETCH(int, databases); - QFETCH(bool, qmlextension); - - if (qmlextension) // WebKit can't do it (yet?) - return; QFile f(jsfile); QVERIFY(f.open(QIODevice::ReadOnly)); @@ -180,14 +175,14 @@ void tst_sql::validateAgainstWebkit() QEXPECT_FAIL("","WebKit doesn't support openDatabaseSync yet", Continue); QCOMPARE(webpage.mainFrame()->evaluateJavaScript(js).toString(),result); - /* + QTest::qWait(100); // WebKit crashes if you quit it too fast QWebSecurityOrigin origin = webpage.mainFrame()->securityOrigin(); QList dbs = origin.databases(); QCOMPARE(dbs.count(), databases); - */ } +*/ void tst_sql::testQml() { @@ -195,8 +190,6 @@ void tst_sql::testQml() // that have been validated against Webkit. // QFETCH(QString, jsfile); - QFETCH(QString, result); - QFETCH(int, databases); QString qml= "import Qt 4.6\n" @@ -206,8 +199,31 @@ void tst_sql::testQml() QmlComponent component(engine, qml.toUtf8(), QUrl::fromLocalFile(SRCDIR "/empty.qml")); // just a file for relative local imports QmlGraphicsText *text = qobject_cast(component.create()); QVERIFY(text != 0); - QCOMPARE(text->text(),result); - QCOMPARE(QDir(dbDir()+"/Databases").entryInfoList(QDir::Files|QDir::NoDotAndDotDot).count(), databases*2); // *2 = .ini file + .sqlite file + QCOMPARE(text->text(),QString("passed")); +} + +void tst_sql::testQml_cleanopen_data() +{ + QTest::addColumn("jsfile"); // The input file + QTest::newRow("reopen1") << "data/reopen1.js"; + QTest::newRow("reopen2") << "data/reopen2.js"; +} + +void tst_sql::testQml_cleanopen() +{ + // Same as testQml, but clean connections between tests, + // making it more like the tests are running in new processes. + testQml(); + + QmlEnginePrivate::getScriptEngine(engine)->collectGarbage(); // close databases + foreach (QString dbname, QSqlDatabase::connectionNames()) { + QSqlDatabase::removeDatabase(dbname); + } +} + +void tst_sql::totalDatabases() +{ + QCOMPARE(QDir(dbDir()+"/Databases").entryInfoList(QDir::Files|QDir::NoDotAndDotDot).count(), total_databases_created_by_tests*2); } QTEST_MAIN(tst_sql) -- cgit v0.12 From d83126a49e9b061a545aa51500bc3e647dd4f624 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 20 Nov 2009 15:58:51 +1000 Subject: Update bad property. Add a read-only error too. --- .../declarative/animations/data/badproperty1.qml | 2 +- .../declarative/animations/data/badproperty2.qml | 24 ++++++++++++++++++++++ .../auto/declarative/animations/tst_animations.cpp | 12 ++++++++--- 3 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 tests/auto/declarative/animations/data/badproperty2.qml diff --git a/tests/auto/declarative/animations/data/badproperty1.qml b/tests/auto/declarative/animations/data/badproperty1.qml index df1a98d..6f31fe8 100644 --- a/tests/auto/declarative/animations/data/badproperty1.qml +++ b/tests/auto/declarative/animations/data/badproperty1.qml @@ -19,6 +19,6 @@ Rectangle { PropertyChanges { target: MyRect; border.color: "blue" } } transitions: Transition { - ColorAnimation { target: MyRect; to: "red"; property: "pen.colr"; duration: 1000 } + ColorAnimation { target: MyRect; to: "red"; property: "border.colr"; duration: 1000 } } } diff --git a/tests/auto/declarative/animations/data/badproperty2.qml b/tests/auto/declarative/animations/data/badproperty2.qml new file mode 100644 index 0000000..c7d1673 --- /dev/null +++ b/tests/auto/declarative/animations/data/badproperty2.qml @@ -0,0 +1,24 @@ +import Qt 4.6 + +Rectangle { + id: Wrapper + width: 240 + height: 320 + Rectangle { + id: MyRect + color: "red" + width: 50; height: 50 + x: 100; y: 100 + MouseRegion { + anchors.fill: parent + onClicked: if (Wrapper.state == "state1") Wrapper.state = ""; else Wrapper.state = "state1"; + } + } + states: State { + name: "state1" + PropertyChanges { target: MyRect; border.color: "blue" } + } + transitions: Transition { + ColorAnimation { target: MyRect; to: "red"; property: "border"; duration: 1000 } + } +} diff --git a/tests/auto/declarative/animations/tst_animations.cpp b/tests/auto/declarative/animations/tst_animations.cpp index 2506337..73bed79 100644 --- a/tests/auto/declarative/animations/tst_animations.cpp +++ b/tests/auto/declarative/animations/tst_animations.cpp @@ -295,9 +295,15 @@ void tst_animations::badProperties() //make sure we get a runtime error { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/badproperty1.qml")); - QTest::ignoreMessage(QtWarningMsg, "QML QmlColorAnimation (file://" SRCDIR "/data/badproperty1.qml:22:9) Cannot animate non-existant property \"pen.colr\""); - QmlGraphicsRectangle *rect = qobject_cast(c.create()); + + QmlComponent c1(&engine, QUrl("file://" SRCDIR "/data/badproperty1.qml")); + QTest::ignoreMessage(QtWarningMsg, "QML QmlColorAnimation (file://" SRCDIR "/data/badproperty1.qml:22:9) Cannot animate non-existant property \"border.colr\""); + QmlGraphicsRectangle *rect = qobject_cast(c1.create()); + QVERIFY(rect); + + QmlComponent c2(&engine, QUrl("file://" SRCDIR "/data/badproperty2.qml")); + QTest::ignoreMessage(QtWarningMsg, "QML QmlColorAnimation (file://" SRCDIR "/data/badproperty2.qml:22:9) Cannot animate read-only property \"border\""); + rect = qobject_cast(c2.create()); QVERIFY(rect); //### should we warn here are well? -- cgit v0.12 From 270ab71cc891b541f77176573c2db3e141aae938 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 20 Nov 2009 17:05:16 +1000 Subject: Fix painting onto devices with no system clip (eg. pixmaps). Move pixelCacheSize to PaintedItem (remove its "cacheSize"). --- .../graphicsitems/qmlgraphicspainteditem.cpp | 24 +++++++------ .../graphicsitems/qmlgraphicspainteditem_p.h | 7 ++-- .../graphicsitems/qmlgraphicswebview.cpp | 39 ---------------------- .../graphicsitems/qmlgraphicswebview_p.h | 4 --- 4 files changed, 18 insertions(+), 56 deletions(-) diff --git a/src/declarative/graphicsitems/qmlgraphicspainteditem.cpp b/src/declarative/graphicsitems/qmlgraphicspainteditem.cpp index b1b1210..2f467e7 100644 --- a/src/declarative/graphicsitems/qmlgraphicspainteditem.cpp +++ b/src/declarative/graphicsitems/qmlgraphicspainteditem.cpp @@ -223,10 +223,14 @@ void QmlGraphicsPaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem * } QRegion topaint = p->clipRegion(); - if (topaint.isEmpty()) - topaint = effectiveClip; - else + if (topaint.isEmpty()) { + if (effectiveClip.isEmpty()) + topaint = QRect(0,0,p->device()->width(),p->device()->height()); + else + topaint = effectiveClip; + } else { topaint &= effectiveClip; + } topaint &= content; QRegion uncached(content); @@ -323,27 +327,26 @@ void QmlGraphicsPaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem * } /*! - \qmlproperty int PaintedItem::cacheSize + \qmlproperty int PaintedItem::pixelCacheSize This property holds the maximum number of pixels of image cache to allow. The default is 0.1 megapixels. The cache will not be larger - than the (unscaled) size of the item. + than the (unscaled) size of the WebView. */ - /*! - \property QmlGraphicsPaintedItem::cacheSize + \property QmlGraphicsPaintedItem::pixelCacheSize The maximum number of pixels of image cache to allow. The default is 0.1 megapixels. The cache will not be larger than the (unscaled) size of the QmlGraphicsPaintedItem. */ -int QmlGraphicsPaintedItem::cacheSize() const +int QmlGraphicsPaintedItem::pixelCacheSize() const { Q_D(const QmlGraphicsPaintedItem); return d->max_imagecache_size; } -void QmlGraphicsPaintedItem::setCacheSize(int pixels) +void QmlGraphicsPaintedItem::setPixelCacheSize(int pixels) { Q_D(QmlGraphicsPaintedItem); if (pixels < d->max_imagecache_size) { @@ -369,6 +372,8 @@ void QmlGraphicsPaintedItem::setCacheSize(int pixels) d->max_imagecache_size = pixels; } + + /*! \property QmlGraphicsPaintedItem::fillColor @@ -419,5 +424,4 @@ void QmlGraphicsPaintedItem::setSmoothCache(bool on) } - QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qmlgraphicspainteditem_p.h b/src/declarative/graphicsitems/qmlgraphicspainteditem_p.h index 0805330..f6bb078 100644 --- a/src/declarative/graphicsitems/qmlgraphicspainteditem_p.h +++ b/src/declarative/graphicsitems/qmlgraphicspainteditem_p.h @@ -58,9 +58,10 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsPaintedItem : public QmlGraphicsItem Q_PROPERTY(QSize contentsSize READ contentsSize WRITE setContentsSize) Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor NOTIFY fillColorChanged) - Q_PROPERTY(int cacheSize READ cacheSize WRITE setCacheSize) + Q_PROPERTY(int pixelCacheSize READ pixelCacheSize WRITE setPixelCacheSize) Q_PROPERTY(bool smoothCache READ smoothCache WRITE setSmoothCache) + public: QmlGraphicsPaintedItem(QmlGraphicsItem *parent=0); ~QmlGraphicsPaintedItem(); @@ -68,8 +69,8 @@ public: QSize contentsSize() const; void setContentsSize(const QSize &); - int cacheSize() const; - void setCacheSize(int pixels); + int pixelCacheSize() const; + void setPixelCacheSize(int pixels); bool smoothCache() const; void setSmoothCache(bool on); diff --git a/src/declarative/graphicsitems/qmlgraphicswebview.cpp b/src/declarative/graphicsitems/qmlgraphicswebview.cpp index e165e59..aedf787 100644 --- a/src/declarative/graphicsitems/qmlgraphicswebview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicswebview.cpp @@ -434,45 +434,6 @@ void QmlGraphicsWebView::paintPage(const QRect& r) } /*! - \qmlproperty int WebView::pixelCacheSize - - This property holds the maximum number of pixels of image cache to - allow. The default is 0.1 megapixels. The cache will not be larger - than the (unscaled) size of the WebView. -*/ -int QmlGraphicsWebView::pixelCacheSize() const -{ - Q_D(const QmlGraphicsWebView); - return d->max_imagecache_size; -} - -void QmlGraphicsWebView::setPixelCacheSize(int pixels) -{ - Q_D(QmlGraphicsWebView); - if (pixels < d->max_imagecache_size) { - int cachesize=0; - for (int i=0; iimagecache.count(); ++i) { - QRect area = d->imagecache[i]->area; - cachesize += area.width()*area.height(); - } - while (d->imagecache.count() && cachesize > pixels) { - int oldest=-1; - int age=-1; - for (int i=0; iimagecache.count(); ++i) { - int a = d->imagecache[i]->age; - if (a > age) { - oldest = i; - age = a; - } - } - cachesize -= d->imagecache[oldest]->area.width()*d->imagecache[oldest]->area.height(); - d->imagecache.removeAt(oldest); - } - } - d->max_imagecache_size = pixels; -} - -/*! \qmlproperty list WebView::javaScriptWindowObjects This property is a list of object that are available from within diff --git a/src/declarative/graphicsitems/qmlgraphicswebview_p.h b/src/declarative/graphicsitems/qmlgraphicswebview_p.h index fa7d19d..17546c1 100644 --- a/src/declarative/graphicsitems/qmlgraphicswebview_p.h +++ b/src/declarative/graphicsitems/qmlgraphicswebview_p.h @@ -100,7 +100,6 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsWebView : public QmlGraphicsPaintedItem Q_PROPERTY(int preferredWidth READ preferredWidth WRITE setPreferredWidth NOTIFY preferredWidthChanged) Q_PROPERTY(int preferredHeight READ preferredHeight WRITE setPreferredHeight NOTIFY preferredHeightChanged) - Q_PROPERTY(int pixelCacheSize READ pixelCacheSize WRITE setPixelCacheSize) Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) Q_PROPERTY(Status status READ status NOTIFY statusChanged) @@ -166,9 +165,6 @@ public: QWebSettings *settings() const; QmlGraphicsWebSettings *settingsObject() const; - int pixelCacheSize() const; - void setPixelCacheSize(int pixels); - bool renderingEnabled() const; void setRenderingEnabled(bool); -- cgit v0.12 From e71d967fc4698882fc9573d398f149610c3abb02 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 20 Nov 2009 17:06:19 +1000 Subject: Test pixelCache. --- .../qmlgraphicswebview/data/pixelCache.html | 10 ++++++++ .../qmlgraphicswebview/data/pixelCache.qml | 8 ++++++ .../qmlgraphicswebview/qmlgraphicswebview.pro | 3 ++- .../qmlgraphicswebview/tst_qmlgraphicswebview.cpp | 30 ++++++++++++++++++++++ 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/qmlgraphicswebview/data/pixelCache.html create mode 100644 tests/auto/declarative/qmlgraphicswebview/data/pixelCache.qml diff --git a/tests/auto/declarative/qmlgraphicswebview/data/pixelCache.html b/tests/auto/declarative/qmlgraphicswebview/data/pixelCache.html new file mode 100644 index 0000000..bf059b9 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicswebview/data/pixelCache.html @@ -0,0 +1,10 @@ + + + +
+

Pixel Cache

+This test is for the pixel cache. Because this is a long document, +as it scrolls, more of the document will need to be rendered. +If the pixelCacheSize is small, the first parts of the document will +no longer be in the cache when it returns. +
diff --git a/tests/auto/declarative/qmlgraphicswebview/data/pixelCache.qml b/tests/auto/declarative/qmlgraphicswebview/data/pixelCache.qml new file mode 100644 index 0000000..3467c65 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicswebview/data/pixelCache.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyWebView { + width: 100 + height: 100 + anchors.fill: parent + url: "pixelCache.html" +} diff --git a/tests/auto/declarative/qmlgraphicswebview/qmlgraphicswebview.pro b/tests/auto/declarative/qmlgraphicswebview/qmlgraphicswebview.pro index cce3df2..c81912b 100644 --- a/tests/auto/declarative/qmlgraphicswebview/qmlgraphicswebview.pro +++ b/tests/auto/declarative/qmlgraphicswebview/qmlgraphicswebview.pro @@ -2,7 +2,8 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative macx:CONFIG -= app_bundle -SOURCES += tst_qmlgraphicswebview.cpp +SOURCES += tst_qmlgraphicswebview.cpp testtypes.cpp +HEADERS += testtypes.h # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp index da43e68..6bd28fb 100644 --- a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp +++ b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp @@ -49,6 +49,8 @@ #include #include #include +#include +#include "testtypes.h" class tst_qmlgraphicswebview : public QObject { @@ -66,6 +68,7 @@ private slots: void setHtml(); void javaScript(); void cleanupTestCase(); + void pixelCache(); private: void checkNoErrors(const QmlComponent& component); @@ -353,6 +356,33 @@ void tst_qmlgraphicswebview::javaScript() QCOMPARE(wv->evaluateJavaScript("window.myjsname.qmlprop").toString(), QString("qmlvalue")); } +void tst_qmlgraphicswebview::pixelCache() +{ + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/pixelCache.qml")); + checkNoErrors(component); + MyWebView *wv = qobject_cast(component.create()); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + QPixmap pm(150,150); + QPainter p(&pm); + wv->paint(&p,0,0); + const int expected = 120*(150+128); // 120 = width of HTML page, 150=pixmap height, 128=cache extra area + QCOMPARE(wv->pixelsPainted(), expected); + wv->paint(&p,0,0); + QCOMPARE(wv->pixelsPainted(), expected); // nothing new needed to be painted + wv->setPixelCacheSize(0); // clears the cache + wv->paint(&p,0,0); + QCOMPARE(wv->pixelsPainted(), expected*2); // everything needed to be painted + // Note that painted things always go into the cache (even if they don't "fit"), + // just that they will be removed if anything else needs to be painted. + wv->setPixelCacheSize(expected); // won't clear the cache + wv->paint(&p,0,0); + QCOMPARE(wv->pixelsPainted(), expected*2); // still there + wv->setPixelCacheSize(expected-1); // too small - will clear the cache + wv->paint(&p,0,0); + QCOMPARE(wv->pixelsPainted(), expected*3); // repainted +} + QTEST_MAIN(tst_qmlgraphicswebview) #include "tst_qmlgraphicswebview.moc" -- cgit v0.12 From fa4d5b7f1a94460e33862084eda5dacc99204a14 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 20 Nov 2009 17:12:34 +1000 Subject: Fix db count Test forwardOnly extension. --- .../declarative/sql/data/iteration-forwardonly.js | 29 ++++++++++++++++++++++ tests/auto/declarative/sql/tst_sql.cpp | 3 ++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/sql/data/iteration-forwardonly.js diff --git a/tests/auto/declarative/sql/data/iteration-forwardonly.js b/tests/auto/declarative/sql/data/iteration-forwardonly.js new file mode 100644 index 0000000..45947c0 --- /dev/null +++ b/tests/auto/declarative/sql/data/iteration-forwardonly.js @@ -0,0 +1,29 @@ +function test() { + var db = openDatabaseSync("QmlTestDB-iteration-forwardonly", "", "Test database from Qt autotests", 1000000); + var r="transaction_not_finished"; + + db.transaction( + function(tx) { + tx.executeSql('CREATE TABLE Greeting(salutation TEXT, salutee TEXT)'); + tx.executeSql('INSERT INTO Greeting VALUES ("Hello", "world")'); + tx.executeSql('INSERT INTO Greeting VALUES ("Goodbye", "cruel world")'); + } + ) + + db.transaction( + function(tx) { + var rs = tx.executeSql('SELECT * FROM Greeting'); + rs.forwardOnly = !rs.forwardOnly + var r1="" + for(var i = 0; i < rs.rows.length; i++) + r1 += rs.rows.item(i).salutation + ", " + rs.rows.item(i).salutee + ";" + if (r1 != "hello, world;hello, world;hello, world;hello, world;") + if (r1 != "Hello, world;Goodbye, cruel world;") + r = "SELECTED DATA WRONG: "+r1; + else + r = "passed"; + } + ); + + return r; +} diff --git a/tests/auto/declarative/sql/tst_sql.cpp b/tests/auto/declarative/sql/tst_sql.cpp index d51b91c..6fd4189 100644 --- a/tests/auto/declarative/sql/tst_sql.cpp +++ b/tests/auto/declarative/sql/tst_sql.cpp @@ -133,7 +133,7 @@ void tst_sql::checkDatabasePath() QVERIFY(engine->offlineStoragePath().contains("OfflineStorage")); } -static const int total_databases_created_by_tests = 10; +static const int total_databases_created_by_tests = 12; void tst_sql::testQml_data() { QTest::addColumn("jsfile"); // The input file @@ -147,6 +147,7 @@ void tst_sql::testQml_data() QTest::newRow("selection") << "data/selection.js"; QTest::newRow("selection-bindnames") << "data/selection-bindnames.js"; QTest::newRow("iteration") << "data/iteration.js"; + QTest::newRow("iteration-forwardonly") << "data/iteration-forwardonly.js"; QTest::newRow("error-a") << "data/error-a.js"; QTest::newRow("error-notransaction") << "data/error-notransaction.js"; QTest::newRow("reopen1") << "data/reopen1.js"; -- cgit v0.12 From 1b6bccf66f493844d940a9ea3353aa3ee308fc3d Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 20 Nov 2009 17:58:51 +1000 Subject: Check version for cached DB too. --- src/declarative/qml/qmlsqldatabase.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/declarative/qml/qmlsqldatabase.cpp b/src/declarative/qml/qmlsqldatabase.cpp index 933eb92..d11e3cb 100644 --- a/src/declarative/qml/qmlsqldatabase.cpp +++ b/src/declarative/qml/qmlsqldatabase.cpp @@ -350,6 +350,8 @@ static QScriptValue qmlsqldatabase_open_sync(QScriptContext *context, QScriptEng if (QSqlDatabase::connectionNames().contains(dbid)) { database = QSqlDatabase::database(dbid); version = ini.value(QLatin1String("Version")).toString(); + if (version != dbversion && !dbversion.isEmpty() && !version.isEmpty()) + THROW_SQL(VERSION_ERR,QmlEngine::tr("SQL: database version mismatch")); } else { created = !QFile::exists(basename+QLatin1String(".sqlite")); database = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"), dbid); -- cgit v0.12 From c80effb4d3612b68b2d48e3ec6245e2360c83228 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 20 Nov 2009 17:59:36 +1000 Subject: Test version mismatch checking --- tests/auto/declarative/sql/data/error-creation.js | 12 ++++++++++++ tests/auto/declarative/sql/tst_sql.cpp | 5 ++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/sql/data/error-creation.js diff --git a/tests/auto/declarative/sql/data/error-creation.js b/tests/auto/declarative/sql/data/error-creation.js new file mode 100644 index 0000000..92245fd --- /dev/null +++ b/tests/auto/declarative/sql/data/error-creation.js @@ -0,0 +1,12 @@ +function test() { + var r="transaction_not_finished"; + try { + var db = openDatabaseSync("QmlTestDB-creation", "2.0", "Test database from Qt autotests", 1000000); + } catch (err) { + if (err.message == "SQL: database version mismatch") + r = "passed"; + else + r = "WRONG ERROR="+err.message; + } + return r; +} diff --git a/tests/auto/declarative/sql/tst_sql.cpp b/tests/auto/declarative/sql/tst_sql.cpp index 6fd4189..4296279 100644 --- a/tests/auto/declarative/sql/tst_sql.cpp +++ b/tests/auto/declarative/sql/tst_sql.cpp @@ -141,6 +141,8 @@ void tst_sql::testQml_data() // Each test should use a newly named DB to avoid inter-test dependencies QTest::newRow("creation") << "data/creation.js"; QTest::newRow("creation-a") << "data/creation-a.js"; + QTest::newRow("creation") << "data/creation.js"; + QTest::newRow("error-creation") << "data/error-creation.js"; // re-uses above DB QTest::newRow("changeversion") << "data/changeversion.js"; QTest::newRow("readonly") << "data/readonly.js"; QTest::newRow("readonly-error") << "data/readonly-error.js"; @@ -151,7 +153,7 @@ void tst_sql::testQml_data() QTest::newRow("error-a") << "data/error-a.js"; QTest::newRow("error-notransaction") << "data/error-notransaction.js"; QTest::newRow("reopen1") << "data/reopen1.js"; - QTest::newRow("reopen2") << "data/reopen2.js"; + QTest::newRow("reopen2") << "data/reopen2.js"; // re-uses above DB // If you add a test, you should usually use a new database in the // test - in which case increment total_databases_created_by_tests above. @@ -208,6 +210,7 @@ void tst_sql::testQml_cleanopen_data() QTest::addColumn("jsfile"); // The input file QTest::newRow("reopen1") << "data/reopen1.js"; QTest::newRow("reopen2") << "data/reopen2.js"; + QTest::newRow("error-creation") << "data/error-creation.js"; // re-uses creation DB } void tst_sql::testQml_cleanopen() -- cgit v0.12 From feb925cfe6941caad8f059c9fbbb2b1fc28a2aab Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Fri, 20 Nov 2009 14:21:23 +0100 Subject: Fixed the start location of an UiArrayBinding to include the qualifiedId. Reviewed by: Roberto Raggi. --- src/declarative/qml/parser/qmljsast_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/parser/qmljsast_p.h b/src/declarative/qml/parser/qmljsast_p.h index b5f7264..388bc12 100644 --- a/src/declarative/qml/parser/qmljsast_p.h +++ b/src/declarative/qml/parser/qmljsast_p.h @@ -2653,7 +2653,7 @@ public: { kind = K; } virtual SourceLocation firstSourceLocation() const - { return lbracketToken; } + { return qualifiedId->identifierToken; } virtual SourceLocation lastSourceLocation() const { return rbracketToken; } -- cgit v0.12 From 48cbe8d9989b24ed8e34d24ef6c6ef8f107b6f4d Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 23 Nov 2009 08:17:58 +1000 Subject: missed files --- .../declarative/qmlgraphicswebview/testtypes.cpp | 49 +++++++++++++++++ .../declarative/qmlgraphicswebview/testtypes.h | 64 ++++++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 tests/auto/declarative/qmlgraphicswebview/testtypes.cpp create mode 100644 tests/auto/declarative/qmlgraphicswebview/testtypes.h diff --git a/tests/auto/declarative/qmlgraphicswebview/testtypes.cpp b/tests/auto/declarative/qmlgraphicswebview/testtypes.cpp new file mode 100644 index 0000000..e21f286 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicswebview/testtypes.cpp @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "testtypes.h" + +void MyWebView::drawContents(QPainter *p, const QRect &r) +{ + pp += r.width()*r.height(); + QmlGraphicsWebView::drawContents(p,r); +} + +QML_DEFINE_TYPE(Test,1,0,MyWebView,MyWebView); diff --git a/tests/auto/declarative/qmlgraphicswebview/testtypes.h b/tests/auto/declarative/qmlgraphicswebview/testtypes.h new file mode 100644 index 0000000..7ab7c78 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicswebview/testtypes.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef TESTTYPES_H +#define TESTTYPES_H + +#include + +class MyWebView : public QmlGraphicsWebView +{ + Q_OBJECT + Q_PROPERTY(int pixelsPainted READ pixelsPainted); + +public: + MyWebView() : pp(0) {} + + int pixelsPainted() const { return pp; } + + void drawContents(QPainter *p, const QRect &r); + +private: + int pp; +}; + +QML_DECLARE_TYPE(MyWebView); + +#endif // TESTTYPES_H -- cgit v0.12 From 5f0a3cd6dbae87b5944c3cb31fdc294fc0ac1163 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 23 Nov 2009 09:56:08 +1000 Subject: Remove deleted state operations from the state. --- src/declarative/util/qmlstate_p_p.h | 25 ++++++++- tests/auto/declarative/states/data/deleting.qml | 11 ++++ .../auto/declarative/states/data/deletingState.qml | 13 +++++ tests/auto/declarative/states/tst_states.cpp | 65 ++++++++++++++++++++++ 4 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/states/data/deleting.qml create mode 100644 tests/auto/declarative/states/data/deletingState.qml diff --git a/src/declarative/util/qmlstate_p_p.h b/src/declarative/util/qmlstate_p_p.h index 095a7d2..75eb3fd 100644 --- a/src/declarative/util/qmlstate_p_p.h +++ b/src/declarative/util/qmlstate_p_p.h @@ -102,7 +102,30 @@ public: QString name; QmlBinding *when; - QmlConcreteList operations; + + class OperationList; + struct OperationGuard : public QGuard + { + OperationGuard(QObject *obj, OperationList *l) : list(l) { (QGuard&)*this = obj; } + OperationList *list; + void objectDestroyed(QmlStateOperation *) { + // we assume priv will always be destroyed after objectDestroyed calls + list->removeOne(*this); + } + }; + + typedef QList GuardedOpList; + class OperationList : public GuardedOpList, public QmlList + { + public: + virtual void append(QmlStateOperation* v) { GuardedOpList::append(OperationGuard(v, this)); } + virtual void insert(int i, QmlStateOperation* v) { GuardedOpList::insert(i, OperationGuard(v, this)); } + virtual void clear() { GuardedOpList::clear(); } + virtual QmlStateOperation* at(int i) const { return GuardedOpList::at(i); } + virtual void removeAt(int i) { GuardedOpList::removeAt(i); } + virtual int count() const { return GuardedOpList::count(); } + }; + OperationList operations; QmlTransitionManager transitionManager; diff --git a/tests/auto/declarative/states/data/deleting.qml b/tests/auto/declarative/states/data/deleting.qml new file mode 100644 index 0000000..0c512dd --- /dev/null +++ b/tests/auto/declarative/states/data/deleting.qml @@ -0,0 +1,11 @@ +import Qt 4.6 +Rectangle { + id: MyRectangle + width: 100; height: 100 + color: "red" + states: State { + name: "blue" + PropertyChanges { target: MyRectangle; color: "blue"; objectName: "pc1" } + PropertyChanges { target: MyRectangle; radius: 5; objectName: "pc2" } + } +} diff --git a/tests/auto/declarative/states/data/deletingState.qml b/tests/auto/declarative/states/data/deletingState.qml new file mode 100644 index 0000000..9dc46a6 --- /dev/null +++ b/tests/auto/declarative/states/data/deletingState.qml @@ -0,0 +1,13 @@ +import Qt 4.6 +Rectangle { + id: MyRectangle + width: 100; height: 100 + color: "red" + StateGroup { + id: stateGroup + states: State { + name: "blue" + PropertyChanges { target: MyRectangle; color: "blue" } + } + } +} diff --git a/tests/auto/declarative/states/tst_states.cpp b/tests/auto/declarative/states/tst_states.cpp index a4da1f1..4847535 100644 --- a/tests/auto/declarative/states/tst_states.cpp +++ b/tests/auto/declarative/states/tst_states.cpp @@ -44,6 +44,7 @@ #include #include #include +#include class tst_states : public QObject { @@ -69,6 +70,8 @@ private slots: void explicitChanges(); void propertyErrors(); void incorrectRestoreBug(); + void deletingChange(); + void deletingState(); }; void tst_states::basicChanges() @@ -738,6 +741,68 @@ void tst_states::incorrectRestoreBug() QCOMPARE(rect->color(),QColor("green")); } +void tst_states::deletingChange() +{ + QmlEngine engine; + + QmlComponent rectComponent(&engine, SRCDIR "/data/deleting.qml"); + QmlGraphicsRectangle *rect = qobject_cast(rectComponent.create()); + QVERIFY(rect != 0); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + QCOMPARE(rect->radius(),qreal(5)); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("red")); + QCOMPARE(rect->radius(),qreal(0)); + + QmlPropertyChanges *pc = rect->findChild("pc1"); + QVERIFY(pc != 0); + delete pc; + + QmlState *state = rect->findChild(); + QVERIFY(state != 0); + QCOMPARE(state->changes()->count(), 1); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("red")); + QCOMPARE(rect->radius(),qreal(5)); + + delete rect; +} + +void tst_states::deletingState() +{ + QmlEngine engine; + + QmlComponent rectComponent(&engine, SRCDIR "/data/deletingState.qml"); + QmlGraphicsRectangle *rect = qobject_cast(rectComponent.create()); + QVERIFY(rect != 0); + + QmlStateGroup *sg = rect->findChild(); + QVERIFY(sg != 0); + QVERIFY(sg->findState("blue") != 0); + + sg->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + + sg->setState(""); + QCOMPARE(rect->color(),QColor("red")); + + QmlState *state = rect->findChild(); + QVERIFY(state != 0); + delete state; + + QVERIFY(sg->findState("blue") == 0); + + //### should we warn that state doesn't exist + sg->setState("blue"); + QCOMPARE(rect->color(),QColor("red")); + + delete rect; +} + QTEST_MAIN(tst_states) #include "tst_states.moc" -- cgit v0.12