ctkMaterialPropertyWidgetTest2.cpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0.txt
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. // Qt includse
  15. #include <QApplication>
  16. #include <QTimer>
  17. // CTK includes
  18. #include "ctkMaterialPropertyWidget.h"
  19. // STD includes
  20. #include <iostream>
  21. //-----------------------------------------------------------------------------
  22. int ctkMaterialPropertyWidgetTest2(int argc, char * argv [] )
  23. {
  24. QApplication app(argc, argv);
  25. ctkMaterialPropertyWidget materialWidget;
  26. if (!materialWidget.isColorVisible() ||
  27. !materialWidget.isOpacityVisible() ||
  28. !materialWidget.isBackfaceCullingVisible())
  29. {
  30. std::cout << "ctkMaterialPropertyWidget::ctkMaterialPropertyWidget(), "
  31. << "wrong default values" << std::endl;
  32. return EXIT_FAILURE;
  33. }
  34. // here for code coverage
  35. materialWidget.setColorVisible(true);
  36. materialWidget.setOpacityVisible(true);
  37. materialWidget.setBackfaceCullingVisible(true);
  38. materialWidget.setColorVisible(false);
  39. if (materialWidget.isColorVisible())
  40. {
  41. std::cout << "ctkMaterialPropertyWidget::setColorVisible failed"
  42. << std::endl;
  43. return EXIT_FAILURE;
  44. }
  45. materialWidget.setOpacityVisible(false);
  46. if (materialWidget.isOpacityVisible())
  47. {
  48. std::cout << "ctkMaterialPropertyWidget::setColorVisible failed"
  49. << std::endl;
  50. return EXIT_FAILURE;
  51. }
  52. materialWidget.setBackfaceCullingVisible(false);
  53. if (materialWidget.isBackfaceCullingVisible())
  54. {
  55. std::cout << "ctkMaterialPropertyWidget::setColorVisible failed"
  56. << std::endl;
  57. return EXIT_FAILURE;
  58. }
  59. materialWidget.setColorVisible(true);
  60. materialWidget.setOpacityVisible(true);
  61. materialWidget.setBackfaceCullingVisible(true);
  62. materialWidget.show();
  63. if (argc < 2 || QString(argv[1]) != "-I" )
  64. {
  65. QTimer::singleShot(200, &app, SLOT(quit()));
  66. }
  67. return app.exec();
  68. }