[glom] test_selfhosting_new_then_lookup: Minor improvements.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] test_selfhosting_new_then_lookup: Minor improvements.
- Date: Thu, 1 Dec 2011 13:49:25 +0000 (UTC)
commit a493566e9a869c9bcf6e85e95a05a04a10912de0
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Dec 1 14:49:15 2011 +0100
test_selfhosting_new_then_lookup: Minor improvements.
* tests/test_selfhosting_new_then_lookup.cc: Avoid some hard-coding.
ChangeLog | 6 ++++++
tests/test_selfhosting_new_then_lookup.cc | 12 +++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 59f373f..84d0a29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2011-12-01 Murray Cumming <murrayc murrayc com>
+ test_selfhosting_new_then_lookup: Minor improvements.
+
+ * tests/test_selfhosting_new_then_lookup.cc: Avoid some hard-coding.
+
+2011-12-01 Murray Cumming <murrayc murrayc com>
+
Moved some lookup functions into DbUtils and added a test for them.
* glom/libglom/db_utils.[h|cc]:
diff --git a/tests/test_selfhosting_new_then_lookup.cc b/tests/test_selfhosting_new_then_lookup.cc
index 93d79a1..92a0ed5 100644
--- a/tests/test_selfhosting_new_then_lookup.cc
+++ b/tests/test_selfhosting_new_then_lookup.cc
@@ -159,20 +159,26 @@ static bool test(Glom::Document::HostingMode hosting_mode)
if(!field->get_is_lookup())
{
- std::cerr << "Failure: The lookup field is not a lookup." << std::endl;
+ std::cerr << "Failure: The lookup item's field is not a lookup." << std::endl;
+ return false;
+ }
+
+ if(field->get_lookup_field() != "price")
+ {
+ std::cerr << "Failure: The lookup item's field's name is unexpected." << std::endl;
return false;
}
if(relationship != field->get_lookup_relationship())
{
- std::cerr << "Failure: The lookup field's relationship is not expected." << std::endl;
+ std::cerr << "Failure: The lookup item's field's relationship is not expected." << std::endl;
return false;
}
//Lookup the value from the related record.
//TODO:
const Glom::sharedptr<Glom::Field> field_source =
- document.get_field(relationship->get_to_table(), "price");
+ document.get_field(relationship->get_to_table(), field->get_lookup_field());
const Gnome::Gda::Value value = Glom::DbUtils::get_lookup_value(&document,
table_name, relationship, field_source, Gnome::Gda::Value(2));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]