예제 #1
0
void tst_QColor::spec()
{
    QColor invalid;
    QCOMPARE(invalid.spec(), QColor::Invalid);

    QColor rgb = QColor::fromRgb(0, 0, 0);
    QCOMPARE(rgb.spec(), QColor::Rgb);

    QColor hsv = QColor::fromHsv(0, 0, 0);
    QCOMPARE(hsv.spec(), QColor::Hsv);

    QColor cmyk = QColor::fromCmyk(0, 0, 0, 0);
    QCOMPARE(cmyk.spec(), QColor::Cmyk);

    QColor hsl = QColor::fromHsl(0, 0, 0, 0);
    QCOMPARE(hsl.spec(), QColor::Hsl);

}
예제 #2
0
void tst_QColor::convertTo()
{
    QColor color(Qt::black);

    QColor rgb = color.convertTo(QColor::Rgb);
    QVERIFY(rgb.spec() == QColor::Rgb);

    QColor hsv = color.convertTo(QColor::Hsv);
    QVERIFY(hsv.spec() == QColor::Hsv);

    QColor cmyk = color.convertTo(QColor::Cmyk);
    QVERIFY(cmyk.spec() == QColor::Cmyk);

    QColor hsl = color.convertTo(QColor::Hsl);
    QVERIFY(hsl.spec() == QColor::Hsl);

    QColor invalid = color.convertTo(QColor::Invalid);
    QVERIFY(invalid.spec() == QColor::Invalid);
}
예제 #3
0
void ScColor::fromQColor(QColor color)
{
	if (color.spec() == QColor::Cmyk)
	{
		int c, m, y, k;
		color.getCmyk(&c, &m, &y, &k);
		setColor(c, m, y, k);
	}
	else
	{
		int r, g, b;
		color.getRgb(&r, &g, &b);
		setColorRGB(r, g, b);
	}
}
예제 #4
0
void tst_QColor::specConstructor()
{
    QFETCH(QColor::Spec, spec);
    QColor color = spec;
    QCOMPARE(color.spec(), spec);
}