[zypp-commit] r6010 - in /branches/REFACTORING-10_3/libzypp: tests/cache/CacheStore_test.cc zypp/cache/CacheStore.cc
Author: dmacvicar Date: Fri Jul 13 17:23:11 2007 New Revision: 6010 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6010&view=rev Log: - fix default locale in db, use a empty string - adapt the test Modified: branches/REFACTORING-10_3/libzypp/tests/cache/CacheStore_test.cc branches/REFACTORING-10_3/libzypp/zypp/cache/CacheStore.cc Modified: branches/REFACTORING-10_3/libzypp/tests/cache/CacheStore_test.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/tests/cache/CacheStore_test.cc?rev=6010&r1=6009&r2=6010&view=diff ============================================================================== --- branches/REFACTORING-10_3/libzypp/tests/cache/CacheStore_test.cc (original) +++ branches/REFACTORING-10_3/libzypp/tests/cache/CacheStore_test.cc Fri Jul 13 17:23:11 2007 @@ -22,8 +22,13 @@ #include "zypp/NVRA.h" #include "zypp/PathInfo.h" #include "zypp/TmpPath.h" - +#include "zypp/TranslatedText.h" #include "zypp/Package.h" +#include "zypp/Pattern.h" +#include "zypp/Product.h" +#include "zypp/Patch.h" + +#include "zypp/detail/ImplConnect.h" using namespace std; using namespace zypp; @@ -64,6 +69,53 @@ } /** + * \short Asserts a pattern against a fixed pattern + * + * kde-10.3-71.i586.pat + */ +void check_kde_pattern( Pattern::Ptr p ) +{ + BOOST_CHECK_EQUAL( p->name(), "kde"); + BOOST_CHECK_EQUAL( p->edition(), Edition("10.3", "71") ); + BOOST_CHECK_EQUAL( p->arch(), Arch("i586") ); + +// detail::ResImplTraitsResObject::Impl::constPtr pipp( detail::ImplConnect::resimpl( p ) ); +// TranslatedText got = pipp->summary(); +// + //DBG<< pipp->summary() << endl; +// for ( set<Locale>::const_iterator it = got.locales().begin(); +// it != got.locales().end(); +// ++it ) +// { +// cout << *it << " | " << got.text(*it) << endl; +// } + + BOOST_CHECK_EQUAL( p->summary(), "KDE Desktop Environment" ); + BOOST_CHECK_EQUAL( p->description().substr(0, 16), "KDE is a powerfu"); + BOOST_CHECK_EQUAL( p->category(), "Graphical Environments"); + BOOST_CHECK_EQUAL( p->userVisible(), true); + //1520 +} + +/** + * \short Asserts a product against a fixed product + * + * openSUSE-factory + */ +void check_factory_product( Product::Ptr p ) +{ + BOOST_CHECK_EQUAL( p->name(), "openSUSE-factory"); + BOOST_CHECK_EQUAL( p->edition(), Edition("10.3") ); + BOOST_CHECK_EQUAL( p->arch(), Arch("i686") ); + BOOST_CHECK_EQUAL( p->summary(), "NO DESC?" ); + BOOST_CHECK_EQUAL( p->description().substr(0, 16), "NO DESC?"); +// BOOST_CHECK_EQUAL( p->category(), "Graphical Environments"); +// BOOST_CHECK_EQUAL( p->userVisible(), true); + //1520 +} + + +/** * \short Asserts a package against a fixed package * * glabels 2.0.4-30.2-0 i586 @@ -248,6 +300,8 @@ // packages and a patterns BOOST_CHECK_EQUAL( dbres.size(), 7); bool found_kdelibs3_i586 = false; + bool found_kde_pat = false; + bool found_factory_product = false; for ( ResStore::const_iterator it = dbres.begin(); it != dbres.end(); ++it ) @@ -263,9 +317,30 @@ check_kdelibs3_package(p); } } + if ( isKind<Pattern>(*it) ) + { + Pattern::Ptr p = asKind<Pattern>(*it); + if ( (p->name() == "kde") && p->arch() == Arch("i586") ) + { + BOOST_CHECK_MESSAGE( !found_kde_pat, "kde pattern only once" ); + found_kde_pat = true; + check_kde_pattern(p); + } + } + if ( isKind<Product>(*it) ) + { + Product::Ptr p = asKind<Product>(*it); + if ( (p->name() == "openSUSE-factory") ) + { + BOOST_CHECK_MESSAGE( !found_factory_product, "factory product only once" ); + found_factory_product = true; + check_factory_product(p); + } + } } BOOST_CHECK_MESSAGE( found_kdelibs3_i586, "Package kdelibs3 i586 should be in cache"); - + BOOST_CHECK_MESSAGE( found_kde_pat, "Pattern kde i586 should be in cache"); + BOOST_CHECK_MESSAGE( found_factory_product, "Product factory i586 should be in cache"); check_tables_clean(tmpdir); } Modified: branches/REFACTORING-10_3/libzypp/zypp/cache/CacheStore.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp/cache/CacheStore.cc?rev=6010&r1=6009&r2=6010&view=diff ============================================================================== --- branches/REFACTORING-10_3/libzypp/zypp/cache/CacheStore.cc (original) +++ branches/REFACTORING-10_3/libzypp/zypp/cache/CacheStore.cc Fri Jul 13 17:23:11 2007 @@ -1035,8 +1035,7 @@ // don't bother with writing if the string is empty if (text.empty()) return; - RecordId lang_id = lookupOrAppendType("lang", - locale.code().empty() ? "none" : locale.code() ); + RecordId lang_id = lookupOrAppendType("lang", locale.code() ); RecordId type_id = lookupOrAppendType( klass, name ); appendStringAttribute( resolvable_id, lang_id, type_id, text ); } -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
dmacvicar@svn.opensuse.org