* When run more than one time, the tests the increment the clipboard count
didn't pass anymore. Now we check only the difference, not for absolute values. * Fixed the style. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10704 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
58b5124e46
commit
caf19c8b0a
@ -29,178 +29,172 @@
|
|||||||
*/
|
*/
|
||||||
void CountTester::LocalCount1()
|
void CountTester::LocalCount1()
|
||||||
{
|
{
|
||||||
BApplication app("application/x-vnd.clipboardtest");
|
BApplication app("application/x-vnd.clipboardtest");
|
||||||
BClipboard clip("LocalCount1");
|
BClipboard clip("LocalCount1");
|
||||||
|
|
||||||
CHK(clip.LocalCount() == 0);
|
CHK(clip.LocalCount() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LocalCount()
|
LocalCount()
|
||||||
@case 2
|
@case 2
|
||||||
@results count == 1
|
@results count == +1
|
||||||
*/
|
*/
|
||||||
void CountTester::LocalCount2()
|
void CountTester::LocalCount2()
|
||||||
{
|
{
|
||||||
BApplication app("application/x-vnd.clipboardtest");
|
BApplication app("application/x-vnd.clipboardtest");
|
||||||
BClipboard clip("LocalCount2");
|
BClipboard clip("LocalCount2");
|
||||||
BMessage *data;
|
BMessage *data;
|
||||||
|
|
||||||
if ( clip.Lock() )
|
uint32 oldCount = clip.SystemCount();
|
||||||
{
|
|
||||||
clip.Clear();
|
|
||||||
if ( (data = clip.Data()) )
|
|
||||||
{
|
|
||||||
data->AddData("text/plain",B_MIME_TYPE,"LocalCount2",12);
|
|
||||||
clip.Commit();
|
|
||||||
}
|
|
||||||
clip.Unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
CHK(clip.LocalCount() == 1);
|
if (clip.Lock()) {
|
||||||
|
clip.Clear();
|
||||||
|
if ((data = clip.Data())) {
|
||||||
|
data->AddData("text/plain", B_MIME_TYPE, "LocalCount2", 12);
|
||||||
|
clip.Commit();
|
||||||
|
}
|
||||||
|
clip.Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
CHK(clip.LocalCount() == oldCount + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LocalCount()
|
LocalCount()
|
||||||
@case 3
|
@case 3
|
||||||
@results both counts == 1
|
@results both counts == +1
|
||||||
*/
|
*/
|
||||||
void CountTester::LocalCount3()
|
void CountTester::LocalCount3()
|
||||||
{
|
{
|
||||||
BApplication app("application/x-vnd.clipboardtest");
|
BApplication app("application/x-vnd.clipboardtest");
|
||||||
BClipboard clipA("LocalCount3");
|
BClipboard clipA("LocalCount3");
|
||||||
BClipboard clipB("LocalCount3");
|
BClipboard clipB("LocalCount3");
|
||||||
BMessage *data;
|
BMessage *data;
|
||||||
|
|
||||||
if ( clipB.Lock() )
|
uint32 oldCount = clipA.SystemCount();
|
||||||
{
|
|
||||||
clipB.Clear();
|
|
||||||
if ( (data = clipB.Data()) )
|
|
||||||
{
|
|
||||||
data->AddData("text/plain",B_MIME_TYPE,"LocalCount3",12);
|
|
||||||
clipB.Commit();
|
|
||||||
}
|
|
||||||
clipB.Unlock();
|
|
||||||
}
|
|
||||||
if ( clipA.Lock() )
|
|
||||||
{
|
|
||||||
clipA.Unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
CHK(clipA.LocalCount() == 1);
|
CHK(clipB.Lock());
|
||||||
CHK(clipB.LocalCount() == 1);
|
clipB.Clear();
|
||||||
|
if ((data = clipB.Data())) {
|
||||||
|
data->AddData("text/plain", B_MIME_TYPE, "LocalCount3", 12);
|
||||||
|
clipB.Commit();
|
||||||
|
}
|
||||||
|
clipB.Unlock();
|
||||||
|
|
||||||
|
CHK(clipA.Lock());
|
||||||
|
clipA.Unlock();
|
||||||
|
|
||||||
|
CHK(clipA.LocalCount() == oldCount + 1);
|
||||||
|
CHK(clipB.LocalCount() == oldCount + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LocalCount()
|
LocalCount()
|
||||||
@case 4
|
@case 4
|
||||||
@results clipA.LocalCount() == 1
|
@results clipA.LocalCount() == +1
|
||||||
clipB.LocalCount() == 2
|
clipB.LocalCount() == +2
|
||||||
*/
|
*/
|
||||||
void CountTester::LocalCount4()
|
void CountTester::LocalCount4()
|
||||||
{
|
{
|
||||||
BApplication app("application/x-vnd.clipboardtest");
|
BApplication app("application/x-vnd.clipboardtest");
|
||||||
BClipboard clipA("LocalCount4");
|
BClipboard clipA("LocalCount4");
|
||||||
BClipboard clipB("LocalCount4");
|
BClipboard clipB("LocalCount4");
|
||||||
BMessage *data;
|
BMessage *data;
|
||||||
|
|
||||||
if ( clipB.Lock() )
|
uint32 oldCount = clipA.SystemCount();
|
||||||
{
|
|
||||||
clipB.Clear();
|
|
||||||
if ( (data = clipB.Data()) )
|
|
||||||
{
|
|
||||||
data->AddData("text/plain",B_MIME_TYPE,"LocalCount4",12);
|
|
||||||
clipB.Commit();
|
|
||||||
}
|
|
||||||
clipB.Unlock();
|
|
||||||
}
|
|
||||||
if ( clipA.Lock() )
|
|
||||||
{
|
|
||||||
clipA.Unlock();
|
|
||||||
}
|
|
||||||
if ( clipB.Lock() )
|
|
||||||
{
|
|
||||||
clipB.Clear();
|
|
||||||
if ( (data = clipB.Data()) )
|
|
||||||
{
|
|
||||||
data->AddData("text/plain",B_MIME_TYPE,"LocalCount4",12);
|
|
||||||
clipB.Commit();
|
|
||||||
}
|
|
||||||
clipB.Unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
CHK(clipA.LocalCount() == 1);
|
if (clipB.Lock()) {
|
||||||
CHK(clipB.LocalCount() == 2);
|
clipB.Clear();
|
||||||
|
if ((data = clipB.Data())) {
|
||||||
|
data->AddData("text/plain", B_MIME_TYPE, "LocalCount4", 12);
|
||||||
|
clipB.Commit();
|
||||||
|
}
|
||||||
|
clipB.Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clipA.Lock())
|
||||||
|
clipA.Unlock();
|
||||||
|
|
||||||
|
if (clipB.Lock()) {
|
||||||
|
clipB.Clear();
|
||||||
|
if ((data = clipB.Data())) {
|
||||||
|
data->AddData("text/plain",B_MIME_TYPE,"LocalCount4",12);
|
||||||
|
clipB.Commit();
|
||||||
|
}
|
||||||
|
clipB.Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
CHK(clipA.LocalCount() == oldCount + 1);
|
||||||
|
CHK(clipB.LocalCount() == oldCount + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LocalCount()
|
LocalCount()
|
||||||
@case 5
|
@case 5
|
||||||
@results clipA.LocalCount() == 1
|
@results clipA.LocalCount() == 1
|
||||||
clipB.LocalCount() == 2
|
clipB.LocalCount() == 2
|
||||||
*/
|
*/
|
||||||
void CountTester::LocalCount5()
|
void CountTester::LocalCount5()
|
||||||
{
|
{
|
||||||
BApplication app("application/x-vnd.clipboardtest");
|
BApplication app("application/x-vnd.clipboardtest");
|
||||||
BClipboard clipA("LocalCount5");
|
BClipboard clipA("LocalCount5");
|
||||||
BClipboard clipB("LocalCount5");
|
BClipboard clipB("LocalCount5");
|
||||||
BMessage *data;
|
BMessage *data;
|
||||||
|
|
||||||
if ( clipA.Lock() )
|
uint32 oldCount = clipA.SystemCount();
|
||||||
{
|
|
||||||
clipA.Clear();
|
|
||||||
if ( (data = clipA.Data()) )
|
|
||||||
{
|
|
||||||
data->AddData("text/plain",B_MIME_TYPE,"LocalCount5",12);
|
|
||||||
clipA.Commit();
|
|
||||||
}
|
|
||||||
clipA.Unlock();
|
|
||||||
}
|
|
||||||
if ( clipB.Lock() )
|
|
||||||
{
|
|
||||||
clipB.Clear();
|
|
||||||
if ( (data = clipB.Data()) )
|
|
||||||
{
|
|
||||||
data->AddData("text/plain",B_MIME_TYPE,"LocalCount5",12);
|
|
||||||
clipB.Commit();
|
|
||||||
}
|
|
||||||
clipB.Unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
CHK(clipA.LocalCount() == 1);
|
if (clipA.Lock()) {
|
||||||
CHK(clipB.LocalCount() == 2);
|
clipA.Clear();
|
||||||
|
if ((data = clipA.Data())) {
|
||||||
|
data->AddData("text/plain", B_MIME_TYPE, "LocalCount5", 12);
|
||||||
|
clipA.Commit();
|
||||||
|
}
|
||||||
|
clipA.Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clipB.Lock()) {
|
||||||
|
clipB.Clear();
|
||||||
|
if ((data = clipB.Data())) {
|
||||||
|
data->AddData("text/plain", B_MIME_TYPE, "LocalCount5", 12);
|
||||||
|
clipB.Commit();
|
||||||
|
}
|
||||||
|
clipB.Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
CHK(clipA.LocalCount() == oldCount + 1);
|
||||||
|
CHK(clipB.LocalCount() == oldCount + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LocalCount()
|
LocalCount()
|
||||||
@case 6
|
@case 6
|
||||||
@results clipA.LocalCount() == 1
|
@results clipA.LocalCount() == +1
|
||||||
clipB.LocalCount() == 0
|
clipB.LocalCount() == 0
|
||||||
*/
|
*/
|
||||||
void CountTester::LocalCount6()
|
void CountTester::LocalCount6()
|
||||||
{
|
{
|
||||||
BApplication app("application/x-vnd.clipboardtest");
|
BApplication app("application/x-vnd.clipboardtest");
|
||||||
BClipboard clipA("LocalCount6A");
|
BClipboard clipA("LocalCount6A");
|
||||||
BClipboard clipB("LocalCount6B");
|
BClipboard clipB("LocalCount6B");
|
||||||
BMessage *data;
|
BMessage *data;
|
||||||
|
|
||||||
if ( clipA.Lock() )
|
uint32 oldCount = clipA.SystemCount();
|
||||||
{
|
|
||||||
clipA.Clear();
|
|
||||||
if ( (data = clipA.Data()) )
|
|
||||||
{
|
|
||||||
data->AddData("text/plain",B_MIME_TYPE,"LocalCount6",12);
|
|
||||||
clipA.Commit();
|
|
||||||
}
|
|
||||||
clipA.Unlock();
|
|
||||||
}
|
|
||||||
if ( clipB.Lock() )
|
|
||||||
{
|
|
||||||
clipB.Unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
CHK(clipA.LocalCount() == 1);
|
if (clipA.Lock()) {
|
||||||
CHK(clipB.LocalCount() == 0);
|
clipA.Clear();
|
||||||
|
if ((data = clipA.Data())) {
|
||||||
|
data->AddData("text/plain", B_MIME_TYPE, "LocalCount6" ,12);
|
||||||
|
clipA.Commit();
|
||||||
|
}
|
||||||
|
clipA.Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clipB.Lock())
|
||||||
|
clipB.Unlock();
|
||||||
|
|
||||||
|
CHK(clipA.LocalCount() == oldCount + 1);
|
||||||
|
CHK(clipB.LocalCount() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -210,66 +204,66 @@ void CountTester::LocalCount6()
|
|||||||
*/
|
*/
|
||||||
void CountTester::SystemCount1()
|
void CountTester::SystemCount1()
|
||||||
{
|
{
|
||||||
BApplication app("application/x-vnd.clipboardtest");
|
BApplication app("application/x-vnd.clipboardtest");
|
||||||
BClipboard clip("SystemCount1");
|
BClipboard clip("SystemCount1");
|
||||||
|
|
||||||
CHK(clip.SystemCount() == 0);
|
CHK(clip.SystemCount() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SystemCount()
|
SystemCount()
|
||||||
@case 2
|
@case 2
|
||||||
@results clipA.SystemCount() == 1
|
@results clipA.SystemCount() == +1
|
||||||
clipB.SystemCount() == 1
|
clipB.SystemCount() == +1
|
||||||
*/
|
*/
|
||||||
void CountTester::SystemCount2()
|
void CountTester::SystemCount2()
|
||||||
{
|
{
|
||||||
BApplication app("application/x-vnd.clipboardtest");
|
BApplication app("application/x-vnd.clipboardtest");
|
||||||
BClipboard clipA("SystemCount2");
|
BClipboard clipA("SystemCount2");
|
||||||
BClipboard clipB("SystemCount2");
|
BClipboard clipB("SystemCount2");
|
||||||
BMessage *data;
|
BMessage *data;
|
||||||
|
|
||||||
if ( clipA.Lock() )
|
uint32 oldCount = clipA.SystemCount();
|
||||||
{
|
|
||||||
clipA.Clear();
|
|
||||||
if ( (data = clipA.Data()) )
|
|
||||||
{
|
|
||||||
data->AddData("text/plain",B_MIME_TYPE,"SystemCount2",12);
|
|
||||||
clipA.Commit();
|
|
||||||
}
|
|
||||||
clipA.Unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
CHK(clipA.SystemCount() == 1);
|
if (clipA.Lock()) {
|
||||||
CHK(clipB.SystemCount() == 1);
|
clipA.Clear();
|
||||||
|
if ((data = clipA.Data())) {
|
||||||
|
data->AddData("text/plain", B_MIME_TYPE, "SystemCount2", 12);
|
||||||
|
clipA.Commit();
|
||||||
|
}
|
||||||
|
clipA.Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
CHK(clipA.SystemCount() == oldCount + 1);
|
||||||
|
CHK(clipB.SystemCount() == oldCount + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SystemCount()
|
SystemCount()
|
||||||
@case 3
|
@case 3
|
||||||
@results clipA.SystemCount() == 1
|
@results clipA.SystemCount() == +1
|
||||||
clipB.SystemCount() == 0
|
clipB.SystemCount() == 0
|
||||||
*/
|
*/
|
||||||
void CountTester::SystemCount3()
|
void CountTester::SystemCount3()
|
||||||
{
|
{
|
||||||
BApplication app("application/x-vnd.clipboardtest");
|
BApplication app("application/x-vnd.clipboardtest");
|
||||||
BClipboard clipA("SystemCount3A");
|
BClipboard clipA("SystemCount3A");
|
||||||
BClipboard clipB("SystemCount3B");
|
BClipboard clipB("SystemCount3B");
|
||||||
BMessage *data;
|
BMessage *data;
|
||||||
|
|
||||||
if ( clipA.Lock() )
|
uint32 oldCount = clipA.SystemCount();
|
||||||
{
|
|
||||||
clipA.Clear();
|
|
||||||
if ( (data = clipA.Data()) )
|
|
||||||
{
|
|
||||||
data->AddData("text/plain",B_MIME_TYPE,"SystemCount3",12);
|
|
||||||
clipA.Commit();
|
|
||||||
}
|
|
||||||
clipA.Unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
CHK(clipA.SystemCount() == 1);
|
if (clipA.Lock()) {
|
||||||
CHK(clipB.SystemCount() == 0);
|
clipA.Clear();
|
||||||
|
if ((data = clipA.Data())) {
|
||||||
|
data->AddData("text/plain", B_MIME_TYPE, "SystemCount3", 12);
|
||||||
|
clipA.Commit();
|
||||||
|
}
|
||||||
|
clipA.Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
CHK(clipA.SystemCount() == oldCount + 1);
|
||||||
|
CHK(clipB.SystemCount() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Test* CountTester::Suite()
|
Test* CountTester::Suite()
|
||||||
@ -288,6 +282,3 @@ Test* CountTester::Suite()
|
|||||||
|
|
||||||
return SuiteOfTests;
|
return SuiteOfTests;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user