tests/ceftests/values_unittest.cc
// Test get/set of a CefValue simple types.
Test get/set of a CefValue simple types.
Test get / set of a CefValue simple types .
TEST(ValuesTest, ValueSimple) {
  CefRefPtr<CefValue> value = CefValue::Create();
  EXPECT_TRUE(value.get());
  EXPECT_TRUE(value->IsValid());
  EXPECT_FALSE(value->IsReadOnly());
  EXPECT_FALSE(value->IsOwned());
  EXPECT_EQ(VTYPE_NULL, value->GetType());
  CreateAndCompareCopy(value);
  EXPECT_TRUE(value->SetBool(true));
  EXPECT_EQ(VTYPE_BOOL, value->GetType());
  EXPECT_TRUE(value->GetBool());
  EXPECT_TRUE(value->IsValid());
  EXPECT_FALSE(value->IsReadOnly());
  EXPECT_FALSE(value->IsOwned());
  CreateAndCompareCopy(value);
  EXPECT_TRUE(value->SetBool(false));
  EXPECT_EQ(VTYPE_BOOL, value->GetType());
  EXPECT_FALSE(value->GetBool());
  EXPECT_TRUE(value->IsValid());
  EXPECT_FALSE(value->IsReadOnly());
  EXPECT_FALSE(value->IsOwned());
  CreateAndCompareCopy(value);
  EXPECT_TRUE(value->SetInt(3));
  EXPECT_EQ(VTYPE_INT, value->GetType());
  EXPECT_EQ(3, value->GetInt());
  EXPECT_TRUE(value->IsValid());
  EXPECT_FALSE(value->IsReadOnly());
  EXPECT_FALSE(value->IsOwned());
  CreateAndCompareCopy(value);
  EXPECT_TRUE(value->SetDouble(5.665));
  EXPECT_EQ(VTYPE_DOUBLE, value->GetType());
  EXPECT_EQ(5.665, value->GetDouble());
  EXPECT_TRUE(value->IsValid());
  EXPECT_FALSE(value->IsReadOnly());
  EXPECT_FALSE(value->IsOwned());
  CreateAndCompareCopy(value);
  const char* str = "Test string";
  EXPECT_TRUE(value->SetString(str));
  EXPECT_EQ(VTYPE_STRING, value->GetType());
  EXPECT_STREQ(str, value->GetString().ToString().data());
  EXPECT_TRUE(value->IsValid());
  EXPECT_FALSE(value->IsReadOnly());
  EXPECT_FALSE(value->IsOwned());
  CreateAndCompareCopy(value);
  EXPECT_TRUE(value->SetNull());
  EXPECT_EQ(VTYPE_NULL, value->GetType());
  EXPECT_TRUE(value->IsValid());
  EXPECT_FALSE(value->IsReadOnly());
  EXPECT_FALSE(value->IsOwned());
  CreateAndCompareCopy(value);
}
TEST ( ValuesTest , ValueSimple ) { CefRefPtr < CefValue > value = CefValue :: Create ( ) ; EXPECT_TRUE ( value . get ( ) ) ; EXPECT_TRUE ( value -> IsValid ( ) ) ; EXPECT_FALSE ( value -> IsReadOnly ( ) ) ; EXPECT_FALSE ( value -> IsOwned ( ) ) ; EXPECT_EQ ( VTYPE_NULL , value -> GetType ( ) ) ; CreateAndCompareCopy ( value ) ; EXPECT_TRUE ( value -> SetBool ( true ) ) ; EXPECT_EQ ( VTYPE_BOOL , value -> GetType ( ) ) ; EXPECT_TRUE ( value -> GetBool ( ) ) ; EXPECT_TRUE ( value -> IsValid ( ) ) ; EXPECT_FALSE ( value -> IsReadOnly ( ) ) ; EXPECT_FALSE ( value -> IsOwned ( ) ) ; CreateAndCompareCopy ( value ) ; EXPECT_TRUE ( value -> SetBool ( false ) ) ; EXPECT_EQ ( VTYPE_BOOL , value -> GetType ( ) ) ; EXPECT_FALSE ( value -> GetBool ( ) ) ; EXPECT_TRUE ( value -> IsValid ( ) ) ; EXPECT_FALSE ( value -> IsReadOnly ( ) ) ; EXPECT_FALSE ( value -> IsOwned ( ) ) ; CreateAndCompareCopy ( value ) ; EXPECT_TRUE ( value -> SetInt ( 3 ) ) ; EXPECT_EQ ( VTYPE_INT , value -> GetType ( ) ) ; EXPECT_EQ ( 3 , value -> GetInt ( ) ) ; EXPECT_TRUE ( value -> IsValid ( ) ) ; EXPECT_FALSE ( value -> IsReadOnly ( ) ) ; EXPECT_FALSE ( value -> IsOwned ( ) ) ; CreateAndCompareCopy ( value ) ; EXPECT_TRUE ( value -> SetDouble ( 5.665 ) ) ; EXPECT_EQ ( VTYPE_DOUBLE , value -> GetType ( ) ) ; EXPECT_EQ ( 5.665 , value -> GetDouble ( ) ) ; EXPECT_TRUE ( value -> IsValid ( ) ) ; EXPECT_FALSE ( value -> IsReadOnly ( ) ) ; EXPECT_FALSE ( value -> IsOwned ( ) ) ; CreateAndCompareCopy ( value ) ; const char * str = " " ; EXPECT_TRUE ( value -> SetString ( str ) ) ; EXPECT_EQ ( VTYPE_STRING , value -> GetType ( ) ) ; EXPECT_STREQ ( str , value -> GetString ( ) . ToString ( ) . data ( ) ) ; EXPECT_TRUE ( value -> IsValid ( ) ) ; EXPECT_FALSE ( value -> IsReadOnly ( ) ) ; EXPECT_FALSE ( value -> IsOwned ( ) ) ; CreateAndCompareCopy ( value ) ; EXPECT_TRUE ( value -> SetNull ( ) ) ; EXPECT_EQ ( VTYPE_NULL , value -> GetType ( ) ) ; EXPECT_TRUE ( value -> IsValid ( ) ) ; EXPECT_FALSE ( value -> IsReadOnly ( ) ) ; EXPECT_FALSE ( value -> IsOwned ( ) ) ; CreateAndCompareCopy ( value ) ; }
Test get/set of a CefValue simple types.
Test get / set of a CefValue simple types .