diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-04-02 23:14:10 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-04-04 14:10:40 +0200 |
commit | 12f1eb15ca3fed6310402847559a7c99d3c77847 (patch) | |
tree | 8935675b623c6f3b4914b8b44f7fa5f2816a9241 /libtests/matrix.cc | |
parent | f20fa61eb4c323eb1642c69c236b3d9a1f8b2cdb (diff) | |
download | qpdf-12f1eb15ca3fed6310402847559a7c99d3c77847.tar.zst |
Programmatically apply new formatting to code
Run this:
for i in **/*.cc **/*.c **/*.h **/*.hh; do
clang-format < $i >| $i.new && mv $i.new $i
done
Diffstat (limited to 'libtests/matrix.cc')
-rw-r--r-- | libtests/matrix.cc | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/libtests/matrix.cc b/libtests/matrix.cc index 210c022f..7dc73390 100644 --- a/libtests/matrix.cc +++ b/libtests/matrix.cc @@ -8,45 +8,50 @@ #endif #include <cassert> -static void check(QPDFMatrix const& m, std::string const& exp) +static void +check(QPDFMatrix const& m, std::string const& exp) { std::string u = m.unparse(); - if (u != exp) - { + if (u != exp) { std::cout << "got " << u << ", wanted " << exp << std::endl; } } -static void check_xy(double x, double y, std::string const& exp) +static void +check_xy(double x, double y, std::string const& exp) { - std::string u = (QUtil::double_to_string(x, 2) + " " + - QUtil::double_to_string(y, 2)); - if (u != exp) - { + std::string u = + (QUtil::double_to_string(x, 2) + " " + QUtil::double_to_string(y, 2)); + if (u != exp) { std::cout << "got " << u << ", wanted " << exp << std::endl; } } -static void check_rect(QPDFObjectHandle::Rectangle const& r, - double llx, double lly, double urx, double ury) +static void +check_rect( + QPDFObjectHandle::Rectangle const& r, + double llx, + double lly, + double urx, + double ury) { - std::string actual = ( - QUtil::double_to_string(r.llx, 2) + " " + - QUtil::double_to_string(r.lly, 2) + " " + - QUtil::double_to_string(r.urx, 2) + " " + - QUtil::double_to_string(r.ury, 2)); - std::string wanted = ( - QUtil::double_to_string(llx, 2) + " " + - QUtil::double_to_string(lly, 2) + " " + - QUtil::double_to_string(urx, 2) + " " + - QUtil::double_to_string(ury, 2)); - if (actual != wanted) - { + std::string actual = + (QUtil::double_to_string(r.llx, 2) + " " + + QUtil::double_to_string(r.lly, 2) + " " + + QUtil::double_to_string(r.urx, 2) + " " + + QUtil::double_to_string(r.ury, 2)); + std::string wanted = + (QUtil::double_to_string(llx, 2) + " " + + QUtil::double_to_string(lly, 2) + " " + + QUtil::double_to_string(urx, 2) + " " + + QUtil::double_to_string(ury, 2)); + if (actual != wanted) { std::cout << "got " << actual << ", wanted " << wanted << std::endl; } } -int main() +int +main() { QPDFMatrix m; check(m, "1 0 0 1 0 0"); @@ -78,17 +83,20 @@ int main() m.transform(240, 480, xp, yp); check_xy(xp, yp, "2582.5 4912"); - check(QPDFMatrix( - QPDFObjectHandle::parse( - "[3 1 4 1 5 9.26535]").getArrayAsMatrix()), - "3 1 4 1 5 9.26535"); + check( + QPDFMatrix( + QPDFObjectHandle::parse("[3 1 4 1 5 9.26535]").getArrayAsMatrix()), + "3 1 4 1 5 9.26535"); m = QPDFMatrix(); m.rotatex90(90); m.translate(200, -100); check_rect( m.transformRectangle(QPDFObjectHandle::Rectangle(10, 20, 30, 50)), - 50, 210, 80, 230); + 50, + 210, + 80, + 230); std::cout << "matrix tests done" << std::endl; return 0; |