-
Notifications
You must be signed in to change notification settings - Fork 0
/
imagetest.cpp
59 lines (57 loc) · 1.79 KB
/
imagetest.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "Image.h"
#include <iostream>
using namespace std;
int test =2;
int main()
{
Image image;
struct userProperty prop;
switch (test)
{
case 0:
image.setownerUsername("osos");
image.setImageId("image123");
image.chooseImage(string(IMAGE_DIR)+"small.jpg");
for(int i = 0;i<image.properties.size();i++)
{
cout<<image.properties[i].user_name<<" "<<image.properties[i].views;
if(i<image.properties.size()-1)
cout<<endl;
}
prop.user_name="osama";
prop.views=5;
image.properties.push_back(prop);
image.writeProperties();
image.steg();
image.removeMiddleFiles();
break;
case 1:
if(!image.findImage("osos","image123"))
return 0;
image.readProperties();
for(int i = 0;i<image.properties.size();i++)
{
if(image.properties[i].user_name=="osama"&&image.properties[i].views>0)
{
image.properties[i].views--;
cout<<image.properties[i].views;
}
}
image.updateProperties();
cout<<endl;
cout<<image.getAuthorizedImagePath()<<" "<<image.getUnAuthorizedImagePath();
break;
default:
if(!image.findImage("osos","image123"))
return 0;
image.desteg();
cout<<image.getSmallScaleImage();
break;
}
// image.chooseImage(string(IMAGE_DIR)+"small.jpg");
// string img = image.extractImage();
// ofstream out;
// out.open("trial.jpg",ios_base::out | ios_base::binary);
// out<<img;
// out.close();
}