Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
1249262e
Kaydet (Commit)
1249262e
authored
Eyl 03, 2015
tarafından
Tomaž Vajngerl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Change color test to report expected values when assert fails
Change-Id: I8383dd317a4f8af5f057d81d8e90172b1f78edde
üst
eb2e1ab4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
31 deletions
+20
-31
test_color.cxx
tools/qa/cppunit/test_color.cxx
+20
-31
No files found.
tools/qa/cppunit/test_color.cxx
Dosyayı görüntüle @
1249262e
...
...
@@ -78,24 +78,13 @@ void Test::test_readAndWriteStream()
}
}
bool
checkTintShade
(
sal_uInt8
nR
,
sal_uInt8
nG
,
sal_uInt8
nB
,
OUString
const
&
sReference
,
sal_Int16
nTintShade
,
OUString
const
&
sExpected
)
OUString
createTintShade
(
sal_uInt8
nR
,
sal_uInt8
nG
,
sal_uInt8
nB
,
OUString
const
&
sReference
,
sal_Int16
nTintShade
)
{
Color
aColor
(
nR
,
nG
,
nB
);
if
(
sReference
!=
aColor
.
AsRGBHexString
())
{
fprintf
(
stderr
,
"FAILED: Input and reference color mismatch %s
\n
"
,
sReference
.
toUtf8
().
getStr
());
return
false
;
}
return
OUString
(
""
);
aColor
.
ApplyTintOrShade
(
nTintShade
);
if
(
sExpected
!=
aColor
.
AsRGBHexString
())
{
fprintf
(
stderr
,
"FAILED: Reference color is %s which differs from expect %s
\n
"
,
sReference
.
toUtf8
().
getStr
(),
sExpected
.
toUtf8
().
getStr
());
return
false
;
}
return
true
;
return
aColor
.
AsRGBHexString
();
}
void
Test
::
test_ApplyTintOrShade
()
...
...
@@ -103,47 +92,47 @@ void Test::test_ApplyTintOrShade()
// BLACK reference
// 5% tint
CPPUNIT_ASSERT
(
checkTintShade
(
0x00
,
0x00
,
0x00
,
"000000"
,
500
,
"0d0d0d"
));
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"0d0d0d"
),
createTintShade
(
0x00
,
0x00
,
0x00
,
"000000"
,
500
));
// 15% tint
CPPUNIT_ASSERT
(
checkTintShade
(
0x00
,
0x00
,
0x00
,
"000000"
,
1500
,
"262626"
));
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"262626"
),
createTintShade
(
0x00
,
0x00
,
0x00
,
"000000"
,
1500
));
// 25% tint
CPPUNIT_ASSERT
(
checkTintShade
(
0x00
,
0x00
,
0x00
,
"000000"
,
2500
,
"404040"
));
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"404040"
),
createTintShade
(
0x00
,
0x00
,
0x00
,
"000000"
,
2500
));
// 50% tint
CPPUNIT_ASSERT
(
checkTintShade
(
0x00
,
0x00
,
0x00
,
"000000"
,
5000
,
"808080"
));
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"808080"
),
createTintShade
(
0x00
,
0x00
,
0x00
,
"000000"
,
5000
));
// 100% tint
CPPUNIT_ASSERT
(
checkTintShade
(
0x00
,
0x00
,
0x00
,
"000000"
,
10000
,
"ffffff"
));
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"ffffff"
),
createTintShade
(
0x00
,
0x00
,
0x00
,
"000000"
,
10000
));
// WHITE reference
// 5% shade
CPPUNIT_ASSERT
(
checkTintShade
(
0xff
,
0xff
,
0xff
,
"ffffff"
,
-
500
,
"f2f2f2"
));
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"f2f2f2"
),
createTintShade
(
0xff
,
0xff
,
0xff
,
"ffffff"
,
-
500
));
// 15% shade
CPPUNIT_ASSERT
(
checkTintShade
(
0xff
,
0xff
,
0xff
,
"ffffff"
,
-
1500
,
"d9d9d9"
));
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"d9d9d9"
),
createTintShade
(
0xff
,
0xff
,
0xff
,
"ffffff"
,
-
1500
));
// 25% shade
CPPUNIT_ASSERT
(
checkTintShade
(
0xff
,
0xff
,
0xff
,
"ffffff"
,
-
2500
,
"bfbfbf"
));
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"bfbfbf"
),
createTintShade
(
0xff
,
0xff
,
0xff
,
"ffffff"
,
-
2500
));
// 50% shade
CPPUNIT_ASSERT
(
checkTintShade
(
0xff
,
0xff
,
0xff
,
"ffffff"
,
-
5000
,
"808080"
));
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"808080"
),
createTintShade
(
0xff
,
0xff
,
0xff
,
"ffffff"
,
-
5000
));
// 100% shade
CPPUNIT_ASSERT
(
checkTintShade
(
0xff
,
0xff
,
0xff
,
"ffffff"
,
-
10000
,
"000000"
));
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"000000"
),
createTintShade
(
0xff
,
0xff
,
0xff
,
"ffffff"
,
-
10000
));
// GREY reference
// 0% - no change
CPPUNIT_ASSERT
(
checkTintShade
(
0x80
,
0x80
,
0x80
,
"808080"
,
0
,
"808080"
));
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"808080"
),
createTintShade
(
0x80
,
0x80
,
0x80
,
"808080"
,
0
));
// 25% tint
CPPUNIT_ASSERT
(
checkTintShade
(
0x80
,
0x80
,
0x80
,
"808080"
,
2500
,
"a0a0a0"
));
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"a0a0a0"
),
createTintShade
(
0x80
,
0x80
,
0x80
,
"808080"
,
2500
));
// 50% tint
CPPUNIT_ASSERT
(
checkTintShade
(
0x80
,
0x80
,
0x80
,
"808080"
,
5000
,
"c0c0c0"
));
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"c0c0c0"
),
createTintShade
(
0x80
,
0x80
,
0x80
,
"808080"
,
5000
));
// 100% tint
CPPUNIT_ASSERT
(
checkTintShade
(
0x80
,
0x80
,
0x80
,
"808080"
,
10000
,
"ffffff"
));
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"ffffff"
),
createTintShade
(
0x80
,
0x80
,
0x80
,
"808080"
,
10000
));
// 25% shade
CPPUNIT_ASSERT
(
checkTintShade
(
0x80
,
0x80
,
0x80
,
"808080"
,
-
2500
,
"606060"
));
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"606060"
),
createTintShade
(
0x80
,
0x80
,
0x80
,
"808080"
,
-
2500
));
// 50% shade
CPPUNIT_ASSERT
(
checkTintShade
(
0x80
,
0x80
,
0x80
,
"808080"
,
-
5000
,
"404040"
));
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"404040"
),
createTintShade
(
0x80
,
0x80
,
0x80
,
"808080"
,
-
5000
));
// 100% shade
CPPUNIT_ASSERT
(
checkTintShade
(
0x80
,
0x80
,
0x80
,
"808080"
,
-
10000
,
"000000"
));
CPPUNIT_ASSERT
_EQUAL
(
OUString
(
"000000"
),
createTintShade
(
0x80
,
0x80
,
0x80
,
"808080"
,
-
10000
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment