1 /*=========================================================================
2 
3   Library:   CTK
4 
5   Copyright (c) Kitware Inc.
6 
7   Licensed under the Apache License, Version 2.0 (the "License");
8   you may not use this file except in compliance with the License.
9   You may obtain a copy of the License at
10 
11       http://www.apache.org/licenses/LICENSE-2.0.txt
12 
13   Unless required by applicable law or agreed to in writing, software
14   distributed under the License is distributed on an "AS IS" BASIS,
15   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   See the License for the specific language governing permissions and
17   limitations under the License.
18 
19 =========================================================================*/
20 
21 // Qt includes
22 #include <QAction>
23 #include <QApplication>
24 #include <QDebug>
25 #include <QStandardItemModel>
26 #include <QTimer>
27 #include <QTreeView>
28 
29 // CTK includes
30 #include "ctkCallback.h"
31 #include "ctkConfig.h"
32 #include "ctkErrorLogStatusMessageHandler.h"
33 #include "ctkEventTranslatorPlayerWidget.h"
34 
35 // QtTesting includes
36 #include "pqTestUtility.h"
37 
38 // STD includes
39 #include <cstdlib>
40 #include <iostream>
41 
42 namespace
43 {
44 //-----------------------------------------------------------------------------
checkFinalWidgetState(void * data)45 void checkFinalWidgetState(void* data)
46   {
47   ctkErrorLogStatusMessageHandler* widget = reinterpret_cast<ctkErrorLogStatusMessageHandler*>(data);
48   Q_UNUSED(widget);
49   }
50 }
51 
52 //-----------------------------------------------------------------------------
ctkErrorLogStatusMessageHandlerEventTranslatorPlayerTest1(int argc,char * argv[])53 int ctkErrorLogStatusMessageHandlerEventTranslatorPlayerTest1(int argc, char * argv [] )
54 {
55   QApplication app(argc, argv);
56 
57   QString xmlDirectory = CTK_SOURCE_DIR "/Libs/Widgets/Testing/Cpp/";
58 
59   // ------------------------
60   ctkEventTranslatorPlayerWidget etpWidget;
61   pqTestUtility* testUtility = new pqTestUtility(&etpWidget);
62   etpWidget.setTestUtility(testUtility);
63 
64   // Test case 1
65   ctkErrorLogStatusMessageHandler* widget = new ctkErrorLogStatusMessageHandler();
66   etpWidget.addTestCase(widget,
67                         xmlDirectory + "ctkErrorLogStatusMessageHandlerEventTranslatorPlayerTest1.xml",
68                         &checkFinalWidgetState);
69 
70   // ------------------------
71   if (!app.arguments().contains("-I"))
72     {
73     QTimer::singleShot(0, &etpWidget, SLOT(play()));
74     }
75 
76   etpWidget.show();
77   return app.exec();
78 }
79 
80