コード例 #1
0
void GraphicalUintTest::test_value()
{
  GraphicalInt * value = new GraphicalInt(true);
  QDoubleSpinBox * spinBox = findSpinBox(value);
  QVariant theValue;

  theValue = value->value();
  QVERIFY( theValue.type() == QVariant::UInt );
  QCOMPARE( theValue.toInt(), 0 );

  spinBox->setValue(412654);
  theValue = value->value();
  QVERIFY( theValue.type() == QVariant::UInt );
  QCOMPARE( theValue.toInt(), 412654 );

  delete value;
}
コード例 #2
0
void GraphicalIntTest::test_value()
{
  GraphicalInt * value = new GraphicalInt(false);
  QDoubleSpinBox * spinBox = findSpinBox(value);
  QVariant theValue;

  // get value when the line edit is empty
  theValue = value->value();
  QVERIFY( theValue.type() == QVariant::Int );
  QCOMPARE( theValue.toInt(), 0 );

  // get value when the line edit has a string
  spinBox->setValue(488654);
  theValue = value->value();
  QVERIFY( theValue.type() == QVariant::Int );
  QCOMPARE( theValue.toInt(), 488654 );

  delete value;
}