From e7831cacd42f84eecff287c8df0b049f41b45bb7 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 9 Sep 2010 17:33:05 +1000 Subject: Fix SmoothedAnimation test and docs The SmoothedAnimation visual test was misleading, and has been expanded to include more common use cases. The property documentation was also slightly extended. This should help solve the confusion in the related task. Task-number: QTBUG-12114 --- .../util/qdeclarativesmoothedanimation.cpp | 8 +- .../data/smoothedfollow.0.png | Bin 0 -> 3692 bytes .../data/smoothedfollow.1.png | Bin 0 -> 3697 bytes .../data/smoothedfollow.2.png | Bin 0 -> 3696 bytes .../data/smoothedfollow.qml | 795 +++++++++++++++++++++ .../smoothedfollow.qml | 100 ++- 6 files changed, 896 insertions(+), 7 deletions(-) create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.0.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.1.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.2.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.qml diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp index c3fa7cf..fbd0762 100644 --- a/src/declarative/util/qdeclarativesmoothedanimation.cpp +++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp @@ -403,6 +403,9 @@ void QDeclarativeSmoothedAnimation::setReversingMode(ReversingMode m) This property holds the animation duration, in msecs, used when tracking the source. Setting this to -1 (the default) disables the duration value. + + If the velocity value and the duration value are both enabled, then the animation will + use whichever gives the shorter duration. */ int QDeclarativeSmoothedAnimation::duration() const { @@ -432,6 +435,9 @@ qreal QDeclarativeSmoothedAnimation::velocity() const The default velocity of SmoothedAnimation is 200 units/second. Setting this to -1 disables the velocity value. + + If the velocity value and the duration value are both enabled, then the animation will + use whichever gives the shorter duration. */ void QDeclarativeSmoothedAnimation::setVelocity(qreal v) { @@ -446,7 +452,7 @@ void QDeclarativeSmoothedAnimation::setVelocity(qreal v) /*! \qmlproperty int SmoothedAnimation::maximumEasingTime - This property specifies the maximum time, in msecs, an "eases" during the follow should take. + This property specifies the maximum time, in msecs, any "eases" during the follow should take. Setting this property causes the velocity to "level out" after at a time. Setting a negative value reverts to the normal mode of easing over the entire animation duration. diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.0.png b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.0.png new file mode 100644 index 0000000..bf02e1a Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.0.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.1.png b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.1.png new file mode 100644 index 0000000..ae71dc8 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.1.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.2.png b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.2.png new file mode 100644 index 0000000..6f631b0 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.2.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.qml b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.qml new file mode 100644 index 0000000..3124973 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.qml @@ -0,0 +1,795 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "2c6600b50a18c415032fa95fe5089da6" + } + Frame { + msec: 32 + hash: "aefd5a2570cc0252be102644ec1e49e3" + } + Frame { + msec: 48 + hash: "6183d0554a8b812bee02719dc4df21d1" + } + Frame { + msec: 64 + hash: "e1b3a94d033626338de0e04dba7b6df9" + } + Frame { + msec: 80 + hash: "7d1a5a265fb20ac4d741d76ab7b3a41f" + } + Frame { + msec: 96 + hash: "0ce7d2acda3e5ccb7b2364e2a7b409a4" + } + Frame { + msec: 112 + hash: "21f3a66ee80fcb2dd4dce0d1666aa4dd" + } + Frame { + msec: 128 + hash: "ea5b81ff2805210111cb388ab9be0d8f" + } + Frame { + msec: 144 + hash: "a8a54a3c524dcf6777b71d99ae2d50bd" + } + Frame { + msec: 160 + hash: "6b658c468af8a88e4a282d57fdcbc3b0" + } + Frame { + msec: 176 + hash: "986121c9d928cc9ceb912a975f75760a" + } + Frame { + msec: 192 + hash: "4bf3593d0edc4347cf77670a48ba4440" + } + Frame { + msec: 208 + hash: "ea00f25295fb019f949930fb7109ceb4" + } + Frame { + msec: 224 + hash: "ad6cc7563e2720c405842317d0ce731a" + } + Frame { + msec: 240 + hash: "8a03a1207cdb5bd92f5227b25a7b638e" + } + Frame { + msec: 256 + hash: "f355321aa47d18e8b6dde503565d0e97" + } + Frame { + msec: 272 + hash: "e18f671cac8e68948f32a468bf2630cf" + } + Frame { + msec: 288 + hash: "264bca92fba53f25439d240afef62880" + } + Frame { + msec: 304 + hash: "a1a226c73fb97d5302ce683f901ee5c4" + } + Frame { + msec: 320 + hash: "05578552476372fc58e463e84a147ddd" + } + Frame { + msec: 336 + hash: "0a3e0a651f9eb3e6a44a55a6786e60ff" + } + Frame { + msec: 352 + hash: "4ca362f079f96a01360ee8062fbb8238" + } + Frame { + msec: 368 + hash: "ba512c117d97ce16ff92d03ce2b08056" + } + Frame { + msec: 384 + hash: "8688355f0f97afe000d02f71c841d5dc" + } + Frame { + msec: 400 + hash: "a2ea6ad008da95a67d3bc70e11e3811d" + } + Frame { + msec: 416 + hash: "83bc9c444ab8618438dc2b8b14716f7b" + } + Frame { + msec: 432 + hash: "fafbba34fc8f9d33b559e6fcd0c5f1c6" + } + Frame { + msec: 448 + hash: "92d245951b759f74182602a7a337cb0f" + } + Frame { + msec: 464 + hash: "e0634d25088a6855df8d86d84fe37cd7" + } + Frame { + msec: 480 + hash: "7f4d05f4c3b1a365732e448f2c751740" + } + Frame { + msec: 496 + hash: "fcd6f55929f753f77b1617c0984b8690" + } + Frame { + msec: 512 + hash: "7e88f100a7012d739cd3c97c4e7f4b45" + } + Frame { + msec: 528 + hash: "8f9d029b3850ee2f11cdf6630d100682" + } + Frame { + msec: 544 + hash: "b915f712b24f187ee759b3337fb0df7a" + } + Frame { + msec: 560 + hash: "eae400a0c72d38156f7ae0f16ab9ee66" + } + Frame { + msec: 576 + hash: "e913a1e317cca355b06a393f44cc0243" + } + Frame { + msec: 592 + hash: "abf075ea63a6f5cce43c38e20dbcdbb2" + } + Frame { + msec: 608 + hash: "a6e85caa1eb933343a4605bc434e2841" + } + Frame { + msec: 624 + hash: "8e33e2582dd127d3f04017bf493b0ac6" + } + Frame { + msec: 640 + hash: "959e4062262bcc759abfc7b0bf3e10b6" + } + Frame { + msec: 656 + hash: "9529e2241df0d90ea640fdb3752b0837" + } + Frame { + msec: 672 + hash: "5595b64495996ce66b5f6892e9457456" + } + Frame { + msec: 688 + hash: "532259c3577553622093eba907ae82d3" + } + Frame { + msec: 704 + hash: "85c4332100b6f5256702b594c83f4eff" + } + Frame { + msec: 720 + hash: "b96292d85b12fa8e68c5de3deb29b980" + } + Frame { + msec: 736 + hash: "64febec9c8b58e2b93249f19c57b7aba" + } + Frame { + msec: 752 + hash: "88e588af29131cf942e02b1080e564e5" + } + Frame { + msec: 768 + hash: "07f911478be2f36d0c1b9cb878f4fe47" + } + Frame { + msec: 784 + hash: "8ffbf2381efefcbca413f6e3455018fb" + } + Frame { + msec: 800 + hash: "6e456af680e40799d3f38bdde29a85f9" + } + Frame { + msec: 816 + hash: "48a8dbc64d7823164c992f55b270115d" + } + Frame { + msec: 832 + hash: "a6d28eb1d0aafd387e35ca7b362bec53" + } + Frame { + msec: 848 + hash: "2e9f2b2ebf1b24f01fc986ded320d7c9" + } + Frame { + msec: 864 + hash: "d0cafd9be3263193c207c39eeb051bb8" + } + Frame { + msec: 880 + hash: "8dee1a5365fa3ccd7036c8afa6a805cc" + } + Frame { + msec: 896 + hash: "42f893afb80633f0ffb82f1725bb097f" + } + Frame { + msec: 912 + hash: "f466a404940abcd4c8f3180696da1a29" + } + Frame { + msec: 928 + hash: "e5746e33b3eb155a354bc5900b7593ee" + } + Frame { + msec: 944 + hash: "a1c2eb7048356f4ebc803d9d5439db24" + } + Frame { + msec: 960 + image: "smoothedfollow.0.png" + } + Frame { + msec: 976 + hash: "338aec0e679a8f2e79f6a5503dfbd6c3" + } + Frame { + msec: 992 + hash: "59321f1eb26c379e9e2a37b6890d922d" + } + Frame { + msec: 1008 + hash: "f37a821b9cf9f67fd011c6790a2757f0" + } + Frame { + msec: 1024 + hash: "c3f1b8722c616ecd55d8496e76a9bf06" + } + Frame { + msec: 1040 + hash: "ca6aff9addda2e3ac51e5e2013393365" + } + Frame { + msec: 1056 + hash: "17d1aa7821ce8169a3100a3cd3a0df2b" + } + Frame { + msec: 1072 + hash: "d85dd272f35868d6832316e862db4ec1" + } + Frame { + msec: 1088 + hash: "8bce5bdadfa974655dc7e020ad43edeb" + } + Frame { + msec: 1104 + hash: "b97f71587a5187d5175e5d9f1409c00a" + } + Frame { + msec: 1120 + hash: "53d438e601c25aebfd2ecb0064cdf5cc" + } + Frame { + msec: 1136 + hash: "18c43dd35b3e0d8f9ab5c8de3e48886a" + } + Frame { + msec: 1152 + hash: "e4ab585684d083de118b7862ef5cbd63" + } + Frame { + msec: 1168 + hash: "48ab046a2e2ca1a1225574b94925482e" + } + Frame { + msec: 1184 + hash: "c4bd06a5c329ef6975a60453f588bce7" + } + Frame { + msec: 1200 + hash: "864393a984dce3e9dd2daec56ddb3fe7" + } + Frame { + msec: 1216 + hash: "fcdf4cfcd8a6d8667868ba9633475fe0" + } + Frame { + msec: 1232 + hash: "5ac2b96158045c9b9eb35f1cbabe5b1f" + } + Frame { + msec: 1248 + hash: "83c409e5d3e6fe9e953d9ce14d731b3b" + } + Frame { + msec: 1264 + hash: "01805526b04e17b89238e7b929be48dd" + } + Frame { + msec: 1280 + hash: "4708345219b3732f9aaf8b40645f65d2" + } + Frame { + msec: 1296 + hash: "12716f84b6f648df2cbe08cfea58764c" + } + Frame { + msec: 1312 + hash: "6cce1e6354bd338f364bcca84a5fd081" + } + Frame { + msec: 1328 + hash: "c5da6f6b00402e0de00490792b963cdf" + } + Frame { + msec: 1344 + hash: "0eacadf69c0818e818abaf3aaf823aff" + } + Frame { + msec: 1360 + hash: "c68cd79bf0d329a3c672896b9ce2044d" + } + Frame { + msec: 1376 + hash: "26786f921ddddd9d2f975e1193943d2d" + } + Frame { + msec: 1392 + hash: "68c7c1779bb19ee5cd9370b5c06f4ce7" + } + Frame { + msec: 1408 + hash: "5e87c3e00ef7fab01c17d9e89c661aab" + } + Frame { + msec: 1424 + hash: "0b459122be303c38d3564dd7fea53fc1" + } + Frame { + msec: 1440 + hash: "3b13101a45b470fd04fa02f34548984b" + } + Frame { + msec: 1456 + hash: "6308fa1ed015bb698251af0d1b9be084" + } + Frame { + msec: 1472 + hash: "f219427d8fdf826f33351ba64db55d33" + } + Frame { + msec: 1488 + hash: "0c9ad8c5224d3cdefb8ac793cac3ca79" + } + Frame { + msec: 1504 + hash: "38438307162bceef76afb043c82b6a82" + } + Frame { + msec: 1520 + hash: "78b367e6bab0463fe08f5e634cfbced2" + } + Frame { + msec: 1536 + hash: "81e56f9d3bb9b360a07dc85697a59340" + } + Frame { + msec: 1552 + hash: "cef4fdb8c12485d3590e598090312297" + } + Frame { + msec: 1568 + hash: "8ea0c90a100c583558f92843030543cc" + } + Frame { + msec: 1584 + hash: "0037f0f17a50bdfe3bf0de810ff837f1" + } + Frame { + msec: 1600 + hash: "2b060ac0dfa045b916d3fd5ff6f84bfb" + } + Frame { + msec: 1616 + hash: "b20705dcc6176efd83cff6927991ff0a" + } + Frame { + msec: 1632 + hash: "0af69e490bdc54f27d3e50c1fdfd12a8" + } + Frame { + msec: 1648 + hash: "8e4cceadc01de5b51082889efabcbb7e" + } + Frame { + msec: 1664 + hash: "b64958786a7007686fb1734783d553f5" + } + Frame { + msec: 1680 + hash: "e0b9d98bb3a596fd235d58b6a761a0e0" + } + Frame { + msec: 1696 + hash: "1a5d7dc4dfd3ee86a36978d4effd299c" + } + Frame { + msec: 1712 + hash: "4946561f008635599651bf24b9aa0594" + } + Frame { + msec: 1728 + hash: "8427d33046af64c6e63939238c101e86" + } + Frame { + msec: 1744 + hash: "cdcfab5cea86c33f276c3613d76067c4" + } + Frame { + msec: 1760 + hash: "966005d62bd69b53d77459e5ab65116c" + } + Frame { + msec: 1776 + hash: "8a3c4ff083a973325c4ab09e09027ef6" + } + Frame { + msec: 1792 + hash: "737ffd6f52fa3d812ecaf835a30495af" + } + Frame { + msec: 1808 + hash: "6731007c97ba3ba60e73ab50803868e5" + } + Frame { + msec: 1824 + hash: "caa4ea08c5c330e77a7445cc1adf1666" + } + Frame { + msec: 1840 + hash: "73778bfbae55a81557a128acb4a197c8" + } + Frame { + msec: 1856 + hash: "7d8609f1336ddf4e25b505e54142114e" + } + Frame { + msec: 1872 + hash: "d8b4514d2bd77dbe67e27d400dc1a2f3" + } + Frame { + msec: 1888 + hash: "ac3e7040f1e9fc680f52f46d25eb3faa" + } + Frame { + msec: 1904 + hash: "509c21774f0fca9dde0657133a1cc363" + } + Frame { + msec: 1920 + image: "smoothedfollow.1.png" + } + Frame { + msec: 1936 + hash: "545bcb0c362a083ee698a5c8cd225014" + } + Frame { + msec: 1952 + hash: "77370c9b2880c55fecf07457dd0d455b" + } + Frame { + msec: 1968 + hash: "6c44209f31f5f010f1b3e05490468821" + } + Frame { + msec: 1984 + hash: "2dffac0c44e52f2984525d3d3700e6ed" + } + Frame { + msec: 2000 + hash: "d70f2db1b166b2de3bef74bc4bf94a80" + } + Frame { + msec: 2016 + hash: "50e4f6a82f498066fc9b6588762f59f9" + } + Frame { + msec: 2032 + hash: "956a7d7db9aef1b7abefac1a69622f02" + } + Frame { + msec: 2048 + hash: "13f19d5baefb6c8c9f71c16163663a27" + } + Frame { + msec: 2064 + hash: "076ff84405ddb29a12ed30d27cee558b" + } + Frame { + msec: 2080 + hash: "6af0261639f809da8f7e4831559596d3" + } + Frame { + msec: 2096 + hash: "a0500b18e99bfe3a48d52cc62b4a946b" + } + Frame { + msec: 2112 + hash: "bb0ea576c9136fb70720d4540731d2ca" + } + Frame { + msec: 2128 + hash: "d9b12ad9bf54d7db0ef1b36297a6dd6c" + } + Frame { + msec: 2144 + hash: "2de77e082872f072a849ba9ea93e3aec" + } + Frame { + msec: 2160 + hash: "69e186c3e8e6b2c75da2ca87043129da" + } + Frame { + msec: 2176 + hash: "0c2f23b0cbedb45a68f0cbe6132b4820" + } + Frame { + msec: 2192 + hash: "533bad00e5624611ea8a15d5fa98f0f2" + } + Frame { + msec: 2208 + hash: "d9c60bc821205aa4ea38d846e5b00f3a" + } + Frame { + msec: 2224 + hash: "d4de041edf15c6b6806d7f5992146711" + } + Frame { + msec: 2240 + hash: "100145df5271efaaee1d619bd50b69fc" + } + Frame { + msec: 2256 + hash: "22905b794fee24f3a25e4944d5505e96" + } + Frame { + msec: 2272 + hash: "aeed7adea08fe6e8b60310082cf87b6c" + } + Frame { + msec: 2288 + hash: "82bf8d40b6ed8aae9d6172eae76d1859" + } + Frame { + msec: 2304 + hash: "b1881778936744db3df0898638e4b0df" + } + Frame { + msec: 2320 + hash: "87195016996f8786a8a2430c54f13494" + } + Frame { + msec: 2336 + hash: "56f99b14320662b90eb10e77845bba30" + } + Frame { + msec: 2352 + hash: "69a84022d8d2b3cdb1d7eae6ce5ccef2" + } + Frame { + msec: 2368 + hash: "578ca8c66da6aa64392b253ab6cccbc0" + } + Frame { + msec: 2384 + hash: "4c2058e4708001f82f3bcb8110d6a54f" + } + Frame { + msec: 2400 + hash: "a838be752168bc6feb3151327147bb23" + } + Frame { + msec: 2416 + hash: "bf6cde06f0ee814cd4a23f3d43e7d270" + } + Frame { + msec: 2432 + hash: "9162ec43bc84261c0eb9ea2425da0b8a" + } + Frame { + msec: 2448 + hash: "7be19df0ee54f9bb31ebee2d786addc8" + } + Frame { + msec: 2464 + hash: "542a4c004f5b1b8efa7588b27cc2ba43" + } + Frame { + msec: 2480 + hash: "f9e2edd343be212a9679f1e2ad0e73b3" + } + Frame { + msec: 2496 + hash: "b6d4e9169fc4446cdbd3a36f485b943b" + } + Frame { + msec: 2512 + hash: "0d3b7a652a94162b71e88ed213559af4" + } + Frame { + msec: 2528 + hash: "9d4a2383a4d43ac94ff0a344f217b22d" + } + Frame { + msec: 2544 + hash: "719d402379c40de5cd6d4c8fa92f5472" + } + Frame { + msec: 2560 + hash: "78fb55f5b9c2033a91e41100229e4465" + } + Frame { + msec: 2576 + hash: "0a9ec91eee6c7c770ce2e414fa881229" + } + Frame { + msec: 2592 + hash: "5d9f81f1becf486a09f086e15a64d1f0" + } + Frame { + msec: 2608 + hash: "0f5e18af1eac31e6993ea2df51a143f0" + } + Frame { + msec: 2624 + hash: "08a292373756b06c3a624b8f3bf06236" + } + Frame { + msec: 2640 + hash: "f3c8101429753ce8f0ee094fe0db98ac" + } + Frame { + msec: 2656 + hash: "1603ad220d68ae0a2f613687533c2ebc" + } + Frame { + msec: 2672 + hash: "e2b8049d18fd36fff0180bd4bc199732" + } + Frame { + msec: 2688 + hash: "d1bfeadaa9046ec5013734938a8f4af1" + } + Frame { + msec: 2704 + hash: "3cb3a0e9dc73e76101288395ffeb2b7b" + } + Frame { + msec: 2720 + hash: "104a10e6bd48dacfedf5c98cf641ae93" + } + Frame { + msec: 2736 + hash: "f04a2985e7c203dd6fce46b60fcb23fc" + } + Frame { + msec: 2752 + hash: "30cb747f4604c208d7dc697d5fe2af6b" + } + Frame { + msec: 2768 + hash: "b9eca6ee8fe29351cadeb9a2caf36fa6" + } + Frame { + msec: 2784 + hash: "7bc56e712d713a00a684e07cf3d09907" + } + Frame { + msec: 2800 + hash: "0d7a5e2ff588b71e77abb72723c763b2" + } + Frame { + msec: 2816 + hash: "0d961843e54cbe5ba76c11bcd634bc39" + } + Frame { + msec: 2832 + hash: "6328b52965a002944c501d9888928caa" + } + Frame { + msec: 2848 + hash: "63e668a7688167b604b641929843d0cf" + } + Frame { + msec: 2864 + hash: "7f5e71332268be68de9dcb25f173d2e0" + } + Frame { + msec: 2880 + image: "smoothedfollow.2.png" + } + Frame { + msec: 2896 + hash: "dc6e83fcc5a403913a94c498f1571098" + } + Frame { + msec: 2912 + hash: "8deb275bd08df9b3abdcf3e2796a0601" + } + Frame { + msec: 2928 + hash: "6c08a25a442b97a8cb359792b6a01641" + } + Frame { + msec: 2944 + hash: "5f7ccd5706c77f0b0ddced41ed6352d8" + } + Frame { + msec: 2960 + hash: "6668d1936524f0fdc490720a962a3698" + } + Frame { + msec: 2976 + hash: "e36f901fb4b8ad754592642a7575e4ee" + } + Frame { + msec: 2992 + hash: "7453182980e458d827f3ff83aa3f2c88" + } + Frame { + msec: 3008 + hash: "0e15d75b2a7f2e4a39906093b930d6a8" + } + Frame { + msec: 3024 + hash: "822ccc6c629eabf38fd5ac56abb638f5" + } + Frame { + msec: 3040 + hash: "331ef5b3e3dd5642f8532d337fd22def" + } + Frame { + msec: 3056 + hash: "3c29aae83f28239f31125ef02f523d02" + } + Frame { + msec: 3072 + hash: "56ed674bf2d345861eb235a4239078e2" + } + Frame { + msec: 3088 + hash: "5412b9ad01a6780b67bc59b80a274cd5" + } + Frame { + msec: 3104 + hash: "a6f9ae09a7386f06a84c251083660dd6" + } + Frame { + msec: 3120 + hash: "83f07277c9bec7419dd6a4d40d8accf7" + } + Frame { + msec: 3136 + hash: "e6cb74961dfef68a32f255176e0ebff3" + } + Frame { + msec: 3152 + hash: "9e6c3ac0190beaf30754155a5d64b81c" + } +} diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml index 0df727b..63dba47 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml @@ -1,15 +1,15 @@ import Qt 4.7 Rectangle { - width: 800; height: 240; color: "gray" + width: 800; height: 720; color: "gray" Rectangle { id: rect width: 50; height: 20; y: 30; color: "black" SequentialAnimation on x { loops: Animation.Infinite - NumberAnimation { from: 50; to: 700; duration: 2000 } - NumberAnimation { from: 700; to: 50; duration: 2000 } + NumberAnimation { from: 50; to: 700; duration: 1000 } + NumberAnimation { from: 700; to: 50; duration: 1000 } } } @@ -25,16 +25,104 @@ Rectangle { Rectangle { width: 50; height: 20; x: rect.x; y: 120; color: "green" - Behavior on x { SmoothedAnimation { reversingMode: SmoothedAnimation.Sync } } + Behavior on x { SmoothedAnimation { velocity: 200; reversingMode: SmoothedAnimation.Sync } } } Rectangle { width: 50; height: 20; x: rect.x; y: 150; color: "purple" - Behavior on x { SmoothedAnimation { maximumEasingTime: 200 } } + Behavior on x { SmoothedAnimation { velocity: 200; maximumEasingTime: 100 } } } Rectangle { width: 50; height: 20; x: rect.x; y: 180; color: "blue" - Behavior on x { SmoothedAnimation { duration: 300 } } + Behavior on x { SmoothedAnimation { velocity: -1; duration: 300 } } + } + + //rect2 has jerky movement, but the rects following it should be smooth + Rectangle { + id: rect2 + property int dir: 1 + width: 50; height: 20; x:50; y: 240; color: "black" + function advance(){ + if(x >= 700) + dir = -1; + if(x <= 50) + dir = 1; + x += 130.0 * dir; + } + } + Timer{ + interval: 200 + running: true + repeat: true + onTriggered: rect2.advance(); + } + + Rectangle { + width: 50; height: 20; x: rect2.x; y: 270; color: "red" + Behavior on x { SmoothedAnimation { velocity: 400 } } + } + + Rectangle { + width: 50; height: 20; x: rect2.x; y: 300; color: "yellow" + Behavior on x { SmoothedAnimation { velocity: 300; reversingMode: SmoothedAnimation.Immediate } } + } + + Rectangle { + width: 50; height: 20; x: rect2.x; y: 330; color: "green" + Behavior on x { SmoothedAnimation { velocity: 200; reversingMode: SmoothedAnimation.Sync } } + } + + Rectangle { + width: 50; height: 20; x: rect2.x; y: 360; color: "purple" + Behavior on x { SmoothedAnimation { velocity: 200; maximumEasingTime: 100 } } + } + + Rectangle { + width: 50; height: 20; x: rect2.x; y: 390; color: "blue" + Behavior on x { SmoothedAnimation { velocity: -1; duration: 300 } } + } + + //rect3 just jumps , but the rects following it should be smooth + Rectangle { + id: rect3 + width: 50; height: 20; x:50; y: 480; color: "black" + function advance(){ + if(x == 50) + x = 700; + else + x = 50; + } + } + Timer{ + interval: 1000 + running: true + repeat: true + onTriggered: rect3.advance(); + } + + Rectangle { + width: 50; height: 20; x: rect3.x; y: 510; color: "red" + Behavior on x { SmoothedAnimation { velocity: 400 } } + } + + Rectangle { + width: 50; height: 20; x: rect3.x; y: 540; color: "yellow" + Behavior on x { SmoothedAnimation { velocity: 300; reversingMode: SmoothedAnimation.Immediate } } + } + + Rectangle { + width: 50; height: 20; x: rect3.x; y: 570; color: "green" + Behavior on x { SmoothedAnimation { velocity: 200; reversingMode: SmoothedAnimation.Sync } } + } + + Rectangle { + width: 50; height: 20; x: rect3.x; y: 600; color: "purple" + Behavior on x { SmoothedAnimation { velocity: 200; maximumEasingTime: 100 } } + } + + Rectangle { + width: 50; height: 20; x: rect3.x; y: 630; color: "blue" + Behavior on x { SmoothedAnimation { velocity: -1; duration: 300 } } } } -- cgit v0.12