GCC Code Coverage Report


Directory: ./
File: tmp_project/PhoenixPresentation/tmp_project/PhoenixInkscape/src/pinkscape_slide.cpp
Date: 2025-03-24 18:12:43
Exec Total Coverage
Lines: 14 19 73.7%
Branches: 21 48 43.8%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5 ****************************************/
6
7 #include <sys/stat.h>
8 #include <sys/types.h>
9 #include <fstream>
10
11 #include "data_all.h"
12 #include "convertToString.h"
13
14 #include "pinkscape_slide.h"
15
16 ///Load the map file of all the formulae if it exists
17 /** @param[out] mapFormula : map of formulae to be loaded to avoid calling latex too much
18 */
19 1 void pinkscape_loadSlideMap(PMapSlide & mapFormula, const PPath & baseOutputName){
20
5/5
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
2 PPath fileName(baseOutputName + PPath(SLIDE_RECOVER_FILE));
21
2/3
✓ Branch 1 taken 1 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 if(!data_load(fileName, mapFormula)){return;}
22
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
1 }
23
24 ///Save the map file of the formulae to avoid extra latex call
25 /** @param[out] mapFormula : map of formulae to be saved
26 */
27 1 void pinkscape_saveSlideMap(const PMapSlide & mapFormula, const PPath & baseOutputName){
28
5/5
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
2 PPath fileName(baseOutputName + PPath(SLIDE_RECOVER_FILE));
29
2/3
✓ Branch 1 taken 1 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 if(!data_save(fileName, mapFormula)){return;}
30
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
1 }
31
32 ///Check if the slide we are going to save was already saved (with the same content) or not
33 /** @param[out] outputMode : output mode to be checked and/or updated
34 * @param outputSlide : output file name of the current slide
35 * @param slideContent : content of the slide in svg
36 */
37 9 bool pinkscape_isSlideKnown(POutoutMode & outputMode, const PPath & outputSlide, const PString & slideContent){
38 9 PMapSlide & mapSlide = outputMode.mapSlide;
39
1/1
✓ Branch 1 taken 9 times.
9 PMapSlide::iterator it(mapSlide.find(outputSlide));
40
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 9 times.
9 if(it != mapSlide.end()){ //The slide is already known
41 if(it->second == slideContent){ //If the slide content is the same
42 if(outputSlide.isFileExist()){ //We do not need to save it because it already exist
43 return true;
44 }else{
45 std::cout << "pinkscape_isSlideKnown : file '"<<outputSlide<<"' does not exist" << std::endl;
46 }
47 }else{
48 std::cout << "pinkscape_isSlideKnown : '"<<outputSlide<<" 'slide content changed" << std::endl;
49 }
50 }
51 //The slide is not known
52
53 //Let's update the slide content (or create it)
54
3/3
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
9 mapSlide[outputSlide] = slideContent;
55 9 return false;
56 }
57
58
59
60
61
62