Merge "Merge remote-tracking branch 'origin/5.11' into 5.12" into refs/staging/5.12

bb10
Liang Qi 2018-08-25 04:11:12 +00:00 committed by The Qt Project
commit 563c9eb4ee
6 changed files with 47 additions and 2 deletions

View File

@ -58,6 +58,8 @@
#include "private/qabstractanimation_p.h"
#include <type_traits>
#ifndef QT_NO_ANIMATION
QT_BEGIN_NAMESPACE
@ -104,7 +106,17 @@ public:
};
//this should make the interpolation faster
template<typename T> inline T _q_interpolate(const T &f, const T &t, qreal progress)
template<typename T>
typename std::enable_if<std::is_unsigned<T>::value, T>::type
_q_interpolate(const T &f, const T &t, qreal progress)
{
return T(f + t * progress - f * progress);
}
// the below will apply also to all non-arithmetic types
template<typename T>
typename std::enable_if<!std::is_unsigned<T>::value, T>::type
_q_interpolate(const T &f, const T &t, qreal progress)
{
return T(f + (t - f) * progress);
}

View File

@ -2789,7 +2789,7 @@ Qt::MouseButtons QTabletEvent::buttons() const
\header
\li Event Type
\li Description
\li Touch equence
\li Touch sequence
\row
\li Qt::ZoomNativeGesture
\li Magnification delta in percent.

View File

@ -43,6 +43,7 @@ private slots:
void keyValueAt();
void keyValues();
void duration();
void interpolation();
};
class TestableQVariantAnimation : public QVariantAnimation
@ -129,6 +130,30 @@ void tst_QVariantAnimation::duration()
QCOMPARE(anim.duration(), 500);
}
void tst_QVariantAnimation::interpolation()
{
QVariantAnimation unsignedAnim;
unsignedAnim.setStartValue(100u);
unsignedAnim.setEndValue(0u);
unsignedAnim.setDuration(100);
unsignedAnim.setCurrentTime(50);
QCOMPARE(unsignedAnim.currentValue().toUInt(), 50u);
QVariantAnimation signedAnim;
signedAnim.setStartValue(100);
signedAnim.setEndValue(0);
signedAnim.setDuration(100);
signedAnim.setCurrentTime(50);
QCOMPARE(signedAnim.currentValue().toInt(), 50);
QVariantAnimation pointAnim;
pointAnim.setStartValue(QPoint(100, 100));
pointAnim.setEndValue(QPoint(0, 0));
pointAnim.setDuration(100);
pointAnim.setCurrentTime(50);
QCOMPARE(pointAnim.currentValue().toPoint(), QPoint(50, 50));
}
QTEST_MAIN(tst_QVariantAnimation)
#include "tst_qvariantanimation.moc"

View File

@ -0,0 +1,2 @@
[timeZoneAbbreviation]
osx

View File

@ -0,0 +1,2 @@
[formatTimeZone]
osx

View File

@ -2467,6 +2467,10 @@ void tst_QLocale::currency()
QCOMPARE(de_DE.toCurrencyString(double(-1234.56), QLatin1String("BAZ")),
QString::fromUtf8("-1.234,56\xc2\xa0" "BAZ"));
const QLocale es_CR(QLocale::Spanish, QLocale::CostaRica);
QCOMPARE(es_CR.toCurrencyString(double(1565.25)),
QString::fromUtf8("\xE2\x82\xA1" "1\xC2\xA0" "565,25"));
const QLocale system = QLocale::system();
QVERIFY(system.toCurrencyString(1, QLatin1String("FOO")).contains(QLatin1String("FOO")));
}