tests/ceftests/values_unittest.cc
// Test association of a CefValue simple type with a CefListValue.
Test association of a CefValue simple type with a CefListValue.
Test association of a CefValue simple type with a CefListValue .
TEST(ValuesTest, ValueSimpleToList) {
  const double double_value = 5.665;
  CefRefPtr<CefValue> value = CefValue::Create();
  EXPECT_TRUE(value->SetDouble(double_value));
  CefRefPtr<CefListValue> target_list = CefListValue::Create();
  EXPECT_TRUE(target_list->SetValue(0, value));
  EXPECT_EQ(VTYPE_DOUBLE, target_list->GetType(0));
  EXPECT_EQ(double_value, target_list->GetDouble(0));
  CefRefPtr<CefValue> value2 = target_list->GetValue(0);
  EXPECT_TRUE(value2.get());
  EXPECT_FALSE(value2->IsOwned());
  EXPECT_FALSE(value2->IsReadOnly());
  EXPECT_EQ(VTYPE_DOUBLE, value2->GetType());
  EXPECT_EQ(double_value, value2->GetDouble());
  EXPECT_TRUE(value->IsEqual(value2));
  EXPECT_TRUE(value2->IsEqual(value));
  EXPECT_FALSE(value->IsSame(value2));
  EXPECT_FALSE(value2->IsSame(value));
  EXPECT_TRUE(target_list->SetInt(0, 5));
  EXPECT_EQ(VTYPE_INT, target_list->GetType(0));
  EXPECT_EQ(5, target_list->GetInt(0));
  EXPECT_TRUE(value->IsValid());
  EXPECT_TRUE(value2->IsValid());
}
TEST ( ValuesTest , ValueSimpleToList ) { const double double_value = 5.665 ; CefRefPtr < CefValue > value = CefValue :: Create ( ) ; EXPECT_TRUE ( value -> SetDouble ( double_value ) ) ; CefRefPtr < CefListValue > target_list = CefListValue :: Create ( ) ; EXPECT_TRUE ( target_list -> SetValue ( 0 , value ) ) ; EXPECT_EQ ( VTYPE_DOUBLE , target_list -> GetType ( 0 ) ) ; EXPECT_EQ ( double_value , target_list -> GetDouble ( 0 ) ) ; CefRefPtr < CefValue > value2 = target_list -> GetValue ( 0 ) ; EXPECT_TRUE ( value2 . get ( ) ) ; EXPECT_FALSE ( value2 -> IsOwned ( ) ) ; EXPECT_FALSE ( value2 -> IsReadOnly ( ) ) ; EXPECT_EQ ( VTYPE_DOUBLE , value2 -> GetType ( ) ) ; EXPECT_EQ ( double_value , value2 -> GetDouble ( ) ) ; EXPECT_TRUE ( value -> IsEqual ( value2 ) ) ; EXPECT_TRUE ( value2 -> IsEqual ( value ) ) ; EXPECT_FALSE ( value -> IsSame ( value2 ) ) ; EXPECT_FALSE ( value2 -> IsSame ( value ) ) ; EXPECT_TRUE ( target_list -> SetInt ( 0 , 5 ) ) ; EXPECT_EQ ( VTYPE_INT , target_list -> GetType ( 0 ) ) ; EXPECT_EQ ( 5 , target_list -> GetInt ( 0 ) ) ; EXPECT_TRUE ( value -> IsValid ( ) ) ; EXPECT_TRUE ( value2 -> IsValid ( ) ) ; }
Test association of a CefValue simple type with a CefListValue.
Test association of a CefValue simple type with a CefListValue .
// Add the value to the target list. // Test the value in the target list. // Get the value from the target list. // Values are equal but not the same. // Change the value in the target list. // The other values are still valid.