Pavel Sanda wrote: > Pavel Sanda wrote: > > Scott Kostyshak wrote: > > > Packagers, please prepare your binaries. > > > > Gentoo build now fails for tests/test_Length. P > > diff: > --- runtime.output 2016-02-10 18:47:27.000000000 -0800 > +++ Length 2015-07-22 08:54:17.000000000 -0700 > @@ -12,7 +12,7 @@ > 36 > 5855 > 5855 > -9953 > +9954 > 5855 > 10463 > 12881
Can anyone reproduce this behavior?: 1. patch master with the attached file 2. make check 3. src/check_Length 1000 0.13837 0.00347222 9953 9953 Now, let's go surreal 4. uncomment either of lines from the patch, eg first one // lyxerr<<result<<endl; // lyxerr<<(result + ((result >= 0) ? 0.5 : -0.5))<<endl; 5. make check 6. src/check_Length 1000 0.13837 0.00347222 9953.5 9954 9954 gcc --version gcc (Gentoo 4.9.3 p1.3, pie-0.6.3) 4.9.3 Pavel
diff --git a/src/Length.cpp b/src/Length.cpp index 44c3c81..a11a532 100644 --- a/src/Length.cpp +++ b/src/Length.cpp @@ -197,6 +197,7 @@ int Length::inPixels(int text_width, int em_width_base) const { // Zoom factor specified by user in percent double const zoom = lyxrc.zoom / 100.0; // [percent] + lyxerr<<zoom<<endl; // DPI setting for monitor: pixels/inch double const dpi = lyxrc.dpi; // screen resolution [pixels/inch] @@ -204,6 +205,7 @@ int Length::inPixels(int text_width, int em_width_base) const double const em_width_in = (em_width_base > 0) ? em_width_base / (zoom * dpi) : 10.0/72.27; + lyxerr<<em_width_in<<endl; // A different estimate for em_width is // theFontMetrics(FontInfo(sane_font)).em() // but this estimate might not be more accurate as the screen font @@ -214,7 +216,11 @@ int Length::inPixels(int text_width, int em_width_base) const // is the same as on paper. double const text_width_in = text_width / (zoom * dpi); + lyxerr<<text_width_in<<endl; double const result = zoom * dpi * inInch(text_width_in, em_width_in); +// lyxerr<<result<<endl; +// lyxerr<<(result + ((result >= 0) ? 0.5 : -0.5))<<endl; + lyxerr<<static_cast<int>(result + ((result >= 0) ? 0.5 : -0.5))<<endl; return static_cast<int>(result + ((result >= 0) ? 0.5 : -0.5)); } diff --git a/src/tests/check_Length.cpp b/src/tests/check_Length.cpp index 8311e45..dc0d7f3 100644 --- a/src/tests/check_Length.cpp +++ b/src/tests/check_Length.cpp @@ -16,7 +16,7 @@ void test_inPixels() // want to see non-zero SP lyxrc.zoom = 100000; lyxrc.dpi = 72; - for (int i = Length::BP; i <= Length::UNIT_NONE; ++i) { + for (int i = 14; i <= 14; ++i) { Length const l(2342, static_cast<Length::UNIT>(i)); cout << l.inPixels(250) << endl; } @@ -37,5 +37,5 @@ int main(int, char **) // Connect lyxerr with cout instead of cerr to catch error output lyx::lyxerr.setStream(cout); test_inPixels(); - test_inBP(); +// test_inBP(); }