void tst_QAnimationGroup::beginNestedGroup()
{
- QAnimationGroup *subGroup;
QAnimationGroup *parent = new QParallelAnimationGroup();
for (int i = 0; i < 10; ++i) {
- if (i & 1)
- subGroup = new QParallelAnimationGroup(parent);
- else
- subGroup = new QSequentialAnimationGroup(parent);
+ if (i & 1) {
+ new QParallelAnimationGroup(parent);
+ } else {
+ new QSequentialAnimationGroup(parent);
+ }
QCOMPARE(parent->animationCount(), 1);
QAnimationGroup *child = static_cast<QAnimationGroup *>(parent->animationAt(0));
{
ResultStore<int> store;
- ResultIteratorBase it = store.begin();
QVERIFY(store.begin() == store.end());
QVERIFY(store.resultAt(0) == store.end());
QVERIFY(store.resultAt(1) == store.end());
bool shouldThrottleThread()
{
- return (iterations > 100 && iterations < 200);
+ const int load = iterations.load();
+ return (load > 100 && load < 200);
}
bool throttling;
};
// test Q_DECLARE_OPERATORS_FOR_FLAGS
QtConcurrent::ReduceOptions opt = (QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce);
+ QVERIFY(opt);
// functor-functor
{
{
{
ResultStore<int> store;
- ResultIteratorBase it = store.begin();
QVERIFY(store.begin() == store.end());
QVERIFY(store.resultAt(0) == store.end());
QVERIFY(store.resultAt(1) == store.end());
{
QMetaObjectBuilder builder;
- QMetaMethodBuilder method1 = builder.addSignal("foo(const QString&, int)");
- QMetaMethodBuilder method2 = builder.addSignal("bar(QString)");
+ builder.addSignal("foo(const QString&, int)");
+ QMetaMethodBuilder method = builder.addSignal("bar(QString)");
// Setup property
QMetaPropertyBuilder prop = builder.addProperty("prop", "const QString &");
- prop.setNotifySignal(method2);
+ prop.setNotifySignal(method);
QVERIFY(prop.hasNotifySignal());
QCOMPARE(prop.notifySignal().index(), 1);
NATIVESOCKETENGINE readEnd1;
readEnd1.initialize(QAbstractSocket::TcpSocket);
- bool b = readEnd1.connectToHost(server.serverAddress(), server.serverPort());
+ readEnd1.connectToHost(server.serverAddress(), server.serverPort());
QVERIFY(readEnd1.waitForWrite());
-// while (!b && readEnd1.state() != QAbstractSocket::ConnectedState)
-// b = readEnd1.connectToHost(server.serverAddress(), server.serverPort());
QVERIFY(readEnd1.state() == QAbstractSocket::ConnectedState);
QVERIFY(server.waitForNewConnection());
QTcpSocket *writeEnd1 = server.nextPendingConnection();
NATIVESOCKETENGINE readEnd2;
readEnd2.initialize(QAbstractSocket::TcpSocket);
- b = readEnd2.connectToHost(server.serverAddress(), server.serverPort());
+ readEnd2.connectToHost(server.serverAddress(), server.serverPort());
QVERIFY(readEnd2.waitForWrite());
-// while (!b)
-// b = readEnd2.connectToHost(server.serverAddress(), server.serverPort());
QVERIFY(readEnd2.state() == QAbstractSocket::ConnectedState);
QVERIFY(server.waitForNewConnection());
QTcpSocket *writeEnd2 = server.nextPendingConnection();
m_timer.stop();
- QTime now = QTime::currentTime();
int elapsed = m_startedTime.elapsed();
if (elapsed < m_interval / 2) {
quint64 i = 0;
while (t.elapsed() < one_minute) {
i++;
- uint nb = (i * 9 + lockCount * 13) % threadCount;
+ uint nb = (i * 9 + lockCount.load() * 13) % threadCount;
QMutexLocker locker(&mutex[nb]);
- if (sentinel[nb]) errorCount.ref();
+ if (sentinel[nb].load()) errorCount.ref();
if (sentinel[nb].fetchAndAddRelaxed(5)) errorCount.ref();
if (!sentinel[nb].testAndSetRelaxed(5, 0)) errorCount.ref();
- if (sentinel[nb]) errorCount.ref();
+ if (sentinel[nb].load()) errorCount.ref();
lockCount.ref();
- nb = (nb * 17 + i * 5 + lockCount * 3) % threadCount;
+ nb = (nb * 17 + i * 5 + lockCount.load() * 3) % threadCount;
if (mutex[nb].tryLock()) {
- if (sentinel[nb]) errorCount.ref();
+ if (sentinel[nb].load()) errorCount.ref();
if (sentinel[nb].fetchAndAddRelaxed(16)) errorCount.ref();
if (!sentinel[nb].testAndSetRelaxed(16, 0)) errorCount.ref();
- if (sentinel[nb]) errorCount.ref();
+ if (sentinel[nb].load()) errorCount.ref();
lockCount.ref();
mutex[nb].unlock();
}
- nb = (nb * 15 + i * 47 + lockCount * 31) % threadCount;
+ nb = (nb * 15 + i * 47 + lockCount.load() * 31) % threadCount;
if (mutex[nb].tryLock(2)) {
- if (sentinel[nb]) errorCount.ref();
+ if (sentinel[nb].load()) errorCount.ref();
if (sentinel[nb].fetchAndAddRelaxed(53)) errorCount.ref();
if (!sentinel[nb].testAndSetRelaxed(53, 0)) errorCount.ref();
- if (sentinel[nb]) errorCount.ref();
+ if (sentinel[nb].load()) errorCount.ref();
lockCount.ref();
mutex[nb].unlock();
}
QVERIFY(ok);
QVERIFY(d == -INFINITY);
- long l;
- l = QString("INF").toLong(&ok);
+ QString("INF").toLong(&ok);
QVERIFY(!ok);
- l = QString("INF").toLong(&ok, 36);
+ QString("INF").toLong(&ok, 36);
QVERIFY(ok);
- l = QString("INF0").toLong(&ok, 36);
+ QString("INF0").toLong(&ok, 36);
QVERIFY(ok);
- l = QString("0INF0").toLong(&ok, 36);
+ QString("0INF0").toLong(&ok, 36);
QVERIFY(ok);
}
public:
VirtualObject() :success(true) {}
- QString introspect(const QString &path) const
+ QString introspect(const QString & /* path */) const
{
return QString();
}
void tst_QDBusThreading::joinThreads()
{
- threadJoin.acquire(threadJoinCount);
- threadJoinCount = 0;
+ threadJoin.acquire(threadJoinCount.load());
+ threadJoinCount.store(0);
}
bool tst_QDBusThreading::waitForSignal(QObject *obj, const char *signal, int delay)
{
QImageReader reader(prefix + fileName);
- QSize size = reader.size();
+ reader.size();
formatB = reader.format();
}
pb1.show(); // Must be show for QShortcutMap::correctSubWindow to trigger
pb2.show();
- QShortcut *cut1 = setupShortcut(&pb1, "shortcut1-pb1", TriggerSlot1, "M");
- QShortcut *cut2 = setupShortcut(&pb1, "shortcut2-pb2", TriggerSlot2, "M");
+ setupShortcut(&pb1, "shortcut1-pb1", TriggerSlot1, "M");
+ setupShortcut(&pb1, "shortcut2-pb2", TriggerSlot2, "M");
currentResult = NoResult;
sendKeyEvents( Qt::Key_M, 'm' );
QCOMPARE( ambigResult, Slot1Triggered );
clearAllShortcuts();
- cut1 = 0; cut2 = 0;
}
QKeySequence ks1("Ctrl+M"); // Unicode
QKeySequence ks2(Qt::CTRL+Qt::Key_M); // non-Unicode
- QShortcut *cut1 = setupShortcut(&pb1, "shortcut1-pb1", TriggerSlot1, ks1);
- QShortcut *cut2 = setupShortcut(&pb1, "shortcut2-pb2", TriggerSlot2, ks2);
+ setupShortcut(&pb1, "shortcut1-pb1", TriggerSlot1, ks1);
+ setupShortcut(&pb1, "shortcut2-pb2", TriggerSlot2, ks2);
currentResult = NoResult;
sendKeyEvents( Qt::CTRL+Qt::Key_M, 0 );
QVERIFY( !(ks1 != ks2) );
clearAllShortcuts();
- cut1 = 0; cut2 = 0;
}
// ------------------------------------------------------------------
cursor.movePosition(QTextCursor::NextBlock);
block = cursor.block();
- QTextBlock hr = block;
QVERIFY(qMax(first.blockFormat().bottomMargin(), block.blockFormat().topMargin()) > 0);
cursor.movePosition(QTextCursor::NextBlock);
font.setCapitalization(QFont::AllUppercase);
QTextLayout layout("Test", font);
layout.beginLayout();
- QTextLine line = layout.createLine();
+ layout.createLine();
layout.endLayout();
QTextEngine *engine = layout.engine();
font.setCapitalization(QFont::AllLowercase);
QTextLayout layout("Test", font);
layout.beginLayout();
- QTextLine line = layout.createLine();
+ layout.createLine();
layout.endLayout();
QTextEngine *engine = layout.engine();
font.setCapitalization(QFont::SmallCaps);
QTextLayout layout("Test", font);
layout.beginLayout();
- QTextLine line = layout.createLine();
+ layout.createLine();
layout.endLayout();
QTextEngine *engine = layout.engine();
font.setCapitalization(QFont::Capitalize);
QTextLayout layout("hello\tworld", font);
layout.beginLayout();
- QTextLine line = layout.createLine();
+ layout.createLine();
layout.endLayout();
QTextEngine *engine = layout.engine();
void tst_Collections::cache()
{
{
- CacheFoo* cf;
QCache<int, CacheFoo> cache(120);
int i;
for (i = 0; i < 30; i++) {
- cf = cache.object(10);
+ cache.object(10);
cache.insert(i, new CacheFoo(i), i);
}
constIt = constContainer.end();
container.constEnd();
+ Q_UNUSED(constIt)
#endif
container.clear();
container.contains(value);
typename ContainerType::iterator it;
it = container.begin();
it = container.end();
+ Q_UNUSED(it)
#endif
// QSet lacks count(T).
Persistent<Context> context = Context::New();
Context::Scope context_scope(context);
- Local<String> str = String::NewExternal(new MyStringResource);
+ String::NewExternal(new MyStringResource);
Local<FunctionTemplate> ft = FunctionTemplate::New();
ft->InstanceTemplate()->SetHasExternalResource(true);
if (!fullPath.endsWith(QLatin1Char('/')))
fullPath.append(QLatin1Char('/'));
fullPath.append(input);
- bool inputStartsWithRootPath = false;
if (input.startsWith(QDir::rootPath())) {
fullPath = input;
input.clear();
- inputStartsWithRootPath = true;
}
QFileInfo fi(fullPath);
button = QMessageBox::Default;
button = QMessageBox::Escape;
button = QMessageBox::FlagMask;
+ QVERIFY(button);
const QString text = QStringLiteral("Foo");
mb1.setText(text);
break;
}
case QEvent::Resize: {
- QSize oldSize = widget->size();
QSize newSize = QSize(100, 100);
if (fromObject) {
widget->resize(newSize);
break;
}
case QEvent::Move: {
- QPoint oldPoint = widget->pos();
QPoint newPoint = QPoint(100, 100);
if (fromObject) {
widget->move(newPoint);
QTest::addColumn<bool>("moveCombo");
QTest::addColumn<QPoint>("comboPos");
QTest::addColumn<QPointF>("proxyPos");
- QTest::addColumn<QPointF>("menuPos");
-
- QTest::newRow("0") << true << QPoint() << QPointF() << QPointF();
- QTest::newRow("1") << true << QPoint(10, 0) << QPointF(10, 0) << QPointF();
- QTest::newRow("2") << true << QPoint(100, 0) << QPointF(100, 0) << QPointF();
- QTest::newRow("3") << true << QPoint(1000, 0) << QPointF(1000, 0) << QPointF();
- QTest::newRow("4") << true << QPoint(10000, 0) << QPointF(10000, 0) << QPointF();
- QTest::newRow("5") << true << QPoint(-10000, 0) << QPointF(-10000, 0) << QPointF();
- QTest::newRow("6") << true << QPoint(-1000, 0) << QPointF(-1000, 0) << QPointF();
- QTest::newRow("7") << true << QPoint(-100, 0) << QPointF(-100, 0) << QPointF();
- QTest::newRow("8") << true << QPoint(-10, 0) << QPointF(-10, 0) << QPointF();
- QTest::newRow("0-") << false << QPoint() << QPointF() << QPointF();
- QTest::newRow("1-") << false << QPoint(10, 0) << QPointF(10, 0) << QPointF();
- QTest::newRow("2-") << false << QPoint(100, 0) << QPointF(100, 0) << QPointF();
- QTest::newRow("3-") << false << QPoint(1000, 0) << QPointF(1000, 0) << QPointF();
- QTest::newRow("4-") << false << QPoint(10000, 0) << QPointF(10000, 0) << QPointF();
- QTest::newRow("5-") << false << QPoint(-10000, 0) << QPointF(-10000, 0) << QPointF();
- QTest::newRow("6-") << false << QPoint(-1000, 0) << QPointF(-1000, 0) << QPointF();
- QTest::newRow("7-") << false << QPoint(-100, 0) << QPointF(-100, 0) << QPointF();
- QTest::newRow("8-") << false << QPoint(-10, 0) << QPointF(-10, 0) << QPointF();
+
+ QTest::newRow("0") << true << QPoint() << QPointF();
+ QTest::newRow("1") << true << QPoint(10, 0) << QPointF(10, 0);
+ QTest::newRow("2") << true << QPoint(100, 0) << QPointF(100, 0);
+ QTest::newRow("3") << true << QPoint(1000, 0) << QPointF(1000, 0);
+ QTest::newRow("4") << true << QPoint(10000, 0) << QPointF(10000, 0);
+ QTest::newRow("5") << true << QPoint(-10000, 0) << QPointF(-10000, 0);
+ QTest::newRow("6") << true << QPoint(-1000, 0) << QPointF(-1000, 0);
+ QTest::newRow("7") << true << QPoint(-100, 0) << QPointF(-100, 0);
+ QTest::newRow("8") << true << QPoint(-10, 0) << QPointF(-10, 0);
+ QTest::newRow("0-") << false << QPoint() << QPointF();
+ QTest::newRow("1-") << false << QPoint(10, 0) << QPointF(10, 0);
+ QTest::newRow("2-") << false << QPoint(100, 0) << QPointF(100, 0);
+ QTest::newRow("3-") << false << QPoint(1000, 0) << QPointF(1000, 0);
+ QTest::newRow("4-") << false << QPoint(10000, 0) << QPointF(10000, 0);
+ QTest::newRow("5-") << false << QPoint(-10000, 0) << QPointF(-10000, 0);
+ QTest::newRow("6-") << false << QPoint(-1000, 0) << QPointF(-1000, 0);
+ QTest::newRow("7-") << false << QPoint(-100, 0) << QPointF(-100, 0);
+ QTest::newRow("8-") << false << QPoint(-10, 0) << QPointF(-10, 0);
}
void tst_QGraphicsProxyWidget::childPos()
QFETCH(bool, moveCombo);
QFETCH(QPoint, comboPos);
QFETCH(QPointF, proxyPos);
- QFETCH(QPointF, menuPos);
QGraphicsScene scene;
view.setSceneRect(-10000, -10000, 20000, 20000);
view.show();
- QPoint centerPoint = view.viewport()->rect().center();
QRect leftRect = view.mapFromScene(-30, -10, 20, 20).boundingRect();
QRect rightRect = view.mapFromScene(30, -10, 20, 20).boundingRect();
view.setSceneRect(-10000, -10000, 20000, 20000);
view.show();
- QPoint centerPoint = view.viewport()->rect().center();
QPolygon leftPoly = view.mapFromScene(QRectF(-30, -10, 20, 20));
QPolygon rightPoly = view.mapFromScene(QRectF(30, -10, 20, 20));
view.setSceneRect(-10000, -10000, 20000, 20000);
view.show();
- QPoint centerPoint = view.viewport()->rect().center();
QPainterPath leftPath;
leftPath.addEllipse(QRect(view.mapFromScene(-30, -10), QSize(20, 20)));
view.translate(10, 10);
view.setFixedSize(300, 300);
view.show();
- QPoint center = view.viewport()->rect().center();
QRect rect(QPoint(10, 0), QSize(10, 10));
QPainterPath path;
QStringList strings3; strings3 << "One" << "Two" << "Three" << "Four" << "Five";
QStringList aboutto3; aboutto3 << "One" << "Two" << "Three" << "Four" << "Five";
- QStringList res3; res3 ;
+ QStringList res3;
QTest::newRow( "data3" ) << strings3 << 0 << 5 << aboutto3 << res3;
/* Not sure if this is a valid test */
tree.setColumnCount(3);
QTreeWidgetItem item(&tree);
- QRect itemRect = tree.visualItemRect(&item);
-
QRect rectCol0 = tree.visualRect(tree.indexFromItem(&item, 0));
QRect rectCol1 = tree.visualRect(tree.indexFromItem(&item, 1));
QRect rectCol2 = tree.visualRect(tree.indexFromItem(&item, 2));
parent.setGeometry(60, 60, 150, 150);
#endif
child.setGeometry(25, 25, 50, 50);
- QPoint childOffset = child.mapToGlobal(QPoint());
-
parent.show();
QTest::qWaitForWindowShown(&parent);
QTest::qWait(30);
painter.translate(105, 5);
painter.rotate(90);
- const QTransform worldTransform = painter.worldTransform();
- const QTransform deviceTransform = painter.deviceTransform();
-
// Render widgets onto image.
widget.render(&painter);
#ifdef RENDER_DEBUG
w.r = QRegion();
{
- const QPoint tlwOffset = w.geometry().topLeft();
ColorWidget child(&w, Qt::blue);
child.setGeometry(10, 10, 10, 10);
child.show();
object.setGeometry(0,0,size.width(), size.height());
object.show();
- QRect rect = object.geometry();
QDate selectedDate(2005, 1, 1);
//click on the month buttons
int month = object.monthShown();
// the default is determined by the style
const int metric = mw.style()->pixelMetric(QStyle::PM_ToolBarIconSize);
- const QSize defaultIconSize = QSize(metric, metric);
const QSize smallIconSize = QSize(metric / 2, metric / 2);
const QSize largeIconSize = QSize(metric * 2, metric * 2);
widget.setExtraSelections(selections);
compareWidgetAndImage(widget, "fullWidthSelection/nowrap_long.png");
-
- QTextLine line = widget.document()->begin().layout()->lineAt(0);
- // qDebug() << line.width();
}
void tst_QTextEdit::compareWidgetAndImage(QTextEdit &widget, const QString &imageFileName)