コード例 #1
0
ファイル: option.cpp プロジェクト: squarehimself/XMoniz
void
PrivateValue::reset ()
{
    switch (type) {
	case CompOption::TypeString:
	    string = "";
	    break;
	case CompOption::TypeMatch:
	    match = CompMatch ();
	    break;
	case CompOption::TypeAction:
	    action = CompAction ();
	    break;
	case CompOption::TypeList:
	    list.clear ();
	    listType = CompOption::TypeBool;
	    break;
	default:
	    break;
    }
    type = CompOption::TypeBool;
}
コード例 #2
0
ファイル: option.cpp プロジェクト: CannedFish/deepin-compiz
TEST(CompOption,Value)
{

    check_type_value<bool> (CompOption::TypeBool, true);
    check_type_value<bool> (CompOption::TypeBool, false);

    check_type_value<int> (CompOption::TypeInt, 1);
    check_type_value<float> (CompOption::TypeFloat, 1.f);
    check_type_value<CompString> (CompOption::TypeString, CompString ("Check"));
    check_type_value<CompString> (CompOption::TypeString, "core");
    
    check_type_value<CompAction> (CompOption::TypeAction, CompAction());
    check_type_value<CompMatch> (CompOption::TypeMatch, CompMatch());

    check_type_value<unsigned short[4]> (CompOption::TypeColor, testColor);
	
    check_type_value<CompOption::Value::Vector> (CompOption::TypeList, CompOption::Value::Vector(5));

    CompOption::Value v1, v2;
    ASSERT_EQ (v1,v2);
    v1.set (CompString("SomeString"));
    ASSERT_TRUE(v1 != v2);

    CompOption::Value::Vector vec;
    CompOption::Value v;

    v.set (true);
    vec.push_back (v);
    vec.push_back (v);

    check_list_type<bool> (CompOption::TypeBool, vec);

    vec.clear ();
    v.set (CompString ("foo"));
    vec.push_back (v);
    vec.push_back (v);

    check_list_type<CompString> (CompOption::TypeString, vec);
}