From a84026fefe5ef80a0976df1c805aed9e10d5d1f2 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Mon, 16 Oct 2023 23:14:40 +0100 Subject: [PATCH] [test] Check snapshot timestamp --- tests/test_base_snapshot.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_base_snapshot.cpp b/tests/test_base_snapshot.cpp index 9e900b738ec..ea1a9fc6319 100644 --- a/tests/test_base_snapshot.cpp +++ b/tests/test_base_snapshot.cpp @@ -151,4 +151,15 @@ TEST_F(TestBaseSnapshot, retrieves_parents_properties) EXPECT_EQ(child.get_parents_index(), parent_index); EXPECT_EQ(child.get_parents_name(), parent_name); } + +TEST_F(TestBaseSnapshot, adopts_current_timestamp) +{ + auto before = QDateTime::currentDateTimeUtc(); + auto snapshot = MockBaseSnapshot{"foo", "", nullptr, specs, vm}; + auto after = QDateTime::currentDateTimeUtc(); + + EXPECT_GE(snapshot.get_creation_timestamp(), before); + EXPECT_LE(snapshot.get_creation_timestamp(), after); +} + } // namespace