2016-06-20 04:16:05 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <cxxtest/TestSuite.h>
|
|
|
|
|
|
|
|
#include <xlnt/xlnt.hpp>
|
|
|
|
|
|
|
|
class test_page_setup : public CxxTest::TestSuite
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void test_properties()
|
|
|
|
{
|
|
|
|
xlnt::page_setup ps;
|
|
|
|
|
2016-12-02 21:37:50 +08:00
|
|
|
TS_ASSERT_EQUALS(ps.paper_size(), xlnt::paper_size::letter);
|
|
|
|
ps.paper_size(xlnt::paper_size::executive);
|
|
|
|
TS_ASSERT_EQUALS(ps.paper_size(), xlnt::paper_size::executive);
|
2016-06-20 04:16:05 +08:00
|
|
|
|
2016-12-02 21:37:50 +08:00
|
|
|
TS_ASSERT_EQUALS(ps.orientation(), xlnt::orientation::portrait);
|
|
|
|
ps.orientation(xlnt::orientation::landscape);
|
|
|
|
TS_ASSERT_EQUALS(ps.orientation(), xlnt::orientation::landscape);
|
2016-06-20 04:16:05 +08:00
|
|
|
|
|
|
|
TS_ASSERT(!ps.fit_to_page());
|
2016-12-02 21:37:50 +08:00
|
|
|
ps.fit_to_page(true);
|
2016-06-20 04:16:05 +08:00
|
|
|
TS_ASSERT(ps.fit_to_page());
|
|
|
|
|
|
|
|
TS_ASSERT(!ps.fit_to_height());
|
2016-12-02 21:37:50 +08:00
|
|
|
ps.fit_to_height(true);
|
2016-06-20 04:16:05 +08:00
|
|
|
TS_ASSERT(ps.fit_to_height());
|
|
|
|
|
|
|
|
TS_ASSERT(!ps.fit_to_width());
|
2016-12-02 21:37:50 +08:00
|
|
|
ps.fit_to_width(true);
|
2016-06-20 04:16:05 +08:00
|
|
|
TS_ASSERT(ps.fit_to_width());
|
|
|
|
|
2016-12-02 21:37:50 +08:00
|
|
|
TS_ASSERT(!ps.horizontal_centered());
|
|
|
|
ps.horizontal_centered(true);
|
|
|
|
TS_ASSERT(ps.horizontal_centered());
|
2016-06-20 04:16:05 +08:00
|
|
|
|
2016-12-02 21:37:50 +08:00
|
|
|
TS_ASSERT(!ps.vertical_centered());
|
|
|
|
ps.vertical_centered(true);
|
|
|
|
TS_ASSERT(ps.vertical_centered());
|
2016-06-20 04:16:05 +08:00
|
|
|
}
|
|
|
|
};
|