Added some more BApplication constructor tests.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@546 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
32babc5581
commit
37eae7179d
@ -40,10 +40,14 @@ test_app(const char *app, const char *expectedResult)
|
||||
appPath.CharacterEscape(" \t\n!\"'`$&()?*+{}[]<>|", '\\');
|
||||
appPath += "/kits/app/";
|
||||
appPath += app;
|
||||
#ifdef TEST_R5
|
||||
appPath += "_r5";
|
||||
#endif
|
||||
// run the app
|
||||
AppRunner runner;
|
||||
CHK(runner.Run(appPath.String()) == B_OK);
|
||||
snooze(100000);
|
||||
while (!runner.HasQuitted())
|
||||
snooze(10000);
|
||||
// read the output and compare the result
|
||||
char buffer[1024];
|
||||
ssize_t read = runner.ReadOutput(buffer, sizeof(buffer) - 1);
|
||||
@ -68,12 +72,73 @@ void TBApplicationTester::BApplication1()
|
||||
"the \"application\" media type.\n");
|
||||
}
|
||||
|
||||
/*
|
||||
BApplication(const char *signature)
|
||||
@case 2 signature is no valid MIME string
|
||||
@results Should print error message and quit.
|
||||
*/
|
||||
void TBApplicationTester::BApplication2()
|
||||
{
|
||||
test_app("BApplicationTestApp2",
|
||||
"bad signature (no valid MIME string), must begin with "
|
||||
"\"application/\" and can't conflict with existing registered "
|
||||
"mime types inside the \"application\" media type.\n");
|
||||
}
|
||||
|
||||
/*
|
||||
BApplication(const char *signature)
|
||||
@case 3 signature is a valid MIME string, but doesn't have the
|
||||
"application" supertype
|
||||
@results Should print error message and quit.
|
||||
*/
|
||||
void TBApplicationTester::BApplication3()
|
||||
{
|
||||
test_app("BApplicationTestApp3",
|
||||
"bad signature (image/gif), must begin with \"application/\" and "
|
||||
"can't conflict with existing registered mime types inside "
|
||||
"the \"application\" media type.\n");
|
||||
}
|
||||
|
||||
/*
|
||||
BApplication(const char *signature)
|
||||
@case 4 signature is a valid MIME string with "application"
|
||||
supertype, but a different one than in the app
|
||||
attributes/resources
|
||||
@results Should print warning message and continue.
|
||||
InitCheck() should return B_OK.
|
||||
*/
|
||||
void TBApplicationTester::BApplication4()
|
||||
{
|
||||
test_app("BApplicationTestApp4",
|
||||
"Signature in rsrc doesn't match constructor arg. "
|
||||
"(application/x-vnd.obos-bapplication-testapp4,"
|
||||
"application/x-vnd.obos-bapplication-testapp4-or-not)\n"
|
||||
"InitCheck(): 0\n");
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
BApplication(const char *signature)
|
||||
@case 5 signature is a valid MIME string with "application"
|
||||
supertype, and the same as in the app attributes/resources
|
||||
@results Shouldn't print anything at all and continue.
|
||||
InitCheck() should return B_OK.
|
||||
*/
|
||||
void TBApplicationTester::BApplication5()
|
||||
{
|
||||
test_app("BApplicationTestApp5", "InitCheck(): 0\n");
|
||||
}
|
||||
|
||||
|
||||
Test* TBApplicationTester::Suite()
|
||||
{
|
||||
TestSuite* SuiteOfTests = new TestSuite;
|
||||
|
||||
ADD_TEST4(BApplication, SuiteOfTests, TBApplicationTester, BApplication1);
|
||||
ADD_TEST4(BApplication, SuiteOfTests, TBApplicationTester, BApplication2);
|
||||
ADD_TEST4(BApplication, SuiteOfTests, TBApplicationTester, BApplication3);
|
||||
ADD_TEST4(BApplication, SuiteOfTests, TBApplicationTester, BApplication4);
|
||||
ADD_TEST4(BApplication, SuiteOfTests, TBApplicationTester, BApplication5);
|
||||
|
||||
return SuiteOfTests;
|
||||
}
|
||||
|
@ -26,6 +26,10 @@ class TBApplicationTester : public TestCase
|
||||
TBApplicationTester(std::string name) : TestCase(name) {;}
|
||||
|
||||
void BApplication1();
|
||||
void BApplication2();
|
||||
void BApplication3();
|
||||
void BApplication4();
|
||||
void BApplication5();
|
||||
|
||||
static Test* Suite();
|
||||
};
|
||||
|
@ -0,0 +1,11 @@
|
||||
// BApplicationTestApp2.cpp
|
||||
|
||||
#include <Application.h>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
BApplication app("no valid MIME string");
|
||||
return 0;
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
// BApplicationTestApp3.cpp
|
||||
|
||||
#include <Application.h>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
BApplication app("image/gif");
|
||||
return 0;
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
// BApplicationTestApp4.cpp
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Application.h>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
BApplication app("application/x-vnd.obos-bapplication-testapp4");
|
||||
printf("InitCheck(): %lx\n", app.InitCheck());
|
||||
return 0;
|
||||
}
|
||||
|
Binary file not shown.
@ -0,0 +1,14 @@
|
||||
// BApplicationTestApp5.cpp
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Application.h>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
BApplication app("application/x-vnd.obos-bapplication-testapp5");
|
||||
printf("InitCheck(): %lx\n", app.InitCheck());
|
||||
return 0;
|
||||
}
|
||||
|
Binary file not shown.
@ -7,3 +7,39 @@ CommonUnitTest BApplicationTestApp1
|
||||
: be stdc++.r4
|
||||
: app support
|
||||
;
|
||||
|
||||
CommonUnitTest BApplicationTestApp2
|
||||
: BApplicationTestApp2.cpp
|
||||
: kits app
|
||||
: <boot!home!config!lib>libopenbeos.so be stdc++.r4
|
||||
: be stdc++.r4
|
||||
: app support
|
||||
;
|
||||
|
||||
CommonUnitTest BApplicationTestApp3
|
||||
: BApplicationTestApp3.cpp
|
||||
: kits app
|
||||
: <boot!home!config!lib>libopenbeos.so be stdc++.r4
|
||||
: be stdc++.r4
|
||||
: app support
|
||||
;
|
||||
|
||||
AddResources BApplicationTestApp4 : BApplicationTestApp4.rsrc ;
|
||||
AddResources BApplicationTestApp4_r5 : BApplicationTestApp4.rsrc ;
|
||||
CommonUnitTest BApplicationTestApp4
|
||||
: BApplicationTestApp4.cpp
|
||||
: kits app
|
||||
: <boot!home!config!lib>libopenbeos.so be stdc++.r4
|
||||
: be stdc++.r4
|
||||
: app support
|
||||
;
|
||||
|
||||
AddResources BApplicationTestApp5 : BApplicationTestApp5.rsrc ;
|
||||
AddResources BApplicationTestApp5_r5 : BApplicationTestApp5.rsrc ;
|
||||
CommonUnitTest BApplicationTestApp5
|
||||
: BApplicationTestApp5.cpp
|
||||
: kits app
|
||||
: <boot!home!config!lib>libopenbeos.so be stdc++.r4
|
||||
: be stdc++.r4
|
||||
: app support
|
||||
;
|
||||
|
Loading…
Reference in New Issue
Block a user