##// END OF EJS Templates
Replaced qFuzzyIsNull with qFuzzyCompare. Once qchart test case still uses qFuzzyIsNull becasue it started failing when qFuzzyCompare was used
Marek Rosa -
r2242:2523dbee7254
parent child
Show More
@@ -106,7 +106,7 void PenTool::showColorDialog()
106
106
107 void PenTool::updateWidth(double width)
107 void PenTool::updateWidth(double width)
108 {
108 {
109 if (!qFuzzyIsNull(width - m_pen.widthF())) {
109 if (!qFuzzyCompare(width, m_pen.widthF())) {
110 m_pen.setWidthF(width);
110 m_pen.setWidthF(width);
111 emit changed();
111 emit changed();
112 }
112 }
@@ -276,7 +276,7 void ChartAxis::setLabelPadding(int padding)
276
276
277 bool ChartAxis::isEmpty()
277 bool ChartAxis::isEmpty()
278 {
278 {
279 return m_axisRect.isEmpty() || m_gridRect.isEmpty() || qFuzzyIsNull(m_min - m_max);
279 return m_axisRect.isEmpty() || m_gridRect.isEmpty() || qFuzzyCompare(m_min, m_max);
280 }
280 }
281
281
282 void ChartAxis::handleDomainUpdated()
282 void ChartAxis::handleDomainUpdated()
@@ -293,7 +293,7 void ChartAxis::handleDomainUpdated()
293 max = domain->maxY();
293 max = domain->maxY();
294 }
294 }
295
295
296 if (!qFuzzyIsNull(m_min - min) || !qFuzzyIsNull(m_max - max)) {
296 if (!qFuzzyCompare(m_min, min) || !qFuzzyCompare(m_max, max)) {
297 m_min = min;
297 m_min = min;
298 m_max = max;
298 m_max = max;
299
299
@@ -219,13 +219,13 void QValueAxis::setRange(qreal min, qreal max)
219 setTickCount(ticks);
219 setTickCount(ticks);
220 }
220 }
221
221
222 if (!qFuzzyIsNull(d->m_min - min)) {
222 if (!qFuzzyCompare(d->m_min, min)) {
223 d->m_min = min;
223 d->m_min = min;
224 changed = true;
224 changed = true;
225 emit minChanged(min);
225 emit minChanged(min);
226 }
226 }
227
227
228 if (!qFuzzyIsNull(d->m_max - max)) {
228 if (!qFuzzyCompare(d->m_max, max)) {
229 d->m_max = max;
229 d->m_max = max;
230 changed = true;
230 changed = true;
231 emit maxChanged(max);
231 emit maxChanged(max);
@@ -264,7 +264,7 void QValueAxis::setNiceNumbersEnabled(bool enable)
264 Q_D(QValueAxis);
264 Q_D(QValueAxis);
265 if (d->m_niceNumbers != enable) {
265 if (d->m_niceNumbers != enable) {
266 d->m_niceNumbers = enable;
266 d->m_niceNumbers = enable;
267 if (enable && !qFuzzyIsNull(d->m_max - d->m_min))
267 if (enable && !qFuzzyCompare(d->m_max, d->m_min))
268 setRange(d->m_min, d->m_max);
268 setRange(d->m_min, d->m_max);
269 }
269 }
270 }
270 }
@@ -67,14 +67,14 QVector<QRectF> HorizontalBarChartItem::calculateLayout()
67 layout.append(rect);
67 layout.append(rect);
68 bar->setPen(barSet->m_pen);
68 bar->setPen(barSet->m_pen);
69 bar->setBrush(barSet->m_brush);
69 bar->setBrush(barSet->m_brush);
70 if (qFuzzyIsNull(rectHeight))
70 if (qFuzzyCompare(rectHeight, 0))
71 bar->setVisible(false);
71 bar->setVisible(false);
72 else
72 else
73 bar->setVisible(barsVisible);
73 bar->setVisible(barsVisible);
74
74
75 QGraphicsSimpleTextItem *label = m_labels.at(itemIndex);
75 QGraphicsSimpleTextItem *label = m_labels.at(itemIndex);
76
76
77 if (!qFuzzyIsNull(barSet->value(category)))
77 if (!qFuzzyCompare(barSet->value(category), 0))
78 label->setText(QString::number(barSet->value(category)));
78 label->setText(QString::number(barSet->value(category)));
79 else
79 else
80 label->setText(QString(""));
80 label->setText(QString(""));
@@ -65,14 +65,14 QVector<QRectF> HorizontalPercentBarChartItem::calculateLayout()
65 layout.append(rect);
65 layout.append(rect);
66 bar->setPen(barSet->m_pen);
66 bar->setPen(barSet->m_pen);
67 bar->setBrush(barSet->m_brush);
67 bar->setBrush(barSet->m_brush);
68 if (qFuzzyIsNull(rectHeight))
68 if (qFuzzyCompare(rectHeight, 0))
69 bar->setVisible(false);
69 bar->setVisible(false);
70 else
70 else
71 bar->setVisible(barsVisible);
71 bar->setVisible(barsVisible);
72
72
73 QGraphicsSimpleTextItem *label = m_labels.at(itemIndex);
73 QGraphicsSimpleTextItem *label = m_labels.at(itemIndex);
74
74
75 if (!qFuzzyIsNull(m_series->d_func()->valueAt(set, category))) {
75 if (!qFuzzyCompare(m_series->d_func()->valueAt(set, category), 0)) {
76 int p = m_series->d_func()->percentageAt(set, category) * 100;
76 int p = m_series->d_func()->percentageAt(set, category) * 100;
77 QString vString(QString::number(p));
77 QString vString(QString::number(p));
78 vString.truncate(3);
78 vString.truncate(3);
@@ -62,14 +62,14 QVector<QRectF> HorizontalStackedBarChartItem::calculateLayout()
62
62
63 bar->setPen(barSet->m_pen);
63 bar->setPen(barSet->m_pen);
64 bar->setBrush(barSet->m_brush);
64 bar->setBrush(barSet->m_brush);
65 if (qFuzzyIsNull(rectHeight))
65 if (qFuzzyCompare(rectHeight, 0))
66 bar->setVisible(false);
66 bar->setVisible(false);
67 else
67 else
68 bar->setVisible(barsVisible);
68 bar->setVisible(barsVisible);
69
69
70 QGraphicsSimpleTextItem *label = m_labels.at(itemIndex);
70 QGraphicsSimpleTextItem *label = m_labels.at(itemIndex);
71
71
72 if (!qFuzzyIsNull(barSet->value(category)))
72 if (!qFuzzyCompare(barSet->value(category), 0))
73 label->setText(QString::number(barSet->value(category)));
73 label->setText(QString::number(barSet->value(category)));
74 else
74 else
75 label->setText(QString(""));
75 label->setText(QString(""));
@@ -484,7 +484,7 qreal QAbstractBarSeriesPrivate::percentageAt(int set, int category)
484
484
485 qreal value = m_barSets.at(set)->at(category);
485 qreal value = m_barSets.at(set)->at(category);
486 qreal sum = categorySum(category);
486 qreal sum = categorySum(category);
487 if (qFuzzyIsNull(sum))
487 if (qFuzzyCompare(sum, 0))
488 return 0;
488 return 0;
489
489
490 return value / sum;
490 return value / sum;
@@ -66,14 +66,14 QVector<QRectF> BarChartItem::calculateLayout()
66 layout.append(rect);
66 layout.append(rect);
67 bar->setPen(barSet->m_pen);
67 bar->setPen(barSet->m_pen);
68 bar->setBrush(barSet->m_brush);
68 bar->setBrush(barSet->m_brush);
69 if (qFuzzyIsNull(rectHeight))
69 if (qFuzzyCompare(rectHeight, 0))
70 bar->setVisible(false);
70 bar->setVisible(false);
71 else
71 else
72 bar->setVisible(barsVisible);
72 bar->setVisible(barsVisible);
73
73
74 QGraphicsSimpleTextItem *label = m_labels.at(itemIndex);
74 QGraphicsSimpleTextItem *label = m_labels.at(itemIndex);
75
75
76 if (!qFuzzyIsNull(barSet->value(category)))
76 if (!qFuzzyCompare(barSet->value(category), 0))
77 label->setText(QString::number(barSet->value(category)));
77 label->setText(QString::number(barSet->value(category)));
78 else
78 else
79 label->setText(QString(""));
79 label->setText(QString(""));
@@ -63,7 +63,7 QVector<QRectF> PercentBarChartItem::calculateLayout()
63 Bar *bar = m_bars.at(itemIndex);
63 Bar *bar = m_bars.at(itemIndex);
64 bar->setPen(barSet->m_pen);
64 bar->setPen(barSet->m_pen);
65 bar->setBrush(barSet->m_brush);
65 bar->setBrush(barSet->m_brush);
66 if (qFuzzyIsNull(rectHeight))
66 if (qFuzzyCompare(rectHeight, 0))
67 bar->setVisible(false);
67 bar->setVisible(false);
68 else
68 else
69 bar->setVisible(barsVisible);
69 bar->setVisible(barsVisible);
@@ -73,7 +73,7 QVector<QRectF> PercentBarChartItem::calculateLayout()
73
73
74 QGraphicsSimpleTextItem *label = m_labels.at(itemIndex);
74 QGraphicsSimpleTextItem *label = m_labels.at(itemIndex);
75
75
76 if (!qFuzzyIsNull(m_series->d_func()->valueAt(set, category))) {
76 if (!qFuzzyCompare(m_series->d_func()->valueAt(set, category), 0)) {
77 int p = m_series->d_func()->percentageAt(set, category) * 100;
77 int p = m_series->d_func()->percentageAt(set, category) * 100;
78 QString vString(QString::number(p));
78 QString vString(QString::number(p));
79 vString.truncate(3);
79 vString.truncate(3);
@@ -61,14 +61,14 QVector<QRectF> StackedBarChartItem::calculateLayout()
61 Bar *bar = m_bars.at(itemIndex);
61 Bar *bar = m_bars.at(itemIndex);
62 bar->setPen(barSet->m_pen);
62 bar->setPen(barSet->m_pen);
63 bar->setBrush(barSet->m_brush);
63 bar->setBrush(barSet->m_brush);
64 if (qFuzzyIsNull(rectHeight))
64 if (qFuzzyCompare(rectHeight, 0))
65 bar->setVisible(false);
65 bar->setVisible(false);
66 else
66 else
67 bar->setVisible(barsVisible);
67 bar->setVisible(barsVisible);
68
68
69 QGraphicsSimpleTextItem *label = m_labels.at(itemIndex);
69 QGraphicsSimpleTextItem *label = m_labels.at(itemIndex);
70
70
71 if (!qFuzzyIsNull(barSet->value(category)))
71 if (!qFuzzyCompare(barSet->value(category), 0))
72 label->setText(QString::number(barSet->value(category)));
72 label->setText(QString::number(barSet->value(category)));
73 else
73 else
74 label->setText(QString(""));
74 label->setText(QString(""));
@@ -83,7 +83,7 void ChartBackground::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
83
83
84 int ChartBackground::roundness(qreal size) const
84 int ChartBackground::roundness(qreal size) const
85 {
85 {
86 if (qFuzzyIsNull(size))
86 if (qFuzzyCompare(size, 0))
87 return 0;
87 return 0;
88 return 100 * m_diameter / int(size);
88 return 100 * m_diameter / int(size);
89 }
89 }
@@ -41,14 +41,14 void Domain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
41 bool axisXChanged = false;
41 bool axisXChanged = false;
42 bool axisYChanged = false;
42 bool axisYChanged = false;
43
43
44 if (!qFuzzyIsNull(m_minX - minX) || !qFuzzyIsNull(m_maxX - maxX)) {
44 if (!qFuzzyCompare(m_minX, minX) || !qFuzzyCompare(m_maxX, maxX)) {
45 m_minX = minX;
45 m_minX = minX;
46 m_maxX = maxX;
46 m_maxX = maxX;
47 axisXChanged = true;
47 axisXChanged = true;
48 emit rangeXChanged(m_minX, m_maxX);
48 emit rangeXChanged(m_minX, m_maxX);
49 }
49 }
50
50
51 if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) {
51 if (!qFuzzyCompare(m_minY, minY) || !qFuzzyCompare(m_maxY, maxY)) {
52 m_minY = minY;
52 m_minY = minY;
53 m_maxY = maxY;
53 m_maxY = maxY;
54 axisYChanged = true;
54 axisYChanged = true;
@@ -103,7 +103,7 qreal Domain::spanY() const
103
103
104 bool Domain::isEmpty() const
104 bool Domain::isEmpty() const
105 {
105 {
106 return qFuzzyIsNull(spanX()) || qFuzzyIsNull(spanY());
106 return qFuzzyCompare(spanX(), 0) || qFuzzyCompare(spanY(), 0);
107 }
107 }
108
108
109 void Domain::zoomIn(const QRectF &rect, const QSizeF &size)
109 void Domain::zoomIn(const QRectF &rect, const QSizeF &size)
@@ -181,10 +181,10 void Domain::handleAxisUpdated()
181
181
182 bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const Domain &domain1, const Domain &domain2)
182 bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const Domain &domain1, const Domain &domain2)
183 {
183 {
184 return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX) &&
184 return (qFuzzyCompare(domain1.m_maxX, domain2.m_maxX) &&
185 qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY) &&
185 qFuzzyCompare(domain1.m_maxY, domain2.m_maxY) &&
186 qFuzzyIsNull(domain1.m_minX - domain2.m_minX) &&
186 qFuzzyCompare(domain1.m_minX, domain2.m_minX) &&
187 qFuzzyIsNull(domain1.m_minY - domain2.m_minY));
187 qFuzzyCompare(domain1.m_minY, domain2.m_minY));
188 }
188 }
189
189
190
190
@@ -612,7 +612,7 void QPieSeries::setHorizontalPosition(qreal relativePosition)
612 if (relativePosition > 1.0)
612 if (relativePosition > 1.0)
613 relativePosition = 1.0;
613 relativePosition = 1.0;
614
614
615 if (!qFuzzyIsNull(d->m_pieRelativeHorPos - relativePosition)) {
615 if (!qFuzzyCompare(d->m_pieRelativeHorPos, relativePosition)) {
616 d->m_pieRelativeHorPos = relativePosition;
616 d->m_pieRelativeHorPos = relativePosition;
617 emit d->horizontalPositionChanged();
617 emit d->horizontalPositionChanged();
618 }
618 }
@@ -633,7 +633,7 void QPieSeries::setVerticalPosition(qreal relativePosition)
633 if (relativePosition > 1.0)
633 if (relativePosition > 1.0)
634 relativePosition = 1.0;
634 relativePosition = 1.0;
635
635
636 if (!qFuzzyIsNull(d->m_pieRelativeVerPos - relativePosition)) {
636 if (!qFuzzyCompare(d->m_pieRelativeVerPos, relativePosition)) {
637 d->m_pieRelativeVerPos = relativePosition;
637 d->m_pieRelativeVerPos = relativePosition;
638 emit d->verticalPositionChanged();
638 emit d->verticalPositionChanged();
639 }
639 }
@@ -663,7 +663,7 qreal QPieSeries::pieSize() const
663 void QPieSeries::setPieStartAngle(qreal angle)
663 void QPieSeries::setPieStartAngle(qreal angle)
664 {
664 {
665 Q_D(QPieSeries);
665 Q_D(QPieSeries);
666 if (qFuzzyIsNull(d->m_pieStartAngle - angle))
666 if (qFuzzyCompare(d->m_pieStartAngle, angle))
667 return;
667 return;
668 d->m_pieStartAngle = angle;
668 d->m_pieStartAngle = angle;
669 d->updateDerivativeData();
669 d->updateDerivativeData();
@@ -688,7 +688,7 qreal QPieSeries::pieStartAngle() const
688 void QPieSeries::setPieEndAngle(qreal angle)
688 void QPieSeries::setPieEndAngle(qreal angle)
689 {
689 {
690 Q_D(QPieSeries);
690 Q_D(QPieSeries);
691 if (qFuzzyIsNull(d->m_pieEndAngle - angle))
691 if (qFuzzyCompare(d->m_pieEndAngle, angle))
692 return;
692 return;
693 d->m_pieEndAngle = angle;
693 d->m_pieEndAngle = angle;
694 d->updateDerivativeData();
694 d->updateDerivativeData();
@@ -764,13 +764,13 void QPieSeriesPrivate::updateDerivativeData()
764 foreach (QPieSlice *s, m_slices)
764 foreach (QPieSlice *s, m_slices)
765 sum += s->value();
765 sum += s->value();
766
766
767 if (!qFuzzyIsNull(m_sum - sum)) {
767 if (!qFuzzyCompare(m_sum, sum)) {
768 m_sum = sum;
768 m_sum = sum;
769 emit q_func()->sumChanged();
769 emit q_func()->sumChanged();
770 }
770 }
771
771
772 // nothing to show..
772 // nothing to show..
773 if (qFuzzyIsNull(m_sum))
773 if (qFuzzyCompare(m_sum, 0))
774 return;
774 return;
775
775
776 // update slice attributes
776 // update slice attributes
@@ -793,12 +793,12 void QPieSeriesPrivate::setSizes(qreal innerSize, qreal outerSize)
793 {
793 {
794 bool changed = false;
794 bool changed = false;
795
795
796 if (!qFuzzyIsNull(m_holeRelativeSize - innerSize)) {
796 if (!qFuzzyCompare(m_holeRelativeSize, innerSize)) {
797 m_holeRelativeSize = innerSize;
797 m_holeRelativeSize = innerSize;
798 changed = true;
798 changed = true;
799 }
799 }
800
800
801 if (!qFuzzyIsNull(m_pieRelativeSize - outerSize)) {
801 if (!qFuzzyCompare(m_pieRelativeSize, outerSize)) {
802 m_pieRelativeSize = outerSize;
802 m_pieRelativeSize = outerSize;
803 changed = true;
803 changed = true;
804 }
804 }
@@ -480,7 +480,7 QString QPieSlice::label() const
480 void QPieSlice::setValue(qreal value)
480 void QPieSlice::setValue(qreal value)
481 {
481 {
482 value = qAbs(value); // negative values not allowed
482 value = qAbs(value); // negative values not allowed
483 if (!qFuzzyIsNull(d_ptr->m_data.m_value - value)) {
483 if (!qFuzzyCompare(d_ptr->m_data.m_value, value)) {
484 d_ptr->m_data.m_value = value;
484 d_ptr->m_data.m_value = value;
485 emit valueChanged();
485 emit valueChanged();
486 }
486 }
@@ -629,7 +629,7 QFont QPieSlice::labelFont() const
629
629
630 void QPieSlice::setLabelArmLengthFactor(qreal factor)
630 void QPieSlice::setLabelArmLengthFactor(qreal factor)
631 {
631 {
632 if (!qFuzzyIsNull(d_ptr->m_data.m_labelArmLengthFactor - factor)) {
632 if (!qFuzzyCompare(d_ptr->m_data.m_labelArmLengthFactor, factor)) {
633 d_ptr->m_data.m_labelArmLengthFactor = factor;
633 d_ptr->m_data.m_labelArmLengthFactor = factor;
634 emit d_ptr->labelArmLengthFactorChanged();
634 emit d_ptr->labelArmLengthFactorChanged();
635 }
635 }
@@ -642,7 +642,7 qreal QPieSlice::labelArmLengthFactor() const
642
642
643 void QPieSlice::setExplodeDistanceFactor(qreal factor)
643 void QPieSlice::setExplodeDistanceFactor(qreal factor)
644 {
644 {
645 if (!qFuzzyIsNull(d_ptr->m_data.m_explodeDistanceFactor - factor)) {
645 if (!qFuzzyCompare(d_ptr->m_data.m_explodeDistanceFactor, factor)) {
646 d_ptr->m_data.m_explodeDistanceFactor = factor;
646 d_ptr->m_data.m_explodeDistanceFactor = factor;
647 emit d_ptr->explodeDistanceFactorChanged();
647 emit d_ptr->explodeDistanceFactorChanged();
648 }
648 }
@@ -754,7 +754,7 void QPieSlicePrivate::setLabelFont(const QFont &font, bool themed)
754
754
755 void QPieSlicePrivate::setPercentage(qreal percentage)
755 void QPieSlicePrivate::setPercentage(qreal percentage)
756 {
756 {
757 if (!qFuzzyIsNull(m_data.m_percentage - percentage)) {
757 if (!qFuzzyCompare(m_data.m_percentage, percentage)) {
758 m_data.m_percentage = percentage;
758 m_data.m_percentage = percentage;
759 emit q_ptr->percentageChanged();
759 emit q_ptr->percentageChanged();
760 }
760 }
@@ -762,7 +762,7 void QPieSlicePrivate::setPercentage(qreal percentage)
762
762
763 void QPieSlicePrivate::setStartAngle(qreal angle)
763 void QPieSlicePrivate::setStartAngle(qreal angle)
764 {
764 {
765 if (!qFuzzyIsNull(m_data.m_startAngle - angle)) {
765 if (!qFuzzyCompare(m_data.m_startAngle, angle)) {
766 m_data.m_startAngle = angle;
766 m_data.m_startAngle = angle;
767 emit q_ptr->startAngleChanged();
767 emit q_ptr->startAngleChanged();
768 }
768 }
@@ -770,7 +770,7 void QPieSlicePrivate::setStartAngle(qreal angle)
770
770
771 void QPieSlicePrivate::setAngleSpan(qreal span)
771 void QPieSlicePrivate::setAngleSpan(qreal span)
772 {
772 {
773 if (!qFuzzyIsNull(m_data.m_angleSpan - span)) {
773 if (!qFuzzyCompare(m_data.m_angleSpan, span)) {
774 m_data.m_angleSpan = span;
774 m_data.m_angleSpan = span;
775 emit q_ptr->angleSpanChanged();
775 emit q_ptr->angleSpanChanged();
776 }
776 }
@@ -286,7 +286,7 void QChart::zoomOut()
286 */
286 */
287 void QChart::zoom(qreal factor)
287 void QChart::zoom(qreal factor)
288 {
288 {
289 if (qFuzzyIsNull(factor))
289 if (qFuzzyCompare(factor, 0))
290 return;
290 return;
291
291
292 if (qFuzzyCompare(factor, (qreal)1.0))
292 if (qFuzzyCompare(factor, (qreal)1.0))
@@ -239,7 +239,7 void QScatterSeries::setMarkerSize(qreal size)
239 {
239 {
240 Q_D(QScatterSeries);
240 Q_D(QScatterSeries);
241
241
242 if (!qFuzzyIsNull(d->m_size - size)) {
242 if (!qFuzzyCompare(d->m_size, size)) {
243 d->m_size = size;
243 d->m_size = size;
244 emit d->updated();
244 emit d->updated();
245 }
245 }
@@ -64,7 +64,7 void Scroller::scrollTo(const QPointF &delta)
64 // Release was quick enough. Start scrolling.
64 // Release was quick enough. Start scrolling.
65 qreal interval = 25;
65 qreal interval = 25;
66 qreal time = m_timeStamp.msecsTo(QTime::currentTime());
66 qreal time = m_timeStamp.msecsTo(QTime::currentTime());
67 if (qFuzzyIsNull(time)) {
67 if (qFuzzyCompare(time, 0)) {
68 m_speed = delta / 5;
68 m_speed = delta / 5;
69 } else {
69 } else {
70 m_speed = delta * interval / time;
70 m_speed = delta * interval / time;
@@ -72,7 +72,7 void Scroller::scrollTo(const QPointF &delta)
72
72
73 qreal fraction = qMax(qAbs(m_speed.x()), qAbs(m_speed.y()));
73 qreal fraction = qMax(qAbs(m_speed.x()), qAbs(m_speed.y()));
74
74
75 if (!qFuzzyIsNull(fraction)) {
75 if (!qFuzzyCompare(fraction, 0)) {
76 m_fraction.setX(qAbs(m_speed.x() / fraction));
76 m_fraction.setX(qAbs(m_speed.x() / fraction));
77 m_fraction.setY(qAbs(m_speed.y() / fraction));
77 m_fraction.setY(qAbs(m_speed.y() / fraction));
78 } else {
78 } else {
@@ -219,7 +219,7 void XYChart::handleGeometryChanged(const QRectF &rect)
219
219
220 bool XYChart::isEmpty()
220 bool XYChart::isEmpty()
221 {
221 {
222 return !m_clipRect.isValid() || qFuzzyIsNull(m_maxX - m_minX) || qFuzzyIsNull(m_maxY - m_minY) || m_series->points().isEmpty();
222 return !m_clipRect.isValid() || qFuzzyCompare(m_maxX, m_minX) || qFuzzyCompare(m_maxY, m_minY) || m_series->points().isEmpty();
223 }
223 }
224
224
225 #include "moc_xychart_p.cpp"
225 #include "moc_xychart_p.cpp"
@@ -191,12 +191,12 void tst_Domain::handleAxisUpdatedX()
191 axis.m_max=max;
191 axis.m_max=max;
192 axis.emitUpdated();
192 axis.emitUpdated();
193
193
194 QVERIFY(qFuzzyIsNull(domain.minX() - min));
194 QVERIFY(qFuzzyCompare(domain.minX(), min));
195 QVERIFY(qFuzzyIsNull(domain.maxX() - max));
195 QVERIFY(qFuzzyCompare(domain.maxX(), max));
196
196
197 QList<QVariant> arg1 = spy1.first();
197 QList<QVariant> arg1 = spy1.first();
198 QVERIFY(qFuzzyIsNull(arg1.at(0).toReal() - min));
198 QVERIFY(qFuzzyCompare(arg1.at(0).toReal(), min));
199 QVERIFY(qFuzzyIsNull(arg1.at(1).toReal() - max));
199 QVERIFY(qFuzzyCompare(arg1.at(1).toReal(), max));
200
200
201 TRY_COMPARE(spy0.count(), 1);
201 TRY_COMPARE(spy0.count(), 1);
202 TRY_COMPARE(spy1.count(), 1);
202 TRY_COMPARE(spy1.count(), 1);
@@ -230,12 +230,12 void tst_Domain::handleAxisUpdatedY()
230 axis.m_max = max;
230 axis.m_max = max;
231 axis.emitUpdated();
231 axis.emitUpdated();
232
232
233 QVERIFY(qFuzzyIsNull(domain.minY() - min));
233 QVERIFY(qFuzzyCompare(domain.minY(), min));
234 QVERIFY(qFuzzyIsNull(domain.maxY() - max));
234 QVERIFY(qFuzzyCompare(domain.maxY(), max));
235
235
236 QList<QVariant> arg1 = spy2.first();
236 QList<QVariant> arg1 = spy2.first();
237 QVERIFY(qFuzzyIsNull(arg1.at(0).toReal() - min));
237 QVERIFY(qFuzzyCompare(arg1.at(0).toReal(), min));
238 QVERIFY(qFuzzyIsNull(arg1.at(1).toReal() - max));
238 QVERIFY(qFuzzyCompare(arg1.at(1).toReal(), max));
239
239
240 TRY_COMPARE(spy0.count(), 1);
240 TRY_COMPARE(spy0.count(), 1);
241 TRY_COMPARE(spy1.count(), 0);
241 TRY_COMPARE(spy1.count(), 0);
@@ -504,12 +504,12 void tst_Domain::setRangeX()
504
504
505 domain.setRangeX(min, max);
505 domain.setRangeX(min, max);
506
506
507 QVERIFY(qFuzzyIsNull(domain.minX() - min));
507 QVERIFY(qFuzzyCompare(domain.minX(), min));
508 QVERIFY(qFuzzyIsNull(domain.maxX() - max));
508 QVERIFY(qFuzzyCompare(domain.maxX(), max));
509
509
510 QList<QVariant> arg1 = spy1.first();
510 QList<QVariant> arg1 = spy1.first();
511 QVERIFY(qFuzzyIsNull(arg1.at(0).toReal() - min));
511 QVERIFY(qFuzzyCompare(arg1.at(0).toReal(), min));
512 QVERIFY(qFuzzyIsNull(arg1.at(1).toReal() - max));
512 QVERIFY(qFuzzyCompare(arg1.at(1).toReal(), max));
513
513
514 TRY_COMPARE(spy0.count(), 1);
514 TRY_COMPARE(spy0.count(), 1);
515 TRY_COMPARE(spy1.count(), 1);
515 TRY_COMPARE(spy1.count(), 1);
@@ -538,12 +538,12 void tst_Domain::setRangeY()
538
538
539 domain.setRangeY(min, max);
539 domain.setRangeY(min, max);
540
540
541 QVERIFY(qFuzzyIsNull(domain.minY() - min));
541 QVERIFY(qFuzzyCompare(domain.minY(), min));
542 QVERIFY(qFuzzyIsNull(domain.maxY() - max));
542 QVERIFY(qFuzzyCompare(domain.maxY(), max));
543
543
544 QList<QVariant> arg1 = spy2.first();
544 QList<QVariant> arg1 = spy2.first();
545 QVERIFY(qFuzzyIsNull(arg1.at(0).toReal() - min));
545 QVERIFY(qFuzzyCompare(arg1.at(0).toReal(), min));
546 QVERIFY(qFuzzyIsNull(arg1.at(1).toReal() - max));
546 QVERIFY(qFuzzyCompare(arg1.at(1).toReal(), max));
547
547
548 TRY_COMPARE(spy0.count(), 1);
548 TRY_COMPARE(spy0.count(), 1);
549 TRY_COMPARE(spy1.count(), 0);
549 TRY_COMPARE(spy1.count(), 0);
@@ -93,7 +93,7 void tst_QBarSet::qbarset()
93 QBarSet barset(QString("label"));
93 QBarSet barset(QString("label"));
94 QCOMPARE(barset.label(), QString("label"));
94 QCOMPARE(barset.label(), QString("label"));
95 QCOMPARE(barset.count(), 0);
95 QCOMPARE(barset.count(), 0);
96 QVERIFY(qFuzzyIsNull(barset.sum()));
96 QVERIFY(qFuzzyCompare(barset.sum(), 0));
97 }
97 }
98
98
99 void tst_QBarSet::label_data()
99 void tst_QBarSet::label_data()
@@ -129,7 +129,7 void tst_QBarSet::append()
129 QFETCH(int, count);
129 QFETCH(int, count);
130
130
131 QCOMPARE(m_barset->count(), 0);
131 QCOMPARE(m_barset->count(), 0);
132 QVERIFY(qFuzzyIsNull(m_barset->sum()));
132 QVERIFY(qFuzzyCompare(m_barset->sum(), 0));
133
133
134 QSignalSpy valueSpy(m_barset, SIGNAL(valuesAdded(int,int)));
134 QSignalSpy valueSpy(m_barset, SIGNAL(valuesAdded(int,int)));
135
135
@@ -159,7 +159,7 void tst_QBarSet::appendOperator()
159 QFETCH(int, count);
159 QFETCH(int, count);
160
160
161 QCOMPARE(m_barset->count(), 0);
161 QCOMPARE(m_barset->count(), 0);
162 QVERIFY(qFuzzyIsNull(m_barset->sum()));
162 QVERIFY(qFuzzyCompare(m_barset->sum(), 0));
163
163
164 QSignalSpy valueSpy(m_barset,SIGNAL(valuesAdded(int,int)));
164 QSignalSpy valueSpy(m_barset,SIGNAL(valuesAdded(int,int)));
165
165
@@ -185,7 +185,7 void tst_QBarSet::insert_data()
185 void tst_QBarSet::insert()
185 void tst_QBarSet::insert()
186 {
186 {
187 QCOMPARE(m_barset->count(), 0);
187 QCOMPARE(m_barset->count(), 0);
188 QVERIFY(qFuzzyIsNull(m_barset->sum()));
188 QVERIFY(qFuzzyCompare(m_barset->sum(), 0));
189 QSignalSpy valueSpy(m_barset,SIGNAL(valuesAdded(int,int)));
189 QSignalSpy valueSpy(m_barset,SIGNAL(valuesAdded(int,int)));
190
190
191 m_barset->insert(0, 1.0); // 1.0
191 m_barset->insert(0, 1.0); // 1.0
@@ -215,7 +215,7 void tst_QBarSet::remove_data()
215 void tst_QBarSet::remove()
215 void tst_QBarSet::remove()
216 {
216 {
217 QCOMPARE(m_barset->count(), 0);
217 QCOMPARE(m_barset->count(), 0);
218 QVERIFY(qFuzzyIsNull(m_barset->sum()));
218 QVERIFY(qFuzzyCompare(m_barset->sum(), 0));
219
219
220 QSignalSpy valueSpy(m_barset,SIGNAL(valuesRemoved(int,int)));
220 QSignalSpy valueSpy(m_barset,SIGNAL(valuesRemoved(int,int)));
221
221
@@ -275,7 +275,7 void tst_QBarSet::remove()
275 // Remove more items than list has
275 // Remove more items than list has
276 m_barset->remove(0,312);
276 m_barset->remove(0,312);
277 QCOMPARE(m_barset->count(), 0);
277 QCOMPARE(m_barset->count(), 0);
278 QVERIFY(qFuzzyIsNull(m_barset->sum()));
278 QVERIFY(qFuzzyCompare(m_barset->sum(), 0));
279
279
280 QCOMPARE(valueSpy.count(), 1);
280 QCOMPARE(valueSpy.count(), 1);
281 valueSpyArg = valueSpy.takeFirst();
281 valueSpyArg = valueSpy.takeFirst();
@@ -296,7 +296,7 void tst_QBarSet::replace_data()
296 void tst_QBarSet::replace()
296 void tst_QBarSet::replace()
297 {
297 {
298 QCOMPARE(m_barset->count(), 0);
298 QCOMPARE(m_barset->count(), 0);
299 QVERIFY(qFuzzyIsNull(m_barset->sum()));
299 QVERIFY(qFuzzyCompare(m_barset->sum(), 0));
300 QSignalSpy valueSpy(m_barset,SIGNAL(valueChanged(int)));
300 QSignalSpy valueSpy(m_barset,SIGNAL(valueChanged(int)));
301
301
302 m_barset->append(1.0);
302 m_barset->append(1.0);
@@ -347,7 +347,7 void tst_QBarSet::at_data()
347 void tst_QBarSet::at()
347 void tst_QBarSet::at()
348 {
348 {
349 QCOMPARE(m_barset->count(), 0);
349 QCOMPARE(m_barset->count(), 0);
350 QVERIFY(qFuzzyIsNull(m_barset->sum()));
350 QVERIFY(qFuzzyCompare(m_barset->sum(), 0));
351
351
352 m_barset->append(1.0);
352 m_barset->append(1.0);
353 m_barset->append(2.0);
353 m_barset->append(2.0);
@@ -368,7 +368,7 void tst_QBarSet::atOperator_data()
368 void tst_QBarSet::atOperator()
368 void tst_QBarSet::atOperator()
369 {
369 {
370 QCOMPARE(m_barset->count(), 0);
370 QCOMPARE(m_barset->count(), 0);
371 QVERIFY(qFuzzyIsNull(m_barset->sum()));
371 QVERIFY(qFuzzyCompare(m_barset->sum(), 0));
372
372
373 m_barset->append(1.0);
373 m_barset->append(1.0);
374 m_barset->append(2.0);
374 m_barset->append(2.0);
@@ -389,7 +389,7 void tst_QBarSet::count_data()
389 void tst_QBarSet::count()
389 void tst_QBarSet::count()
390 {
390 {
391 QCOMPARE(m_barset->count(), 0);
391 QCOMPARE(m_barset->count(), 0);
392 QVERIFY(qFuzzyIsNull(m_barset->sum()));
392 QVERIFY(qFuzzyCompare(m_barset->sum(), 0));
393
393
394 m_barset->append(1.0);
394 m_barset->append(1.0);
395 QCOMPARE(m_barset->count(),1);
395 QCOMPARE(m_barset->count(),1);
@@ -409,7 +409,7 void tst_QBarSet::sum_data()
409 void tst_QBarSet::sum()
409 void tst_QBarSet::sum()
410 {
410 {
411 QCOMPARE(m_barset->count(), 0);
411 QCOMPARE(m_barset->count(), 0);
412 QVERIFY(qFuzzyIsNull(m_barset->sum()));
412 QVERIFY(qFuzzyCompare(m_barset->sum(), 0));
413
413
414 m_barset->append(1.0);
414 m_barset->append(1.0);
415 QVERIFY(qFuzzyCompare(m_barset->sum(), (qreal)1.0));
415 QVERIFY(qFuzzyCompare(m_barset->sum(), (qreal)1.0));
@@ -98,16 +98,16 void tst_QCategoryAxis::qcategoryaxis()
98 {
98 {
99 qabstractaxis();
99 qabstractaxis();
100
100
101 QVERIFY(qFuzzyIsNull(m_categoryaxis->max()));
101 QVERIFY(qFuzzyCompare(m_categoryaxis->max(), 0));
102 QVERIFY(qFuzzyIsNull(m_categoryaxis->min()));
102 QVERIFY(qFuzzyCompare(m_categoryaxis->min(), 0));
103 QCOMPARE(m_categoryaxis->type(), QAbstractAxis::AxisTypeCategory);
103 QCOMPARE(m_categoryaxis->type(), QAbstractAxis::AxisTypeCategory);
104
104
105 m_chart->setAxisX(m_categoryaxis, m_series);
105 m_chart->setAxisX(m_categoryaxis, m_series);
106 m_view->show();
106 m_view->show();
107 QTest::qWaitForWindowShown(m_view);
107 QTest::qWaitForWindowShown(m_view);
108
108
109 QVERIFY(!qFuzzyIsNull(m_categoryaxis->max()));
109 QVERIFY(!qFuzzyCompare(m_categoryaxis->max(), 0));
110 QVERIFY(!qFuzzyIsNull(m_categoryaxis->min()));
110 QVERIFY(!qFuzzyCompare(m_categoryaxis->min(), 0));
111 }
111 }
112
112
113 void tst_QCategoryAxis::max_raw_data()
113 void tst_QCategoryAxis::max_raw_data()
@@ -127,7 +127,7 void tst_QCategoryAxis::max_raw()
127 QSignalSpy spy2(m_categoryaxis, SIGNAL(rangeChanged(qreal,qreal)));
127 QSignalSpy spy2(m_categoryaxis, SIGNAL(rangeChanged(qreal,qreal)));
128
128
129 m_categoryaxis->setMax(max);
129 m_categoryaxis->setMax(max);
130 QVERIFY2(qFuzzyIsNull(m_categoryaxis->max() - max), "Not equal");
130 QVERIFY2(qFuzzyCompare(m_categoryaxis->max(), max), "Not equal");
131
131
132 QCOMPARE(spy0.count(), 1);
132 QCOMPARE(spy0.count(), 1);
133 QCOMPARE(spy1.count(), 0);
133 QCOMPARE(spy1.count(), 0);
@@ -175,7 +175,7 void tst_QCategoryAxis::min_raw()
175 QSignalSpy spy2(m_categoryaxis, SIGNAL(rangeChanged(qreal,qreal)));
175 QSignalSpy spy2(m_categoryaxis, SIGNAL(rangeChanged(qreal,qreal)));
176
176
177 m_categoryaxis->setMin(min);
177 m_categoryaxis->setMin(min);
178 QVERIFY2(qFuzzyIsNull(m_categoryaxis->min() - min), "Not equal");
178 QVERIFY2(qFuzzyCompare(m_categoryaxis->min(), min), "Not equal");
179
179
180 QCOMPARE(spy0.count(), 0);
180 QCOMPARE(spy0.count(), 0);
181 QCOMPARE(spy1.count(), 1);
181 QCOMPARE(spy1.count(), 1);
@@ -228,8 +228,8 void tst_QCategoryAxis::range_raw()
228 QSignalSpy spy2(m_categoryaxis, SIGNAL(rangeChanged(qreal,qreal)));
228 QSignalSpy spy2(m_categoryaxis, SIGNAL(rangeChanged(qreal,qreal)));
229
229
230 m_categoryaxis->setRange(min, max);
230 m_categoryaxis->setRange(min, max);
231 QVERIFY2(qFuzzyIsNull(m_categoryaxis->min() - min), "Min not equal");
231 QVERIFY2(qFuzzyCompare(m_categoryaxis->min(), min), "Min not equal");
232 QVERIFY2(qFuzzyIsNull(m_categoryaxis->max() - max), "Max not equal");
232 QVERIFY2(qFuzzyCompare(m_categoryaxis->max(), max), "Max not equal");
233
233
234 QCOMPARE(spy0.count(), 1);
234 QCOMPARE(spy0.count(), 1);
235 QCOMPARE(spy1.count(), 1);
235 QCOMPARE(spy1.count(), 1);
@@ -102,8 +102,8 void tst_QValueAxis::qvalueaxis()
102 {
102 {
103 qabstractaxis();
103 qabstractaxis();
104
104
105 QVERIFY(qFuzzyIsNull(m_valuesaxis->max()));
105 QVERIFY(qFuzzyCompare(m_valuesaxis->max(), 0));
106 QVERIFY(qFuzzyIsNull(m_valuesaxis->min()));
106 QVERIFY(qFuzzyCompare(m_valuesaxis->min(), 0));
107 QCOMPARE(m_valuesaxis->niceNumbersEnabled(), false);
107 QCOMPARE(m_valuesaxis->niceNumbersEnabled(), false);
108 QCOMPARE(m_valuesaxis->tickCount(), 5);
108 QCOMPARE(m_valuesaxis->tickCount(), 5);
109 QCOMPARE(m_valuesaxis->type(), QAbstractAxis::AxisTypeValue);
109 QCOMPARE(m_valuesaxis->type(), QAbstractAxis::AxisTypeValue);
@@ -112,8 +112,8 void tst_QValueAxis::qvalueaxis()
112 m_view->show();
112 m_view->show();
113 QTest::qWaitForWindowShown(m_view);
113 QTest::qWaitForWindowShown(m_view);
114
114
115 QVERIFY(!qFuzzyIsNull(m_valuesaxis->max()));
115 QVERIFY(!qFuzzyCompare(m_valuesaxis->max(), 0));
116 QVERIFY(!qFuzzyIsNull(m_valuesaxis->min()));
116 QVERIFY(!qFuzzyCompare(m_valuesaxis->min(), 0));
117 QCOMPARE(m_valuesaxis->niceNumbersEnabled(), false);
117 QCOMPARE(m_valuesaxis->niceNumbersEnabled(), false);
118 QCOMPARE(m_valuesaxis->tickCount(), 5);
118 QCOMPARE(m_valuesaxis->tickCount(), 5);
119 }
119 }
@@ -135,7 +135,7 void tst_QValueAxis::max_raw()
135 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
135 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
136
136
137 m_valuesaxis->setMax(max);
137 m_valuesaxis->setMax(max);
138 QVERIFY2(qFuzzyIsNull(m_valuesaxis->max() - max), "Not equal");
138 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), max), "Not equal");
139
139
140 QCOMPARE(spy0.count(), 1);
140 QCOMPARE(spy0.count(), 1);
141 QCOMPARE(spy1.count(), 0);
141 QCOMPARE(spy1.count(), 0);
@@ -184,7 +184,7 void tst_QValueAxis::min_raw()
184 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
184 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
185
185
186 m_valuesaxis->setMin(min);
186 m_valuesaxis->setMin(min);
187 QVERIFY2(qFuzzyIsNull(m_valuesaxis->min() - min), "Not equal");
187 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), min), "Not equal");
188
188
189 QCOMPARE(spy0.count(), 0);
189 QCOMPARE(spy0.count(), 0);
190 QCOMPARE(spy1.count(), 1);
190 QCOMPARE(spy1.count(), 1);
@@ -245,8 +245,8 void tst_QValueAxis::niceNumbersEnabled()
245 m_valuesaxis->setRange(min, max);
245 m_valuesaxis->setRange(min, max);
246 m_valuesaxis->setTickCount(ticks);
246 m_valuesaxis->setTickCount(ticks);
247
247
248 QVERIFY2(qFuzzyIsNull(m_valuesaxis->min() - min), "Min not equal");
248 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), min), "Min not equal");
249 QVERIFY2(qFuzzyIsNull(m_valuesaxis->max() - max), "Max not equal");
249 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), max), "Max not equal");
250
250
251 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
251 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
252 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
252 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
@@ -255,15 +255,15 void tst_QValueAxis::niceNumbersEnabled()
255 m_valuesaxis->setNiceNumbersEnabled(niceNumbersEnabled);
255 m_valuesaxis->setNiceNumbersEnabled(niceNumbersEnabled);
256 QCOMPARE(m_valuesaxis->niceNumbersEnabled(), niceNumbersEnabled);
256 QCOMPARE(m_valuesaxis->niceNumbersEnabled(), niceNumbersEnabled);
257
257
258 if(!qFuzzyIsNull(expectedMin - min))
258 if(!qFuzzyCompare(expectedMin, min))
259 QCOMPARE(spy1.count(), 1);
259 QCOMPARE(spy1.count(), 1);
260 if(!qFuzzyIsNull(expectedMax - max))
260 if(!qFuzzyCompare(expectedMax, max))
261 QCOMPARE(spy0.count(), 1);
261 QCOMPARE(spy0.count(), 1);
262 if((!qFuzzyIsNull(expectedMin - min)) || (!qFuzzyIsNull(expectedMax - max)))
262 if((!qFuzzyCompare(expectedMin, min)) || (!qFuzzyCompare(expectedMax, max)))
263 QCOMPARE(spy2.count(), 1);
263 QCOMPARE(spy2.count(), 1);
264
264
265 QVERIFY2(qFuzzyIsNull(m_valuesaxis->min() - expectedMin), "Min not equal");
265 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), expectedMin), "Min not equal");
266 QVERIFY2(qFuzzyIsNull(m_valuesaxis->max() - expectedMax), "Max not equal");
266 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), expectedMax), "Max not equal");
267 QCOMPARE(m_valuesaxis->tickCount(), expectedTicks);
267 QCOMPARE(m_valuesaxis->tickCount(), expectedTicks);
268
268
269 }
269 }
@@ -287,8 +287,8 void tst_QValueAxis::range_raw()
287 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
287 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
288
288
289 m_valuesaxis->setRange(min, max);
289 m_valuesaxis->setRange(min, max);
290 QVERIFY2(qFuzzyIsNull(m_valuesaxis->min() - min), "Min not equal");
290 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), min), "Min not equal");
291 QVERIFY2(qFuzzyIsNull(m_valuesaxis->max() - max), "Max not equal");
291 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), max), "Max not equal");
292
292
293 QCOMPARE(spy0.count(), 1);
293 QCOMPARE(spy0.count(), 1);
294 QCOMPARE(spy1.count(), 1);
294 QCOMPARE(spy1.count(), 1);
@@ -371,8 +371,8 void tst_QValueAxis::noautoscale()
371 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
371 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
372
372
373 m_valuesaxis->setRange(min, max);
373 m_valuesaxis->setRange(min, max);
374 QVERIFY2(qFuzzyIsNull(m_valuesaxis->min() - min), "Min not equal");
374 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), min), "Min not equal");
375 QVERIFY2(qFuzzyIsNull(m_valuesaxis->max() - max), "Max not equal");
375 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), max), "Max not equal");
376
376
377 QCOMPARE(spy0.count(), 1);
377 QCOMPARE(spy0.count(), 1);
378 QCOMPARE(spy1.count(), 1);
378 QCOMPARE(spy1.count(), 1);
@@ -381,8 +381,8 void tst_QValueAxis::noautoscale()
381 m_chart->setAxisX(m_valuesaxis, m_series);
381 m_chart->setAxisX(m_valuesaxis, m_series);
382 m_view->show();
382 m_view->show();
383 QTest::qWaitForWindowShown(m_view);
383 QTest::qWaitForWindowShown(m_view);
384 QVERIFY2(qFuzzyIsNull(m_valuesaxis->min() - min), "Min not equal");
384 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), min), "Min not equal");
385 QVERIFY2(qFuzzyIsNull(m_valuesaxis->max() - max), "Max not equal");
385 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), max), "Max not equal");
386 }
386 }
387
387
388 void tst_QValueAxis::autoscale_data()
388 void tst_QValueAxis::autoscale_data()
@@ -396,8 +396,8 void tst_QValueAxis::autoscale()
396 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
396 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
397 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
397 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
398
398
399 QVERIFY2(qFuzzyIsNull(m_valuesaxis->min()), "Min not equal");
399 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), 0), "Min not equal");
400 QVERIFY2(qFuzzyIsNull(m_valuesaxis->max()), "Max not equal");
400 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), 0), "Max not equal");
401 m_chart->setAxisX(m_valuesaxis, m_series);
401 m_chart->setAxisX(m_valuesaxis, m_series);
402
402
403 QCOMPARE(spy0.count(), 1);
403 QCOMPARE(spy0.count(), 1);
@@ -406,8 +406,8 void tst_QValueAxis::autoscale()
406
406
407 m_view->show();
407 m_view->show();
408 QTest::qWaitForWindowShown(m_view);
408 QTest::qWaitForWindowShown(m_view);
409 QVERIFY2(qFuzzyIsNull(m_valuesaxis->min() + 100), "Min not equal");
409 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), -100), "Min not equal");
410 QVERIFY2(qFuzzyIsNull(m_valuesaxis->max() - 100), "Max not equal");
410 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), 100), "Max not equal");
411 }
411 }
412
412
413 QTEST_MAIN(tst_QValueAxis)
413 QTEST_MAIN(tst_QValueAxis)
General Comments 0
You need to be logged in to leave comments. Login now