| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 | 
							- /*=========================================================================
 
-   Library:   CTK
 
-   Copyright (c) Kitware Inc.
 
-   Licensed under the Apache License, Version 2.0 (the "License");
 
-   you may not use this file except in compliance with the License.
 
-   You may obtain a copy of the License at
 
-       http://www.commontk.org/LICENSE
 
-   Unless required by applicable law or agreed to in writing, software
 
-   distributed under the License is distributed on an "AS IS" BASIS,
 
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
-   See the License for the specific language governing permissions and
 
-   limitations under the License.
 
- =========================================================================*/
 
- // Qt includes
 
- #include <QApplication>
 
- #include <QSignalSpy>
 
- #include <QTimer>
 
- // CTK includes
 
- #include "ctkDoubleRangeSlider.h"
 
- // STD includes
 
- #include <cstdlib>
 
- #include <iostream>
 
- //-----------------------------------------------------------------------------
 
- int ctkDoubleRangeSliderTest2(int argc, char * argv [] )
 
- {
 
-   QApplication app(argc, argv);
 
-   ctkDoubleRangeSlider slider(Qt::Horizontal);
 
-   QSignalSpy spyRange(&slider, SIGNAL(rangeChanged(double, double)));
 
-   slider.setRange(200., 499.01);
 
-   
 
-   if (spyRange.count() != 1 ||
 
-       spyRange.first().at(0).toDouble() != 200. ||
 
-       spyRange.first().at(1).toDouble() != 499.01)
 
-     {
 
-     std::cerr << "ctkDoubleRangeSlider::setRange() failed: "
 
-               << spyRange.count() << " min: "
 
-               << (spyRange.count() ? spyRange.first().at(0).toDouble() : -1.)
 
-               << " max: "
 
-               << (spyRange.count() ? spyRange.first().at(1).toDouble() : -1.)
 
-               << std::endl;
 
-     return EXIT_FAILURE; 
 
-     }
 
-   spyRange.clear();
 
-   // set again and rangeChanged shouldn't be called 
 
-   slider.setRange(200., 499.01);
 
-   slider.setMinimum(200.);
 
-   slider.setMaximum(499.01);
 
-   if (spyRange.count() != 0)
 
-     {
 
-     std::cerr << "ctkDoubleRangeSlider::setRange() fired useless signal: "
 
-               << spyRange.count() << " min: "
 
-               << spyRange.first().at(0).toDouble() << " max: "
 
-               << spyRange.first().at(1).toDouble() << std::endl;
 
-     return EXIT_FAILURE; 
 
-     }
 
-   // while it might not change the underline (int) slider, we still need to fire
 
-   // an event
 
-   slider.setMaximum(499.00);
 
-   
 
-   if (spyRange.count() != 1 ||
 
-       spyRange.first().at(0).toDouble() != 200. ||
 
-       spyRange.first().at(1).toDouble() != 499.00)
 
-     {
 
-     std::cerr << "ctkDoubleRangeSlider::setMaximum() failed: "
 
-               << spyRange.count() << " min: "
 
-               << (spyRange.count() ? spyRange.first().at(0).toDouble() : -1.)
 
-               << " max: "
 
-               << (spyRange.count() ? spyRange.first().at(1).toDouble() : -1.)
 
-               << std::endl;
 
-     return EXIT_FAILURE; 
 
-     }
 
-   
 
-   slider.show();
 
-   
 
-   if (argc < 2 || QString(argv[1]) != "-I" )
 
-     {
 
-     QTimer::singleShot(200, &app, SLOT(quit()));
 
-     }
 
-   return app.exec();
 
- }
 
 
  |