lyx_mirror/src/tests/check_Length.cpp
Daniel Ramöller 4183a9f4dc Preferences shows current zoom instead of preference's default zoom (#10455)
- Adds a currentZoom variable which holds the current zoom level.

- The zoom stored in preferences is used as default zoom level (default binding:
  M+0).

- The currentZoom is saved and restored via QSettings.

- Adds LFUN buffer-zoom for (re)setting zoom.
2017-05-07 14:17:54 +02:00

42 lines
796 B
C++

#include <config.h>
#include "../Length.h"
#include "../LyXRC.h"
#include "../support/debug.h"
#include <iostream>
using namespace lyx;
using namespace std;
void test_inPixels()
{
// want to see non-zero SP
lyxrc.currentZoom = 100000;
lyxrc.dpi = 72;
for (int i = Length::BP; i <= Length::UNIT_NONE; ++i) {
Length const l(2342, static_cast<Length::UNIT>(i));
cout << l.inPixels(250) << " pix(250) = " << l.asString() << endl;
}
}
void test_inBP()
{
for (int i = Length::BP; i <= Length::UNIT_NONE; ++i) {
Length const l(2342, static_cast<Length::UNIT>(i));
cout << l.inBP() << " BP = " << l.asString() << endl;
}
}
int main(int, char **)
{
// Connect lyxerr with cout instead of cerr to catch error output
lyx::lyxerr.setStream(cout);
test_inPixels();
test_inBP();
}