diff options
author | Sebastian Geerken <devnull@localhost> | 2013-09-17 16:53:10 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2013-09-17 16:53:10 +0200 |
commit | 4a98456a5f0430c6f49a05cd85a941b3e705a336 (patch) | |
tree | 41a54a28da68d94764712591d067973364678843 /test | |
parent | 1dd550cc0b1b1a7afef91f0a22031d29e5e70ba8 (diff) |
Fixed a problem in the test.
Diffstat (limited to 'test')
-rw-r--r-- | test/dw_image_background.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/dw_image_background.cc b/test/dw_image_background.cc index 4e91cde0..3b692901 100644 --- a/test/dw_image_background.cc +++ b/test/dw_image_background.cc @@ -28,14 +28,33 @@ #include "../dw/textblock.hh" #include "../dw/image.hh" +using namespace lout::signal; +using namespace lout::misc; using namespace dw; using namespace dw::core; using namespace dw::core::style; using namespace dw::fltk; +class ImageStyleDeletionReceiver: public ObservedObject::DeletionReceiver +{ +public: + void deleted (ObservedObject *object); +}; + static StyleImage *image1 = NULL, *image2 = NULL; static Layout *layout; static int imgRow1 = 0, imgRow2 = 0; +static ImageStyleDeletionReceiver isdr; + +void ImageStyleDeletionReceiver::deleted (ObservedObject *object) +{ + if ((StyleImage*)object == image1) + image1 = NULL; + else if ((StyleImage*)object == image2) + image2 = NULL; + else + assertNotReached (); +} static void imageInitTimeout (void *data) { @@ -113,6 +132,7 @@ int main(int argc, char **argv) styleAttrs.backgroundColor = Color::create (layout, 0xffffff); image1 = styleAttrs.backgroundImage = StyleImage::create (); + image1->connectDeletion (&isdr); styleAttrs.backgroundRepeat = BACKGROUND_REPEAT_Y; styleAttrs.backgroundPositionX = createPerLength (0.5); styleAttrs.backgroundPositionY = createAbsLength (30); @@ -132,6 +152,7 @@ int main(int argc, char **argv) Style *wordStyle = Style::create (&styleAttrs); image2 = styleAttrs.backgroundImage = StyleImage::create (); + image2->connectDeletion (&isdr); styleAttrs.backgroundRepeat = BACKGROUND_REPEAT; styleAttrs.backgroundPositionX = createPerLength (0); styleAttrs.backgroundPositionY = createPerLength (0); |