GCC Code Coverage Report


Directory: ./
File: TESTS/TEST_SET_COLOR/main.cpp
Date: 2025-09-08 17:09:06
Exec Total Coverage
Lines: 19 19 100.0%
Functions: 2 2 100.0%
Branches: 23 23 100.0%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5 ****************************************/
6
7 #include "PImagePng.h"
8
9 ///Test the write of a png file
10 /** @return true on success, false otherwise
11 */
12 5 bool testWriteColorPng(const PPath & fileName, color_t red, color_t green, color_t blue){
13 5 bool b(true);
14
15 5 size_t width(640lu), height(480lu);
16
1/1
✓ Branch 0 (2→3) taken 5 times.
5 PImagePng image;
17
1/1
✓ Branch 0 (3→4) taken 5 times.
5 b &= image.createImage(width, height);
18
2/2
✓ Branch 0 (10→5) taken 2400 times.
✓ Branch 1 (10→11) taken 5 times.
2405 for(size_t j(0lu); j < height; ++j){
19
2/2
✓ Branch 0 (8→6) taken 1536000 times.
✓ Branch 1 (8→9) taken 2400 times.
1538400 for(size_t i(0lu); i < width; ++i){
20
1/1
✓ Branch 0 (6→7) taken 1536000 times.
1536000 image.setColor(i, j, red, green, blue);
21 }
22 }
23
24
1/1
✓ Branch 0 (11→12) taken 5 times.
5 b &= image.write(fileName);
25
26 5 return b;
27 5 }
28
29 1 int main(int argc, char** argv){
30 1 bool b(true);
31
3/3
✓ Branch 0 (2→3) taken 1 times.
✓ Branch 2 (3→4) taken 1 times.
✓ Branch 4 (4→5) taken 1 times.
1 b &= testWriteColorPng(PPath("outputRed.png"), 255, 0, 0);
32
3/3
✓ Branch 0 (7→8) taken 1 times.
✓ Branch 2 (8→9) taken 1 times.
✓ Branch 4 (9→10) taken 1 times.
1 b &= testWriteColorPng(PPath("outputGreen.png"), 0, 255, 0);
33
3/3
✓ Branch 0 (12→13) taken 1 times.
✓ Branch 2 (13→14) taken 1 times.
✓ Branch 4 (14→15) taken 1 times.
1 b &= testWriteColorPng(PPath("outputBlue.png"), 0, 0, 255);
34
3/3
✓ Branch 0 (17→18) taken 1 times.
✓ Branch 2 (18→19) taken 1 times.
✓ Branch 4 (19→20) taken 1 times.
1 b &= testWriteColorPng(PPath("outputBlack.png"), 0, 0, 0);
35
3/3
✓ Branch 0 (22→23) taken 1 times.
✓ Branch 2 (23→24) taken 1 times.
✓ Branch 4 (24→25) taken 1 times.
1 b &= testWriteColorPng(PPath("outputWhite.png"), 255, 255, 255);
36 1 return b - 1;
37 }
38
39