Minor code enhancements

This commit is contained in:
Matthias Koefferlein 2022-05-29 11:41:40 +02:00
parent 68f05bf069
commit 1d8db227e5
3 changed files with 18 additions and 6 deletions

View File

@ -71,6 +71,11 @@ void LayoutView::set_current (LayoutView *view)
s_current_view.reset (view);
}
void LayoutView::set_current ()
{
s_current_view.reset (this);
}
} // namespace lay
#endif

View File

@ -66,6 +66,11 @@ public:
*/
void timer ();
/**
* @brief Makes this view the current one
*/
void set_current ();
/**
* @brief Gets the current view
*/

View File

@ -422,12 +422,14 @@ class RDB_TestClass < TestBase
assert_equal(item.has_tag?(db.tag_id("x1")), false)
assert_equal(item.tags_str, "")
if item.respond_to?(:image_str)
is="iVBORw0KGgoAAAANSUhEUgAAACoAAAA0CAIAAABzfT3nAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA0SAAANOgHo3ZneAAAA3UlEQVRYhe2WwQ3DIAxFoco8XaGZIaeO43FyYgZYgYXcQ6SWuDGgBhWq/qccIvGCEd9SbAwAAPSGaW2lFR2rfWDpXrPpSe2SP10fvnn/PZHZH9IwbKFVZZ/Z6wMtZcjW02Bn2FVpZYdWdkr2nvh23S2FyDNJuVITpwmRjTGbNr0v20U5byNtJuuJt/fO2f93+UlbEJl5UjVPr3Y71EQ/PoPPlU+lDJtWlCt3GwCMG33BuJGAcWMEMG6c1jBudCyf/nzV8nbZPRohclFLHdGbZ8eNSjN1fmf0AACA1jwA4hKxu4C6P7EAAAAASUVORK5CYII="
item.image_str=is
# Only the first 30 bytes count ... the remaining part is too different for different versions of Qt
assert_equal(item.image_str[0..30], is[0..30])
end
assert_equal(item.image_str, "")
assert_equal(item.has_image?, false)
# can actually by any string, but only base64-encoded PNG images make sense
is="iVBORw0KGgoAAAANSUhEUgAAACoAAAA0CAIAAABzfT3nAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA0SAAANOgHo3ZneAAAA3UlEQVRYhe2WwQ3DIAxFoco8XaGZIaeO43FyYgZYgYXcQ6SWuDGgBhWq/qccIvGCEd9SbAwAAPSGaW2lFR2rfWDpXrPpSe2SP10fvnn/PZHZH9IwbKFVZZ/Z6wMtZcjW02Bn2FVpZYdWdkr2nvh23S2FyDNJuVITpwmRjTGbNr0v20U5byNtJuuJt/fO2f93+UlbEJl5UjVPr3Y71EQ/PoPPlU+lDJtWlCt3GwCMG33BuJGAcWMEMG6c1jBudCyf/nzV8nbZPRohclFLHdGbZ8eNSjN1fmf0AACA1jwA4hKxu4C6P7EAAAAASUVORK5CYII="
item.image_str=is
assert_equal(item.image_str, is)
assert_equal(item.has_image?, true)
vs = RBA::RdbItemValue.new("a string")
vs2 = RBA::RdbItemValue.new("a string (ii)")