Added tests for BNodeInfo::{Set,Get}{Icon,PreferredApp}().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@764 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -37,14 +37,56 @@ static const char *tooLongTestType =
|
|||||||
"0123456789012345678901234567890123456789012345678901234567890123456789"
|
"0123456789012345678901234567890123456789012345678901234567890123456789"
|
||||||
"0123456789012345678901234567890123456789012345678901234567890123456789"
|
"0123456789012345678901234567890123456789012345678901234567890123456789"
|
||||||
;
|
;
|
||||||
|
static const char *testAppSignature1
|
||||||
|
= "application/x-vnd.obos.node-info-test-app1";
|
||||||
|
static const char *testAppSignature2
|
||||||
|
= "application/x-vnd.obos.node-info-test-app2";
|
||||||
|
|
||||||
|
|
||||||
// attributes
|
// attributes
|
||||||
static const char *kTypeAttribute = "BEOS:TYPE";
|
static const char *kTypeAttribute = "BEOS:TYPE";
|
||||||
static const char *kMiniIconAttribute = "BEOS:M:STD_ICON";
|
static const char *kMiniIconAttribute = "BEOS:M:STD_ICON";
|
||||||
static const char *kLargeIconAttribute = "BEOS:L:STD_ICON";
|
static const char *kLargeIconAttribute = "BEOS:L:STD_ICON";
|
||||||
//static const char *kPreferredAppAttribute = "BEOS:PREF_APP";
|
static const char *kPreferredAppAttribute = "BEOS:PREF_APP";
|
||||||
//static const char *kAppHintAttribute = "BEOS:PPATH";
|
//static const char *kAppHintAttribute = "BEOS:PPATH";
|
||||||
|
|
||||||
|
enum {
|
||||||
|
MINI_ICON_TYPE = 'MICN',
|
||||||
|
LARGE_ICON_TYPE = 'ICON',
|
||||||
|
};
|
||||||
|
|
||||||
|
// create_test_icon
|
||||||
|
static
|
||||||
|
BBitmap *
|
||||||
|
create_test_icon(icon_size size, int fill)
|
||||||
|
{
|
||||||
|
BBitmap *icon = NULL;
|
||||||
|
// create
|
||||||
|
switch (size) {
|
||||||
|
case B_MINI_ICON:
|
||||||
|
icon = new BBitmap(BRect(0, 0, 15, 15), B_CMAP8);
|
||||||
|
break;
|
||||||
|
case B_LARGE_ICON:
|
||||||
|
icon = new BBitmap(BRect(0, 0, 31, 31), B_CMAP8);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// fill
|
||||||
|
if (icon)
|
||||||
|
memset(icon->Bits(), fill, icon->BitsLength());
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
// icon_equal
|
||||||
|
static
|
||||||
|
bool
|
||||||
|
icon_equal(const BBitmap *icon1, const BBitmap *icon2)
|
||||||
|
{
|
||||||
|
return (icon1->Bounds() == icon2->Bounds()
|
||||||
|
&& icon1->BitsLength() == icon2->BitsLength()
|
||||||
|
&& memcmp(icon1->Bits(), icon2->Bits(), icon1->BitsLength()) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Suite
|
// Suite
|
||||||
CppUnit::Test*
|
CppUnit::Test*
|
||||||
NodeInfoTest::Suite() {
|
NodeInfoTest::Suite() {
|
||||||
@@ -53,10 +95,10 @@ NodeInfoTest::Suite() {
|
|||||||
|
|
||||||
// suite->addTest( new TC("BNodeInfo::Init Test1", &NodeInfoTest::InitTest1) );
|
// suite->addTest( new TC("BNodeInfo::Init Test1", &NodeInfoTest::InitTest1) );
|
||||||
// suite->addTest( new TC("BNodeInfo::Init Test2", &NodeInfoTest::InitTest2) );
|
// suite->addTest( new TC("BNodeInfo::Init Test2", &NodeInfoTest::InitTest2) );
|
||||||
suite->addTest( new TC("BNodeInfo::Type Test", &NodeInfoTest::TypeTest) );
|
// suite->addTest( new TC("BNodeInfo::Type Test", &NodeInfoTest::TypeTest) );
|
||||||
// suite->addTest( new TC("BNodeInfo::Icon Test", &NodeInfoTest::IconTest) );
|
// suite->addTest( new TC("BNodeInfo::Icon Test", &NodeInfoTest::IconTest) );
|
||||||
// suite->addTest( new TC("BNodeInfo::Preferred App Test",
|
suite->addTest( new TC("BNodeInfo::Preferred App Test",
|
||||||
// &NodeInfoTest::PreferredAppTest) );
|
&NodeInfoTest::PreferredAppTest) );
|
||||||
// suite->addTest( new TC("BNodeInfo::App Hint Test",
|
// suite->addTest( new TC("BNodeInfo::App Hint Test",
|
||||||
// &NodeInfoTest::AppHintTest) );
|
// &NodeInfoTest::AppHintTest) );
|
||||||
// suite->addTest( new TC("BNodeInfo::Tracker Icon Test",
|
// suite->addTest( new TC("BNodeInfo::Tracker Icon Test",
|
||||||
@@ -70,19 +112,31 @@ void
|
|||||||
NodeInfoTest::setUp()
|
NodeInfoTest::setUp()
|
||||||
{
|
{
|
||||||
BasicTest::setUp();
|
BasicTest::setUp();
|
||||||
|
// create test dir and files
|
||||||
execCommand(
|
execCommand(
|
||||||
string("mkdir ") + testDir
|
string("mkdir ") + testDir
|
||||||
+ "; touch " + testFile1
|
+ "; touch " + testFile1
|
||||||
+ "; touch " + testFile2
|
+ "; touch " + testFile2
|
||||||
);
|
);
|
||||||
|
// create app
|
||||||
fApplication = new BApplication("application/x-vnd.obos.node-info-test");
|
fApplication = new BApplication("application/x-vnd.obos.node-info-test");
|
||||||
|
// create icons
|
||||||
|
fIconM1 = create_test_icon(B_MINI_ICON, 1);
|
||||||
|
fIconM2 = create_test_icon(B_MINI_ICON, 2);
|
||||||
|
fIconL1 = create_test_icon(B_LARGE_ICON, 1);
|
||||||
|
fIconL2 = create_test_icon(B_LARGE_ICON, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// tearDown
|
// tearDown
|
||||||
void
|
void
|
||||||
NodeInfoTest::tearDown()
|
NodeInfoTest::tearDown()
|
||||||
{
|
{
|
||||||
|
// delete the icons
|
||||||
|
delete fIconM1;
|
||||||
|
delete fIconM2;
|
||||||
|
delete fIconL1;
|
||||||
|
delete fIconL2;
|
||||||
|
fIconM1 = fIconM2 = fIconL1 = fIconL2 = NULL;
|
||||||
// delete the application
|
// delete the application
|
||||||
delete fApplication;
|
delete fApplication;
|
||||||
fApplication = NULL;
|
fApplication = NULL;
|
||||||
@@ -219,12 +273,33 @@ CheckTypeAttr(BNode &node, const char *data)
|
|||||||
// CheckIconAttr
|
// CheckIconAttr
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
CheckTypeAttr(BNode &node, BBitmap *data, icon_size iconSize)
|
CheckIconAttr(BNode &node, BBitmap *data)
|
||||||
{
|
{
|
||||||
const char *attribute = (iconSize == B_MINI_ICON ? kMiniIconAttribute
|
const char *attribute = NULL;
|
||||||
: kLargeIconAttribute);
|
uint32 type = 0;
|
||||||
CheckAttr(node, attribute, B_MIME_STRING_TYPE, data->Bits(),
|
switch (data->Bounds().IntegerWidth()) {
|
||||||
data->BitsLength());
|
case 15:
|
||||||
|
attribute = kMiniIconAttribute;
|
||||||
|
type = MINI_ICON_TYPE;
|
||||||
|
break;
|
||||||
|
case 31:
|
||||||
|
attribute = kLargeIconAttribute;
|
||||||
|
type = LARGE_ICON_TYPE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
CHK(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
CheckAttr(node, attribute, type, data->Bits(), data->BitsLength());
|
||||||
|
}
|
||||||
|
|
||||||
|
// CheckPreferredAppAttr
|
||||||
|
static
|
||||||
|
void
|
||||||
|
CheckPreferredAppAttr(BNode &node, const char *data)
|
||||||
|
{
|
||||||
|
CheckAttr(node, kPreferredAppAttribute, B_MIME_STRING_TYPE, data,
|
||||||
|
strlen(data) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TypeTest
|
// TypeTest
|
||||||
@@ -333,15 +408,148 @@ NodeInfoTest::IconTest()
|
|||||||
{
|
{
|
||||||
// status_t GetIcon(BBitmap *icon, icon_size k) const
|
// status_t GetIcon(BBitmap *icon, icon_size k) const
|
||||||
// * NULL icon => B_BAD_VALUE
|
// * NULL icon => B_BAD_VALUE
|
||||||
// * unknown icon size => B_BAD_VALUE
|
// R5: Crashes when passing a NULL icon.
|
||||||
|
#ifndef TEST_R5
|
||||||
|
NextSubTest();
|
||||||
|
{
|
||||||
|
BNode node(testFile1);
|
||||||
|
BNodeInfo nodeInfo;
|
||||||
|
CHK(nodeInfo.SetTo(&node) == B_OK);
|
||||||
|
CHK(nodeInfo.GetIcon(NULL, B_MINI_ICON) == B_BAD_VALUE);
|
||||||
|
CHK(nodeInfo.GetIcon(NULL, B_LARGE_ICON) == B_BAD_VALUE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
// * uninitialized => B_NO_INIT
|
||||||
|
NextSubTest();
|
||||||
|
{
|
||||||
|
BNodeInfo nodeInfo;
|
||||||
|
BBitmap icon(BRect(0, 0, 15, 15), B_CMAP8);
|
||||||
|
CHK(nodeInfo.GetIcon(&icon, B_MINI_ICON) == B_NO_INIT);
|
||||||
|
BBitmap icon2(BRect(0, 0, 31, 31), B_CMAP8);
|
||||||
|
CHK(nodeInfo.GetIcon(&icon2, B_LARGE_ICON) == B_NO_INIT);
|
||||||
|
}
|
||||||
// * icon dimensions != icon size => B_BAD_VALUE
|
// * icon dimensions != icon size => B_BAD_VALUE
|
||||||
// * has no icon => != B_OK
|
NextSubTest();
|
||||||
|
{
|
||||||
|
BNode node(testFile1);
|
||||||
|
BNodeInfo nodeInfo;
|
||||||
|
CHK(nodeInfo.SetTo(&node) == B_OK);
|
||||||
|
BBitmap icon(BRect(0, 0, 31, 31), B_CMAP8);
|
||||||
|
CHK(nodeInfo.GetIcon(&icon, B_MINI_ICON) == B_BAD_VALUE);
|
||||||
|
BBitmap icon2(BRect(0, 0, 15, 15), B_CMAP8);
|
||||||
|
CHK(nodeInfo.GetIcon(&icon2, B_LARGE_ICON) == B_BAD_VALUE);
|
||||||
|
}
|
||||||
|
// * has no icon => B_ENTRY_NOT_FOUND
|
||||||
|
NextSubTest();
|
||||||
|
{
|
||||||
|
BNode node(testFile1);
|
||||||
|
BNodeInfo nodeInfo;
|
||||||
|
CHK(nodeInfo.SetTo(&node) == B_OK);
|
||||||
|
BBitmap icon(BRect(0, 0, 15, 15), B_CMAP8);
|
||||||
|
CHK(nodeInfo.GetIcon(&icon, B_MINI_ICON) == B_ENTRY_NOT_FOUND);
|
||||||
|
}
|
||||||
// * set, get, reset, get
|
// * set, get, reset, get
|
||||||
|
NextSubTest();
|
||||||
|
{
|
||||||
|
BNode node(testFile1);
|
||||||
|
BNodeInfo nodeInfo;
|
||||||
|
CHK(nodeInfo.SetTo(&node) == B_OK);
|
||||||
|
// mini
|
||||||
|
// set
|
||||||
|
CHK(nodeInfo.SetIcon(fIconM1, B_MINI_ICON) == B_OK);
|
||||||
|
// get
|
||||||
|
BBitmap icon(BRect(0, 0, 15, 15), B_CMAP8);
|
||||||
|
CHK(nodeInfo.GetIcon(&icon, B_MINI_ICON) == B_OK);
|
||||||
|
CHK(icon_equal(fIconM1, &icon));
|
||||||
|
CheckIconAttr(node, fIconM1);
|
||||||
|
// reset
|
||||||
|
CHK(nodeInfo.SetIcon(fIconM2, B_MINI_ICON) == B_OK);
|
||||||
|
// get
|
||||||
|
BBitmap icon2(BRect(0, 0, 15, 15), B_CMAP8);
|
||||||
|
CHK(nodeInfo.GetIcon(&icon2, B_MINI_ICON) == B_OK);
|
||||||
|
CHK(icon_equal(fIconM2, &icon2));
|
||||||
|
CheckIconAttr(node, fIconM2);
|
||||||
|
// large
|
||||||
|
// set
|
||||||
|
CHK(nodeInfo.SetIcon(fIconL1, B_LARGE_ICON) == B_OK);
|
||||||
|
// get
|
||||||
|
BBitmap icon3(BRect(0, 0, 31, 31), B_CMAP8);
|
||||||
|
CHK(nodeInfo.GetIcon(&icon3, B_LARGE_ICON) == B_OK);
|
||||||
|
CHK(icon_equal(fIconL1, &icon3));
|
||||||
|
CheckIconAttr(node, fIconL1);
|
||||||
|
// reset
|
||||||
|
CHK(nodeInfo.SetIcon(fIconL2, B_LARGE_ICON) == B_OK);
|
||||||
|
// get
|
||||||
|
BBitmap icon4(BRect(0, 0, 31, 31), B_CMAP8);
|
||||||
|
CHK(nodeInfo.GetIcon(&icon4, B_LARGE_ICON) == B_OK);
|
||||||
|
CHK(icon_equal(fIconL2, &icon4));
|
||||||
|
CheckIconAttr(node, fIconL2);
|
||||||
|
}
|
||||||
|
// * bitmap color_space != B_CMAP8 => B_OK
|
||||||
|
NextSubTest();
|
||||||
|
{
|
||||||
|
BNode node(testFile1);
|
||||||
|
BNodeInfo nodeInfo;
|
||||||
|
CHK(nodeInfo.SetTo(&node) == B_OK);
|
||||||
|
// mini
|
||||||
|
BBitmap icon(BRect(0, 0, 15, 15), B_RGB32);
|
||||||
|
CHK(nodeInfo.GetIcon(&icon, B_MINI_ICON) == B_OK);
|
||||||
|
BBitmap icon2(BRect(0, 0, 15, 15), B_RGB32);
|
||||||
|
icon2.SetBits(fIconM2->Bits(), fIconM2->BitsLength(), 0, B_CMAP8);
|
||||||
|
CHK(icon_equal(&icon, &icon2));
|
||||||
|
// large
|
||||||
|
// R5: Crashes for some weird reason in GetIcon().
|
||||||
|
#ifndef TEST_R5
|
||||||
|
BBitmap icon3(BRect(0, 0, 31, 31), B_RGB32);
|
||||||
|
CHK(nodeInfo.GetIcon(&icon3, B_LARGE_ICON) == B_OK);
|
||||||
|
BBitmap icon4(BRect(0, 0, 31, 31), B_RGB32);
|
||||||
|
icon4.SetBits(fIconL2->Bits(), fIconL2->BitsLength(), 0, B_CMAP8);
|
||||||
|
CHK(icon_equal(&icon3, &icon4));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// status_t SetIcon(const BBitmap *icon, icon_size k)
|
// status_t SetIcon(const BBitmap *icon, icon_size k)
|
||||||
// * NULL icon => unsets icon, B_OK
|
// * NULL icon => unsets icon, B_OK
|
||||||
// * unknown icon size => B_BAD_VALUE
|
NextSubTest();
|
||||||
|
{
|
||||||
|
BNode node(testFile1);
|
||||||
|
BNodeInfo nodeInfo;
|
||||||
|
CHK(nodeInfo.SetTo(&node) == B_OK);
|
||||||
|
// mini
|
||||||
|
// set
|
||||||
|
CHK(nodeInfo.SetIcon(NULL, B_MINI_ICON) == B_OK);
|
||||||
|
// get
|
||||||
|
BBitmap icon(BRect(0, 0, 15, 15), B_CMAP8);
|
||||||
|
CHK(nodeInfo.GetIcon(&icon, B_MINI_ICON) == B_ENTRY_NOT_FOUND);
|
||||||
|
CheckNoAttr(node, kMiniIconAttribute);
|
||||||
|
// large
|
||||||
|
// set
|
||||||
|
CHK(nodeInfo.SetIcon(NULL, B_LARGE_ICON) == B_OK);
|
||||||
|
// get
|
||||||
|
BBitmap icon2(BRect(0, 0, 31, 31), B_CMAP8);
|
||||||
|
CHK(nodeInfo.GetIcon(&icon2, B_LARGE_ICON) == B_ENTRY_NOT_FOUND);
|
||||||
|
CheckNoAttr(node, kLargeIconAttribute);
|
||||||
|
}
|
||||||
|
// * uninitialized => B_NO_INIT
|
||||||
|
NextSubTest();
|
||||||
|
{
|
||||||
|
BNodeInfo nodeInfo;
|
||||||
|
BBitmap icon(BRect(0, 0, 15, 15), B_CMAP8);
|
||||||
|
CHK(nodeInfo.SetIcon(&icon, B_MINI_ICON) == B_NO_INIT);
|
||||||
|
BBitmap icon2(BRect(0, 0, 31, 31), B_CMAP8);
|
||||||
|
CHK(nodeInfo.SetIcon(&icon2, B_LARGE_ICON) == B_NO_INIT);
|
||||||
|
}
|
||||||
// * icon dimensions != icon size => B_BAD_VALUE
|
// * icon dimensions != icon size => B_BAD_VALUE
|
||||||
|
NextSubTest();
|
||||||
|
{
|
||||||
|
BNode node(testFile1);
|
||||||
|
BNodeInfo nodeInfo;
|
||||||
|
CHK(nodeInfo.SetTo(&node) == B_OK);
|
||||||
|
BBitmap icon(BRect(0, 0, 31, 31), B_CMAP8);
|
||||||
|
CHK(nodeInfo.SetIcon(&icon, B_MINI_ICON) == B_BAD_VALUE);
|
||||||
|
BBitmap icon2(BRect(0, 0, 15, 15), B_CMAP8);
|
||||||
|
CHK(nodeInfo.SetIcon(&icon2, B_LARGE_ICON) == B_BAD_VALUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PreferredAppTest
|
// PreferredAppTest
|
||||||
@@ -350,12 +558,97 @@ NodeInfoTest::PreferredAppTest()
|
|||||||
{
|
{
|
||||||
// status_t GetPreferredApp(char *signature, app_verb verb = B_OPEN) const
|
// status_t GetPreferredApp(char *signature, app_verb verb = B_OPEN) const
|
||||||
// * NULL signature => B_BAD_VALUE
|
// * NULL signature => B_BAD_VALUE
|
||||||
// * verb != B_OK => B_BAD_VALUE
|
NextSubTest();
|
||||||
// * has no preferred app => != B_OK
|
{
|
||||||
|
BNode node(testFile1);
|
||||||
|
BNodeInfo nodeInfo;
|
||||||
|
CHK(nodeInfo.SetTo(&node) == B_OK);
|
||||||
|
CHK(nodeInfo.GetPreferredApp(NULL) == B_BAD_ADDRESS);
|
||||||
|
}
|
||||||
|
// * uninitialized => B_NO_INIT
|
||||||
|
NextSubTest();
|
||||||
|
{
|
||||||
|
BNodeInfo nodeInfo;
|
||||||
|
char signature[B_MIME_TYPE_LENGTH];
|
||||||
|
CHK(nodeInfo.GetPreferredApp(signature) == B_NO_INIT);
|
||||||
|
}
|
||||||
|
// * has no preferred app => B_ENTRY_NOT_FOUND
|
||||||
|
NextSubTest();
|
||||||
|
{
|
||||||
|
BNode node(testFile1);
|
||||||
|
BNodeInfo nodeInfo;
|
||||||
|
CHK(nodeInfo.SetTo(&node) == B_OK);
|
||||||
|
char signature[B_MIME_TYPE_LENGTH];
|
||||||
|
CHK(nodeInfo.GetPreferredApp(signature) == B_ENTRY_NOT_FOUND);
|
||||||
|
}
|
||||||
// * set, get, reset, get
|
// * set, get, reset, get
|
||||||
|
NextSubTest();
|
||||||
|
{
|
||||||
|
BNode node(testFile1);
|
||||||
|
BNodeInfo nodeInfo;
|
||||||
|
CHK(nodeInfo.SetTo(&node) == B_OK);
|
||||||
|
// set
|
||||||
|
CHK(nodeInfo.SetPreferredApp(testAppSignature1) == B_OK);
|
||||||
|
// get
|
||||||
|
char signature[B_MIME_TYPE_LENGTH];
|
||||||
|
CHK(nodeInfo.GetPreferredApp(signature) == B_OK);
|
||||||
|
CHK(strcmp(testAppSignature1, signature) == 0);
|
||||||
|
CheckPreferredAppAttr(node, testAppSignature1);
|
||||||
|
// reset
|
||||||
|
CHK(nodeInfo.SetPreferredApp(testAppSignature2) == B_OK);
|
||||||
|
// get
|
||||||
|
CHK(nodeInfo.GetPreferredApp(signature) == B_OK);
|
||||||
|
CHK(strcmp(testAppSignature2, signature) == 0);
|
||||||
|
CheckPreferredAppAttr(node, testAppSignature2);
|
||||||
|
}
|
||||||
|
|
||||||
// status_t SetPreferredApp(const char *signature, app_verb verb = B_OPEN)
|
// status_t SetPreferredApp(const char *signature, app_verb verb = B_OPEN)
|
||||||
// * NULL signature => B_BAD_VALUE
|
// * NULL signature => unsets the preferred app
|
||||||
// * verb != B_OK => B_BAD_VALUE
|
NextSubTest();
|
||||||
|
{
|
||||||
|
BNode node(testFile1);
|
||||||
|
BNodeInfo nodeInfo;
|
||||||
|
CHK(nodeInfo.SetTo(&node) == B_OK);
|
||||||
|
CHK(nodeInfo.SetPreferredApp(NULL) == B_OK);
|
||||||
|
// get
|
||||||
|
char signature[B_MIME_TYPE_LENGTH];
|
||||||
|
CHK(nodeInfo.GetPreferredApp(signature) == B_ENTRY_NOT_FOUND);
|
||||||
|
CheckNoAttr(node, kPreferredAppAttribute);
|
||||||
|
}
|
||||||
|
// * uninitialized => B_NO_INIT
|
||||||
|
NextSubTest();
|
||||||
|
{
|
||||||
|
BNodeInfo nodeInfo;
|
||||||
|
CHK(nodeInfo.SetPreferredApp(testAppSignature1) == B_NO_INIT);
|
||||||
|
}
|
||||||
|
// * invalid MIME type => B_OK
|
||||||
|
NextSubTest();
|
||||||
|
{
|
||||||
|
BNode node(testFile1);
|
||||||
|
BNodeInfo nodeInfo;
|
||||||
|
CHK(nodeInfo.SetTo(&node) == B_OK);
|
||||||
|
CHK(nodeInfo.SetPreferredApp(invalidTestType) == B_OK);
|
||||||
|
// get
|
||||||
|
char signature[B_MIME_TYPE_LENGTH];
|
||||||
|
CHK(nodeInfo.GetPreferredApp(signature) == B_OK);
|
||||||
|
CHK(strcmp(invalidTestType, signature) == 0);
|
||||||
|
CheckPreferredAppAttr(node, invalidTestType);
|
||||||
|
}
|
||||||
|
// * signature string too long => B_BAD_VALUE
|
||||||
|
NextSubTest();
|
||||||
|
{
|
||||||
|
BNode node(testFile1);
|
||||||
|
BNodeInfo nodeInfo;
|
||||||
|
CHK(nodeInfo.SetTo(&node) == B_OK);
|
||||||
|
// unset
|
||||||
|
CHK(nodeInfo.SetPreferredApp(NULL) == B_OK);
|
||||||
|
// try to set
|
||||||
|
CHK(nodeInfo.SetPreferredApp(tooLongTestType) == B_BAD_VALUE);
|
||||||
|
// get
|
||||||
|
char signature[1024];
|
||||||
|
CHK(nodeInfo.GetPreferredApp(signature) == B_ENTRY_NOT_FOUND);
|
||||||
|
CheckNoAttr(node, kPreferredAppAttribute);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// AppHintTest
|
// AppHintTest
|
||||||
@@ -364,11 +657,13 @@ NodeInfoTest::AppHintTest()
|
|||||||
{
|
{
|
||||||
// status_t GetAppHint(entry_ref *ref) const
|
// status_t GetAppHint(entry_ref *ref) const
|
||||||
// * NULL ref => B_BAD_VALUE
|
// * NULL ref => B_BAD_VALUE
|
||||||
|
// * uninitialized => B_NO_INIT
|
||||||
// * invalid/abstract ref => != B_OK
|
// * invalid/abstract ref => != B_OK
|
||||||
// * has no app hint => B_ENTRY_NOT_FOUND
|
// * has no app hint => B_ENTRY_NOT_FOUND
|
||||||
// * set, get, reset, get
|
// * set, get, reset, get
|
||||||
// status_t SetAppHint(const entry_ref *ref)
|
// status_t SetAppHint(const entry_ref *ref)
|
||||||
// * NULL ref => B_BAD_VALUE
|
// * NULL ref => B_BAD_VALUE
|
||||||
|
// * uninitialized => B_NO_INIT
|
||||||
// * invalid/abstract ref => != B_OK
|
// * invalid/abstract ref => != B_OK
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,6 +673,7 @@ NodeInfoTest::TrackerIconTest()
|
|||||||
{
|
{
|
||||||
// status_t GetTrackerIcon(BBitmap *icon, icon_size k = B_LARGE_ICON) const
|
// status_t GetTrackerIcon(BBitmap *icon, icon_size k = B_LARGE_ICON) const
|
||||||
// * NULL icon => B_BAD_VALUE
|
// * NULL icon => B_BAD_VALUE
|
||||||
|
// * uninitialized => B_NO_INIT
|
||||||
// * unknown icon size => B_BAD_VALUE
|
// * unknown icon size => B_BAD_VALUE
|
||||||
// * icon dimensions != icon size => B_BAD_VALUE
|
// * icon dimensions != icon size => B_BAD_VALUE
|
||||||
// * has no icon, but preferred app with icon for type => B_OK
|
// * has no icon, but preferred app with icon for type => B_OK
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include <BasicTest.h>
|
#include <BasicTest.h>
|
||||||
|
|
||||||
class BApplication;
|
class BApplication;
|
||||||
|
class BBitmap;
|
||||||
class CppUnit::Test;
|
class CppUnit::Test;
|
||||||
|
|
||||||
class NodeInfoTest : public BasicTest
|
class NodeInfoTest : public BasicTest
|
||||||
@@ -34,6 +35,10 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
BApplication *fApplication;
|
BApplication *fApplication;
|
||||||
|
BBitmap *fIconM1;
|
||||||
|
BBitmap *fIconM2;
|
||||||
|
BBitmap *fIconL1;
|
||||||
|
BBitmap *fIconL2;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NODE_INFO_TEST_H
|
#endif // NODE_INFO_TEST_H
|
||||||
|
|||||||
Reference in New Issue
Block a user