Skip to content

Commit 87560bf

Browse files
committed
Added a tga reversed-alpha-channel load test.
1 parent ec41a15 commit 87560bf

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

UnitTests/Src/TestImage.cpp

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,26 @@ tTestUnit(ImageSave)
152152
tString origDir = tSystem::tGetCurrentDir();
153153
tSystem::tSetCurrentDir(origDir + "TestData/Images/");
154154

155+
tImageTGA::LoadParams tgaParams;
156+
tgaParams.Flags &= ~tImageTGA::LoadFlag_AlphaOpacity;
157+
tImageTGA tgaReversed("ReversedAlpha16Bit_5551.tga", tgaParams);
158+
int rtgaW = tgaReversed.GetWidth();
159+
int rtgaH = tgaReversed.GetHeight();
160+
tPixel4b* rtgaPixels = tgaReversed.StealPixels();
161+
tImageQOI rqoi(rtgaPixels, rtgaW, rtgaH, true);
162+
tImageQOI::tFormat rresult32 = rqoi.Save("WrittenReversedAlpha16Bit_5551.qoi", tImageQOI::tFormat::BPP32);
163+
tRequire(rresult32 == tImageQOI::tFormat::BPP32);
164+
165+
tImageTGA tgaPattern("TacentTestPattern32.tga");
166+
int tgaW = tgaPattern.GetWidth();
167+
int tgaH = tgaPattern.GetHeight();
168+
tPixel4b* tgaPixels = tgaPattern.StealPixels();
169+
tImageQOI qoi(tgaPixels, tgaW, tgaH, true);
170+
tImageQOI::tFormat result32 = qoi.Save("WrittenTacentTestPattern32.qoi", tImageQOI::tFormat::BPP32);
171+
tRequire(result32 == tImageQOI::tFormat::BPP32);
172+
tImageQOI::tFormat result24 = qoi.Save("WrittenTacentTestPattern24.qoi", tImageQOI::tFormat::BPP24);
173+
tRequire(result24 == tImageQOI::tFormat::BPP24);
174+
155175
tList<tFrame> frames;
156176

157177
// Test dither from 0.0f (auto) to 1.5f.
@@ -192,16 +212,6 @@ tTestUnit(ImageSave)
192212
TestSaveGif("Icos4D.apng", tPixelFormat::PAL7BIT, tQuantize::Method::Wu, true);
193213
TestSaveGif("Icos4D.apng", tPixelFormat::PAL8BIT, tQuantize::Method::Wu, true);
194214

195-
tImageTGA tga("TacentTestPattern32.tga");
196-
int tgaW = tga.GetWidth();
197-
int tgaH = tga.GetHeight();
198-
tPixel4b* tgaPixels = tga.StealPixels();
199-
tImageQOI qoi(tgaPixels, tgaW, tgaH, true);
200-
tImageQOI::tFormat result32 = qoi.Save("WrittenTacentTestPattern32.qoi", tImageQOI::tFormat::BPP32);
201-
tRequire(result32 == tImageQOI::tFormat::BPP32);
202-
tImageQOI::tFormat result24 = qoi.Save("WrittenTacentTestPattern24.qoi", tImageQOI::tFormat::BPP24);
203-
tRequire(result24 == tImageQOI::tFormat::BPP24);
204-
205215
tImagePNG pngA("PNG/Xeyes.png");
206216
pngA.Save("WrittenNewA.png");
207217
tRequire( tSystem::tFileExists("WrittenNewA.png"));

UnitTests/Src/UnitTests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ int main(int argc, char** argv)
215215
// tTest(Rule);
216216
#if !defined(ARCHITECTURE_ARM32) && !defined(ARCHITECTURE_ARM64)
217217
// tTest(ImageLoad);
218-
// tTest(ImageSave);
218+
tTest(ImageSave);
219219
// tTest(ImageTexture);
220-
tTest(ImageMultiFrame);
220+
// tTest(ImageMultiFrame);
221221
// tTest(ImagePicture);
222222
// tTest(ImageQuantize);
223223
// tTest(ImagePalette);

0 commit comments

Comments
 (0)