]> git.lyx.org Git - lyx.git/blob - src/tests/check_Length.cpp
This is LyX 2.2.0
[lyx.git] / src / tests / check_Length.cpp
1 #include <config.h>
2
3 #include "../Length.h"
4 #include "../LyXRC.h"
5 #include "../support/debug.h"
6
7 #include <iostream>
8
9
10 using namespace lyx;
11 using namespace std;
12
13
14 void test_inPixels()
15 {
16         // want to see non-zero SP
17         lyxrc.zoom = 100000;
18         lyxrc.dpi = 72;
19         for (int i = Length::BP; i <= Length::UNIT_NONE; ++i) {
20                 Length const l(2342, static_cast<Length::UNIT>(i));
21                 cout << l.inPixels(250) << endl;
22         }
23 }
24
25
26 void test_inBP()
27 {
28         for (int i = Length::BP; i <= Length::UNIT_NONE; ++i) {
29                 Length const l(2342, static_cast<Length::UNIT>(i));
30                 cout << l.inBP() << endl;
31         }
32 }
33
34
35 int main(int, char **)
36 {
37         // Connect lyxerr with cout instead of cerr to catch error output
38         lyx::lyxerr.setStream(cout);
39         test_inPixels();
40         test_inBP();
41 }