1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://www.centreleonberard.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================*/
18 #include "vvRegisterForm.h"
21 #include "gtest/gtest.h"
25 const std::string data_path = "/home/mpech/workspace/vvSource/tests/data/";
26 TEST(vvRegisterForm, canPush){
28 //the file exists with some old lines
29 vvRegisterForm* v=new vvRegisterForm(url, QString::fromStdString(data_path+".settingsCanPush.txt"), QSettings::NativeFormat);
30 std::ifstream inFile((data_path+".settingsCanPush.txt").c_str(), std::ifstream::in);
31 ASSERT_FALSE(inFile.fail());
32 EXPECT_TRUE(v->canPush());
34 //the file doesn't exist
35 vvRegisterForm* v2=new vvRegisterForm(url, QString::fromStdString(data_path+".settings_notFound.txt"), QSettings::NativeFormat);
36 EXPECT_TRUE(v2->canPush());
38 //the current version is the same
39 QString strSettings=QString::fromStdString(data_path+".settings2.txt");
40 QSettings settings(strSettings, QSettings::NativeFormat);
41 settings.setValue("vvVersion", VV_VERSION);
42 vvRegisterForm* v3=new vvRegisterForm(url, strSettings, QSettings::NativeFormat);
43 EXPECT_FALSE(v3->canPush());
45 TEST(vvRegisterForm, acquitPushed){
47 vvRegisterForm* v=new vvRegisterForm(url, QString::fromStdString(data_path+".settingsAcquit.txt"), QSettings::NativeFormat);
48 ASSERT_TRUE(v->canPush());
50 EXPECT_FALSE(v->canPush());
51 remove((data_path+".settingsAcquit.txt").c_str());