summaryrefslogtreecommitdiffstats
path: root/tests/testsxx.cpp
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-07-07 04:22:49 +0000
committerTavian Barnes <tavianator@gmail.com>2009-07-07 04:22:49 +0000
commitd7b7b4b3391cf99ca63d8311eac3957df7a862ed (patch)
treeca25a171111abb0bfffc53fd61b01623b36992b6 /tests/testsxx.cpp
parentc54af1b6644216335361e61e770037aca1527756 (diff)
downloaddimension-d7b7b4b3391cf99ca63d8311eac3957df7a862ed.tar.xz
New C++ dmnsn_display* wrapper for tests.
Diffstat (limited to 'tests/testsxx.cpp')
-rw-r--r--tests/testsxx.cpp42
1 files changed, 32 insertions, 10 deletions
diff --git a/tests/testsxx.cpp b/tests/testsxx.cpp
index 1247eee..f3dcca5 100644
--- a/tests/testsxx.cpp
+++ b/tests/testsxx.cpp
@@ -19,16 +19,38 @@
#include "testsxx.hpp"
-// Print a progress bar of the progress of `progress'
-std::ostream&
-operator<<(std::ostream& ostr, const Dimension::Progress& progress)
+namespace Dimension
{
- const unsigned int increments = 32;
+ Display::Display(const Canvas& canvas)
+ : m_display(dmnsn_new_display(canvas.dmnsn()))
+ {
+ if (!m_display) {
+ throw Dimension_Error("Couldn't create display.");
+ }
+ }
+
+ Display::~Display()
+ {
+ dmnsn_delete_display(m_display);
+ }
+
+ void
+ Display::flush()
+ {
+ dmnsn_display_frame(m_display);
+ }
+
+ // Print a progress bar of the progress of `progress'
+ std::ostream&
+ operator<<(std::ostream& ostr, const Dimension::Progress& progress)
+ {
+ const unsigned int increments = 32;
- ostr << "|" << std::flush;
- for (unsigned int i = 0; i < increments; ++i) {
- progress.wait(static_cast<double>(i + 1)/increments);
- ostr << "=" << std::flush;
+ ostr << "|" << std::flush;
+ for (unsigned int i = 0; i < increments; ++i) {
+ progress.wait(static_cast<double>(i + 1)/increments);
+ ostr << "=" << std::flush;
+ }
+ return ostr << "|" << std::flush;
}
- return ostr << "|" << std::flush;
-}
+} \ No newline at end of file