1*9d7e27acSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*9d7e27acSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*9d7e27acSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*9d7e27acSAndrew Rist * distributed with this work for additional information 6*9d7e27acSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*9d7e27acSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*9d7e27acSAndrew Rist * "License"); you may not use this file except in compliance 9*9d7e27acSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*9d7e27acSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*9d7e27acSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*9d7e27acSAndrew Rist * software distributed under the License is distributed on an 15*9d7e27acSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*9d7e27acSAndrew Rist * KIND, either express or implied. See the License for the 17*9d7e27acSAndrew Rist * specific language governing permissions and limitations 18*9d7e27acSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*9d7e27acSAndrew Rist *************************************************************/ 21*9d7e27acSAndrew Rist 22*9d7e27acSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_cppuhelper.hxx" 26cdf0e10cSrcweir #include <cppuhelper/proptypehlp.hxx> 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <com/sun/star/beans/Property.hpp> 29cdf0e10cSrcweir 30cdf0e10cSrcweir using namespace ::com::sun::star::uno; 31cdf0e10cSrcweir using namespace ::cppu; 32cdf0e10cSrcweir 33cdf0e10cSrcweir void testPropertyTypeHelper() 34cdf0e10cSrcweir { 35cdf0e10cSrcweir Any a; 36cdf0e10cSrcweir 37cdf0e10cSrcweir a <<= ( sal_Int8 ) 25; 38cdf0e10cSrcweir 39cdf0e10cSrcweir sal_Int32 i; 40cdf0e10cSrcweir convertPropertyValue( i , a ); 41cdf0e10cSrcweir OSL_ASSERT( 25 == i ); 42cdf0e10cSrcweir 43cdf0e10cSrcweir sal_Int16 i16; 44cdf0e10cSrcweir convertPropertyValue( i16 , a ); 45cdf0e10cSrcweir OSL_ASSERT( 25 == i16 ); 46cdf0e10cSrcweir 47cdf0e10cSrcweir sal_Int8 i8; 48cdf0e10cSrcweir convertPropertyValue( i8 , a ); 49cdf0e10cSrcweir OSL_ASSERT( 25 == i8 ); 50cdf0e10cSrcweir 51cdf0e10cSrcweir sal_uInt32 i32; 52cdf0e10cSrcweir convertPropertyValue( i32 , a ); 53cdf0e10cSrcweir OSL_ASSERT( 25 == i32 ); 54cdf0e10cSrcweir 55cdf0e10cSrcweir double d; 56cdf0e10cSrcweir convertPropertyValue( d , a ); 57cdf0e10cSrcweir OSL_ASSERT( 25. == d ); 58cdf0e10cSrcweir 59cdf0e10cSrcweir float f; 60cdf0e10cSrcweir convertPropertyValue( f , a ); 61cdf0e10cSrcweir OSL_ASSERT( 25. == f ); 62cdf0e10cSrcweir 63cdf0e10cSrcweir ::com::sun::star::beans::Property prop; 64cdf0e10cSrcweir 65cdf0e10cSrcweir prop.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Huhu") ); 66cdf0e10cSrcweir prop.Handle = 5; 67cdf0e10cSrcweir prop.Attributes = 3; 68cdf0e10cSrcweir 69cdf0e10cSrcweir a <<= prop; 70cdf0e10cSrcweir 71cdf0e10cSrcweir ::com::sun::star::beans::Property prop2; 72cdf0e10cSrcweir convertPropertyValue( prop2 , a ); 73cdf0e10cSrcweir OSL_ASSERT( prop.Handle == prop2.Handle && prop.Name == prop2.Name && prop.Attributes == prop2.Attributes ); 74cdf0e10cSrcweir 75cdf0e10cSrcweir 76cdf0e10cSrcweir ::rtl::OUString ow; 77cdf0e10cSrcweir a <<= prop.Name; 78cdf0e10cSrcweir convertPropertyValue( ow , a ); 79cdf0e10cSrcweir OSL_ASSERT( ow == prop.Name ); 80cdf0e10cSrcweir } 81