1#include <gtest/gtest.h>
19 return s.find(
"nan") != std::string::npos
or
20 s.find(
"inf") != std::string::npos;
42 const std::string result =
output.str();
44 EXPECT_NE(result.find(
"\\begin{tikzpicture}"), std::string::npos);
45 EXPECT_NE(result.find(
"\\clip (-1.000000,-1.000000) rectangle (101.000000,61.000000);"),
47 EXPECT_NE(result.find(
"\\end{tikzpicture}"), std::string::npos);
59 const std::string result =
output.str();
60 EXPECT_NE(result.find(
"\\fill"), std::string::npos);
72 const std::string result =
output.str();
73 EXPECT_NE(result.find(
"\\draw"), std::string::npos);
83 const std::string result =
output.str();
84 EXPECT_NE(result.find(
"\\draw"), std::string::npos);
110 std::ostringstream
output;
112 const std::string result =
output.str();
114 EXPECT_NE(result.find(
"ellipse [x radius="), std::string::npos);
115 EXPECT_NE(result.find(
"\\node"), std::string::npos);
116 EXPECT_NE(result.find(
"-- cycle;"), std::string::npos);
130 std::ostringstream
output;
132 const std::string result =
output.str();
134 EXPECT_NE(result.find(
"\\fill"), std::string::npos);
135 EXPECT_NE(result.find(
"-- cycle;"), std::string::npos);
145 std::ostringstream
output;
147 const std::string result =
output.str();
149 EXPECT_NE(result.find(
"\\draw["), std::string::npos);
150 EXPECT_NE(result.find(
"draw=gray"), std::string::npos);
151 EXPECT_NE(result.find(
"->"), std::string::npos);
160 std::ostringstream
output;
162 const std::string result =
output.str();
164 EXPECT_NE(result.find(
"-- cycle;"), std::string::npos);
165 EXPECT_NE(result.find(
"\\draw"), std::string::npos);
174 std::ostringstream
output;
176 const std::string result =
output.str();
178 EXPECT_NE(result.find(
"A\\_\\%\\$\\#\\&\\{\\}\\textbackslash{}B"), std::string::npos);
186 std::ostringstream
output;
188 const std::string result =
output.str();
190 EXPECT_NE(result.find(
"\\clip (-3.500000,-3.500000) rectangle (103.500000,63.500000);"),
200 std::ostringstream
output;
202 const std::string result =
output.str();
204 EXPECT_NE(result.find(
"\\draw"), std::string::npos);
216 std::ostringstream
output;
218 const std::string result =
output.str();
220 EXPECT_NE(result.find(
".. controls"), std::string::npos);
221 EXPECT_NE(result.find(
" and "), std::string::npos);
233 std::ostringstream
output;
235 const std::string result =
output.str();
237 EXPECT_NE(result.find(
"anchor=west"), std::string::npos);
238 EXPECT_NE(result.find(
"above right"), std::string::npos);
245 style.
pattern =
"north east lines";
255 std::ostringstream
output;
257 const std::string result =
output.str();
259 EXPECT_NE(result.find(
"pattern=north east lines"), std::string::npos);
260 EXPECT_NE(result.find(
"pattern color=black"), std::string::npos);
284 std::ostringstream
output;
286 const std::string result =
output.str();
288 EXPECT_NE(result.find(
"\\pgfdeclarelayer{background}"), std::string::npos);
289 EXPECT_NE(result.find(
"\\begin{pgfonlayer}{foreground}"), std::string::npos);
290 EXPECT_NE(result.find(
"\\tikzset{edgeA/.style="), std::string::npos);
291 EXPECT_NE(result.find(
"edgeA"), std::string::npos);
292 EXPECT_NE(result.find(
"draw=gray!40"), std::string::npos);
293 EXPECT_NE(result.find(
"\\node[anchor=west]"), std::string::npos);
Represents a point with rectangular coordinates in a 2D plane.
Polar representation of a 2D point.
A general (irregular) 2D polygon defined by a sequence of vertices.
void add_vertex(const Point &point)
Add a vertex to the polygon.
void close()
Close the polygon.
An axis-aligned rectangle.
A regular polygon defined by center, side length, and vertex count.
An ellipse with arbitrary rotation.
Represents a line segment between two points.
Represents a text string positioned at a 2D point.
2D TikZ canvas storing geometry objects and emitting LaTeX output.
void draw(std::ostream &output, const bool squarize=true) const
Emit a complete tikzpicture with all inserted objects.
void set_clip_padding_mm(const double &padding_mm)
Configure clip expansion around frame borders.
void put_cartesian_axis()
Enable Cartesian axes drawing (only when 0 lies in range).
const double & get_wide() const
Plane width in millimeters.
const double & get_height() const
Plane height in millimeters.
static constexpr int Layer_Foreground
void enable_auto_legend(const bool enabled=true)
Enable auto-legend generation from style colors.
void enable_native_tikz_layers(const bool enabled=true)
Enable native PGF layers (\pgfdeclarelayer).
size_t size() const
Number of currently inserted objects.
void put_coordinate_grid(const double step_x=1.0, const double step_y=1.0, const bool draw_ticks=true)
Enable coordinate grid/ticks with user step sizes.
const double & get_yoffset() const
Vertical scope offset in millimeters.
static constexpr int Layer_Background
void register_tikz_style(const std::string &name, const Tikz_Style &style)
Register a reusable \tikzset style for the rendered picture.
const double & get_xoffset() const
Horizontal scope offset in millimeters.
A non-degenerate triangle defined by three points.
Main namespace for Aleph-w library functions.
std::string tolower(const char *str)
Convert a C std::string to lower-case.
void put_in_plane(Tikz_Plane &plane, const Geom &geom_obj)
Insert any supported geometry type in a Tikz_Plane.
void put_cubic_bezier_native_in_plane(Tikz_Plane &plane, const Point &p0, const Point &p1, const Point &p2, const Point &p3, const Tikz_Style &style={}, const int layer=Tikz_Plane::Layer_Default)
Insert a cubic Bézier using native TikZ controls syntax.
void put_quadratic_bezier_native_in_plane(Tikz_Plane &plane, const Point &p0, const Point &p1, const Point &p2, const Tikz_Style &style={}, const int layer=Tikz_Plane::Layer_Default)
Insert a quadratic Bézier using native TikZ controls syntax.
void put_cubic_bezier_in_plane(Tikz_Plane &plane, const Point &p0, const Point &p1, const Point &p2, const Point &p3, const size_t subdivisions=64, const Tikz_Style &style={}, const int layer=Tikz_Plane::Layer_Default)
Approximate and insert a cubic Bézier as an open polyline.
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
void put_quadratic_bezier_in_plane(Tikz_Plane &plane, const Point &p0, const Point &p1, const Point &p2, const size_t subdivisions=64, const Tikz_Style &style={}, const int layer=Tikz_Plane::Layer_Default)
Approximate and insert a quadratic Bézier as an open polyline.
Tikz_Style make_tikz_draw_style(const std::string &draw_color)
Create a basic draw style with a custom color.
Tikz_Style make_tikz_fill_style(const std::string &draw_color, const std::string &fill_color)
Create a basic fill style with custom draw/fill colors.
2D infinite line in slope-intercept form.
Style descriptor for TikZ primitives.
std::string text_anchor
TikZ node anchor (anchor=<value>)
std::string pattern
TikZ pattern (e.g. north east lines)
std::string text_placement
TikZ placement (above, below left, ...)
std::string tikz_style_name
Optional named style (from \tikzset)
std::string pattern_color
TikZ pattern color (pattern color=<color>)
TikZ/LaTeX geometric drawing utilities.