Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
308e4393
Commit
308e4393
authored
7 years ago
by
Pospelov, Gennady
Browse files
Options
Downloads
Patches
Plain Diff
GUI unit test machinery simplified.
parent
0dc761b5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/UnitTests/GUI/TestGUI.cpp
+52
-62
52 additions, 62 deletions
Tests/UnitTests/GUI/TestGUI.cpp
with
52 additions
and
62 deletions
Tests/UnitTests/GUI/TestGUI.cpp
+
52
−
62
View file @
308e4393
...
...
@@ -29,10 +29,29 @@
#include
"TestIntensityDataItem.h"
#include
"TestProjectUtils.h"
#include
"TestParticleCoreShell.h"
#include
<memory>
inline
bool
TestResult
(
QObject
*
testObject
,
int
argc
=
0
,
char
**
argv
=
Q_NULLPTR
)
{
return
QTest
::
qExec
(
testObject
,
argc
,
argv
)
!=
0
;
}
class
GUITestFactory
{
public:
using
create_t
=
std
::
function
<
QObject
*
()
>
;
template
<
typename
T
>
void
add
()
{
creators
.
push_back
([](){
return
new
T
();});
}
int
runAll
(
int
argc
,
char
**
argv
)
{
int
result
(
0
);
for
(
auto
f
:
creators
)
{
std
::
unique_ptr
<
QObject
>
obj
(
f
());
result
+=
QTest
::
qExec
(
obj
.
get
(),
argc
,
argv
);
}
return
result
;
}
private
:
std
::
vector
<
create_t
>
creators
;
};
int
main
(
int
argc
,
char
**
argv
)
{
QCoreApplication
app
(
argc
,
argv
);
...
...
@@ -40,65 +59,36 @@ int main(int argc, char** argv) {
QMetaType
::
registerComparators
<
ComboProperty
>
();
TestFormFactorItems
testFormFactorItems
;
TestFTDistributionItems
testFTDistributionItems
;
TestParameterizedItem
testParameterizedItem
;
TestParticleItem
testParticleItem
;
TestLayerRoughnessItems
testLayerRoughnessItems
;
TestParaCrystalItems
testParaCrystalItems
;
TestSessionModel
testSessionModel
;
TestGUICoreObjectCorrespondence
testGUICoreObjectCorrespondence
;
TestSessionItem
testSessionItem
;
TestMapperCases
testMapperCases
;
TestMapperForItem
testMapperForItem
;
TestGUIHelpers
testGUIHelpers
;
TestFitParameterModel
testFitParameterModel
;
TestMaterialModel
testMaterialModel
;
TestComboProperty
testComboProperty
;
TestTranslations
testTranslations
;
TestGroupProperty
testGroupProperty
;
TestParticleDistributionItem
testParticleDistributionItem
;
TestParameterTreeUtils
testParameterTreeUtils
;
TestDetectorItems
testDetectorItems
;
TestLinkInstrument
testLinkInstrument
;
TestUpdateTimer
testUpdateTimer
;
TestProjectDocument
testProjectDocument
;
TestSaveService
testSaveService
;
TestOutputDataIOService
testIO
;
TestIntensityDataItem
testIntensityData
;
TestProjectUtils
testProjectUtils
;
TestParticleCoreShell
testParticleCoreShell
;
bool
status
(
false
);
GUITestFactory
tests
;
status
|=
TestResult
(
&
t
estFormFactorItems
,
argc
,
argv
);
status
|=
TestResult
(
&
t
estFTDistributionItems
,
argc
,
argv
);
status
|=
TestResult
(
&
t
estParameterizedItem
,
argc
,
argv
);
status
|=
TestResult
(
&
t
estParticleItem
,
argc
,
argv
);
status
|=
TestResult
(
&
t
estLayerRoughnessItems
,
argc
,
argv
);
status
|=
TestResult
(
&
t
estParaCrystalItems
,
argc
,
argv
);
status
|=
TestResult
(
&
t
estSessionModel
,
argc
,
argv
);
status
|=
TestResult
(
&
t
estGUICoreObjectCorrespondence
,
argc
,
argv
);
status
|=
TestResult
(
&
t
estSessionItem
);
status
|=
TestResult
(
&
t
estMapperCases
,
argc
,
argv
);
status
|=
TestResult
(
&
testSessionModel
,
argc
,
argv
);
status
|=
TestResult
(
&
testMapperForItem
,
argc
,
argv
);
status
|=
TestResult
(
&
testGUIHelpers
,
argc
,
argv
);
status
|=
TestResult
(
&
testFitParameterModel
,
argc
,
argv
);
status
|=
TestResult
(
&
testMaterialModel
,
argc
,
argv
);
status
|=
TestResult
(
&
testComboProperty
,
argc
,
argv
);
status
|=
TestResult
(
&
testTranslations
,
argc
,
argv
);
status
|=
TestResult
(
&
testGroupProperty
,
argc
,
argv
);
status
|=
TestResult
(
&
testParticleDistributionItem
,
argc
,
argv
);
status
|=
TestResult
(
&
testParameterTreeUtils
,
argc
,
argv
);
status
|=
TestResult
(
&
testDetectorItems
,
argc
,
argv
);
status
|=
TestResult
(
&
testLinkInstrument
,
argc
,
argv
);
status
|=
TestResult
(
&
testUpdateTimer
,
argc
,
argv
);
status
|=
TestResult
(
&
testProjectDocument
,
argc
,
argv
);
status
|=
TestResult
(
&
testSaveService
,
argc
,
argv
);
status
|=
TestResult
(
&
testIO
,
argc
,
argv
);
status
|=
TestResult
(
&
testIntensityData
,
argc
,
argv
);
status
|=
TestResult
(
&
testProjectUtils
,
argc
,
argv
);
tests
.
add
<
T
estFormFactorItems
>
(
);
tests
.
add
<
T
estFTDistributionItems
>
(
);
tests
.
add
<
T
estParameterizedItem
>
(
);
tests
.
add
<
T
estParticleItem
>
(
);
tests
.
add
<
T
estLayerRoughnessItems
>
(
);
tests
.
add
<
T
estParaCrystalItems
>
(
);
tests
.
add
<
T
estSessionModel
>
(
);
tests
.
add
<
T
estGUICoreObjectCorrespondence
>
(
);
tests
.
add
<
T
estSessionItem
>
(
);
tests
.
add
<
T
estMapperCases
>
(
);
tests
.
add
<
TestMapperForItem
>
(
);
tests
.
add
<
TestGUIHelpers
>
(
);
tests
.
add
<
TestFitParameterModel
>
(
);
tests
.
add
<
TestMaterialModel
>
(
);
tests
.
add
<
TestComboProperty
>
(
);
tests
.
add
<
TestTranslations
>
(
);
tests
.
add
<
TestGroupProperty
>
(
);
tests
.
add
<
TestParticleDistributionItem
>
(
);
tests
.
add
<
TestParameterTreeUtils
>
(
);
tests
.
add
<
TestDetectorItems
>
(
);
tests
.
add
<
TestLinkInstrument
>
(
);
tests
.
add
<
TestUpdateTimer
>
(
);
tests
.
add
<
TestProjectDocument
>
(
);
tests
.
add
<
TestSaveService
>
(
);
tests
.
add
<
TestOutputDataIOService
>
(
);
tests
.
add
<
TestIntensityDataItem
>
(
);
tests
.
add
<
TestProjectUtils
>
(
);
tests
.
add
<
TestParticleCoreShell
>
(
);
return
status
;
return
tests
.
runAll
(
argc
,
argv
)
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment