Add unit tests of coordinates conversion functions

This commit is contained in:
Artur Wieczorek
2020-09-26 01:43:20 +02:00
parent 08599d894f
commit 6fac6c0b35
12 changed files with 916 additions and 4 deletions
+32 -4
View File
@@ -206,52 +206,80 @@ public:
/**
Convert @e device X coordinate to logical coordinate, using the current
mapping mode, user scale factor, device origin and axis orientation.
@note Affine transformation applied to the coordinate system
with SetTransformMatrix() is not taken into account.
*/
wxCoord DeviceToLogicalX(wxCoord x) const;
/**
Convert @e device X coordinate to relative logical coordinate, using the
current mapping mode and user scale factor but ignoring the
axis orientation. Use this for converting a width, for example.
axis orientation. Use this for converting a horizontal distance like
for example a width.
@note Affine transformation applied to the coordinate system
with SetTransformMatrix() is not taken into account.
*/
wxCoord DeviceToLogicalXRel(wxCoord x) const;
/**
Converts @e device Y coordinate to logical coordinate, using the current
mapping mode, user scale factor, device origin and axis orientation.
@note Affine transformation applied to the coordinate system
with SetTransformMatrix() is not taken into account.
*/
wxCoord DeviceToLogicalY(wxCoord y) const;
/**
Convert @e device Y coordinate to relative logical coordinate, using the
current mapping mode and user scale factor but ignoring the
axis orientation. Use this for converting a height, for example.
axis orientation. Use this for converting a vertical distance like
for example a height.
@note Affine transformation applied to the coordinate system
with SetTransformMatrix() is not taken into account.
*/
wxCoord DeviceToLogicalYRel(wxCoord y) const;
/**
Converts logical X coordinate to device coordinate, using the current
mapping mode, user scale factor, device origin and axis orientation.
@note Affine transformation applied to the coordinate system
with SetTransformMatrix() is not taken into account.
*/
wxCoord LogicalToDeviceX(wxCoord x) const;
/**
Converts logical X coordinate to relative device coordinate, using the
current mapping mode and user scale factor but ignoring the
axis orientation. Use this for converting a width, for example.
axis orientation. Use this for converting a horizontal distance like
for example a width.
@note Affine transformation applied to the coordinate system
with SetTransformMatrix() is not taken into account.
*/
wxCoord LogicalToDeviceXRel(wxCoord x) const;
/**
Converts logical Y coordinate to device coordinate, using the current
mapping mode, user scale factor, device origin and axis orientation.
@note Affine transformation applied to the coordinate system
with SetTransformMatrix() is not taken into account.
*/
wxCoord LogicalToDeviceY(wxCoord y) const;
/**
Converts logical Y coordinate to relative device coordinate, using the
current mapping mode and user scale factor but ignoring the
axis orientation. Use this for converting a height, for example.
axis orientation. Use this for converting a vertical distance like
for example a height.
@note Affine transformation applied to the coordinate system
with SetTransformMatrix() is not taken into account.
*/
wxCoord LogicalToDeviceYRel(wxCoord y) const;
+4
View File
@@ -185,6 +185,7 @@ TEST_GUI_OBJECTS = \
test_gui_affinematrix.o \
test_gui_boundingbox.o \
test_gui_clippingbox.o \
test_gui_coords.o \
test_gui_graphmatrix.o \
test_gui_graphpath.o \
test_gui_config.o \
@@ -899,6 +900,9 @@ test_gui_boundingbox.o: $(srcdir)/graphics/boundingbox.cpp $(TEST_GUI_ODEP)
test_gui_clippingbox.o: $(srcdir)/graphics/clippingbox.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/graphics/clippingbox.cpp
test_gui_coords.o: $(srcdir)/graphics/coords.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/graphics/coords.cpp
test_gui_graphmatrix.o: $(srcdir)/graphics/graphmatrix.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/graphics/graphmatrix.cpp
File diff suppressed because it is too large Load Diff
+4
View File
@@ -168,6 +168,7 @@ TEST_GUI_OBJECTS = \
$(OBJS)\test_gui_affinematrix.obj \
$(OBJS)\test_gui_boundingbox.obj \
$(OBJS)\test_gui_clippingbox.obj \
$(OBJS)\test_gui_coords.obj \
$(OBJS)\test_gui_graphmatrix.obj \
$(OBJS)\test_gui_graphpath.obj \
$(OBJS)\test_gui_config.obj \
@@ -907,6 +908,9 @@ $(OBJS)\test_gui_boundingbox.obj: .\graphics\boundingbox.cpp
$(OBJS)\test_gui_clippingbox.obj: .\graphics\clippingbox.cpp
$(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\graphics\clippingbox.cpp
$(OBJS)\test_gui_coords.obj: .\graphics\coords.cpp
$(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\graphics\coords.cpp
$(OBJS)\test_gui_graphmatrix.obj: .\graphics\graphmatrix.cpp
$(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\graphics\graphmatrix.cpp
+4
View File
@@ -163,6 +163,7 @@ TEST_GUI_OBJECTS = \
$(OBJS)\test_gui_affinematrix.o \
$(OBJS)\test_gui_boundingbox.o \
$(OBJS)\test_gui_clippingbox.o \
$(OBJS)\test_gui_coords.o \
$(OBJS)\test_gui_graphmatrix.o \
$(OBJS)\test_gui_graphpath.o \
$(OBJS)\test_gui_config.o \
@@ -892,6 +893,9 @@ $(OBJS)\test_gui_boundingbox.o: ./graphics/boundingbox.cpp
$(OBJS)\test_gui_clippingbox.o: ./graphics/clippingbox.cpp
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\test_gui_coords.o: ./graphics/coords.cpp
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\test_gui_graphmatrix.o: ./graphics/graphmatrix.cpp
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
+4
View File
@@ -177,6 +177,7 @@ TEST_GUI_OBJECTS = \
$(OBJS)\test_gui_affinematrix.obj \
$(OBJS)\test_gui_boundingbox.obj \
$(OBJS)\test_gui_clippingbox.obj \
$(OBJS)\test_gui_coords.obj \
$(OBJS)\test_gui_graphmatrix.obj \
$(OBJS)\test_gui_graphpath.obj \
$(OBJS)\test_gui_config.obj \
@@ -1320,6 +1321,9 @@ $(OBJS)\test_gui_boundingbox.obj: .\graphics\boundingbox.cpp
$(OBJS)\test_gui_clippingbox.obj: .\graphics\clippingbox.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\graphics\clippingbox.cpp
$(OBJS)\test_gui_coords.obj: .\graphics\coords.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\graphics\coords.cpp
$(OBJS)\test_gui_graphmatrix.obj: .\graphics\graphmatrix.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\graphics\graphmatrix.cpp
+1
View File
@@ -181,6 +181,7 @@
graphics/affinematrix.cpp
graphics/boundingbox.cpp
graphics/clippingbox.cpp
graphics/coords.cpp
graphics/graphmatrix.cpp
graphics/graphpath.cpp
config/config.cpp
+1
View File
@@ -547,6 +547,7 @@
<ClCompile Include="graphics\bitmap.cpp" />
<ClCompile Include="graphics\boundingbox.cpp" />
<ClCompile Include="graphics\clippingbox.cpp" />
<ClCompile Include="graphics\coords.cpp" />
<ClCompile Include="graphics\graphmatrix.cpp" />
<ClCompile Include="graphics\graphpath.cpp" />
<ClCompile Include="graphics\colour.cpp" />
+3
View File
@@ -293,6 +293,9 @@
<ClCompile Include="graphics\clippingbox.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="graphics\coords.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="graphics\graphmatrix.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+3
View File
@@ -358,6 +358,9 @@
<File
RelativePath=".\config\config.cpp">
</File>
<File
RelativePath=".\graphics\coords.cpp">
</File>
<File
RelativePath=".\persistence\dataview.cpp">
</File>
+4
View File
@@ -914,6 +914,10 @@
RelativePath=".\config\config.cpp"
>
</File>
<File
RelativePath=".\graphics\coords.cpp"
>
</File>
<File
RelativePath=".\persistence\dataview.cpp"
>
+4
View File
@@ -886,6 +886,10 @@
RelativePath=".\config\config.cpp"
>
</File>
<File
RelativePath=".\graphics\coords.cpp"
>
</File>
<File
RelativePath=".\persistence\dataview.cpp"
>