hrev47381 adds 3 changesets to branch 'master' old head: b36d838eb056627e61beeb184416e98d84df82ad new head: 4f88977f9ab60d7d71594887565595e40e6df0a8 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=4f88977+%5Eb36d838 ---------------------------------------------------------------------------- 2092929: Add RemoteDesktop to the image. There are some rough edges, but this can be useful and deserves more exposure. dbd4f8c: SetTime_t: Use the sign-fixed modulo we computed * In C++03 and earlier, the sign of the modulo result is implementation defined (this was fixed in C++11). * Setting a negative time is not what we want here, so make sure we use the proper value. 4f88977: Add a first test for BDateTime. * We need to write more of those. [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ] ---------------------------------------------------------------------------- 6 files changed, 77 insertions(+), 1 deletion(-) build/jam/images/definitions/regular | 1 + src/kits/support/DateTime.cpp | 2 +- src/tests/kits/support/DateTimeTest.cpp | 55 ++++++++++++++++++++++ src/tests/kits/support/DateTimeTest.h | 15 ++++++ src/tests/kits/support/Jamfile | 3 ++ src/tests/kits/support/SupportKitTestAddon.cpp | 2 + ############################################################################ Commit: 20929296c9610c5b19d7a76aca3adf898a70a4df URL: http://cgit.haiku-os.org/haiku/commit/?id=2092929 Author: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> Date: Mon Jun 16 06:16:53 2014 UTC Add RemoteDesktop to the image. There are some rough edges, but this can be useful and deserves more exposure. ---------------------------------------------------------------------------- diff --git a/build/jam/images/definitions/regular b/build/jam/images/definitions/regular index c883f36..bf55473 100644 --- a/build/jam/images/definitions/regular +++ b/build/jam/images/definitions/regular @@ -21,6 +21,7 @@ SYSTEM_APPS += [ FFilterByBuildFeatures Icon-O-Matic Installer LaunchBox Magnify Mail MediaConverter MediaPlayer MidiPlayer PackageInstaller People PoorMan PowerStatus + RemoteDesktop Screenshot SerialConnect SoundRecorder TV WebWatch ############################################################################ Commit: dbd4f8c46b968842d5fae1a1e86868934c90ad62 URL: http://cgit.haiku-os.org/haiku/commit/?id=dbd4f8c Author: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> Date: Mon Jun 16 06:46:56 2014 UTC SetTime_t: Use the sign-fixed modulo we computed * In C++03 and earlier, the sign of the modulo result is implementation defined (this was fixed in C++11). * Setting a negative time is not what we want here, so make sure we use the proper value. ---------------------------------------------------------------------------- diff --git a/src/kits/support/DateTime.cpp b/src/kits/support/DateTime.cpp index 5778ccf..aa4aaf6 100644 --- a/src/kits/support/DateTime.cpp +++ b/src/kits/support/DateTime.cpp @@ -1410,7 +1410,7 @@ BDateTime::SetTime_t(time_t seconds) } BTime time; - time.AddSeconds(seconds % kSecondsPerDay); + time.AddSeconds(timePart); fTime.SetTime(time); BDate date(1970, 1, 1); ############################################################################ Revision: hrev47381 Commit: 4f88977f9ab60d7d71594887565595e40e6df0a8 URL: http://cgit.haiku-os.org/haiku/commit/?id=4f88977 Author: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> Date: Mon Jun 16 06:49:36 2014 UTC Add a first test for BDateTime. * We need to write more of those. ---------------------------------------------------------------------------- diff --git a/src/tests/kits/support/DateTimeTest.cpp b/src/tests/kits/support/DateTimeTest.cpp new file mode 100644 index 0000000..6a0fa93 --- /dev/null +++ b/src/tests/kits/support/DateTimeTest.cpp @@ -0,0 +1,55 @@ +/* + * Copyright 2014, Haiku, Inc. + * Distributed under the terms of the MIT License. + */ + + +#include "DateTimeTest.h" + +#include <DateTime.h> + +#include <cppunit/TestSuite.h> + + +class DateTimeTest : public BTestCase { + public: + DateTimeTest(std::string name = ""); + + void test(void); +}; + + +DateTimeTest::DateTimeTest(std::string name) + : + BTestCase(name) +{ +} + + +void +DateTimeTest::test() +{ + BDateTime dateTime; + + // Should be just one second before epoch + dateTime.SetTime_t(-1); + + CPPUNIT_ASSERT(dateTime.IsValid()); + CPPUNIT_ASSERT_EQUAL(59, dateTime.Time().Second()); + CPPUNIT_ASSERT_EQUAL(59, dateTime.Time().Minute()); + CPPUNIT_ASSERT_EQUAL(23, dateTime.Time().Hour()); + CPPUNIT_ASSERT_EQUAL(31, dateTime.Date().Day()); + CPPUNIT_ASSERT_EQUAL(12, dateTime.Date().Month()); + CPPUNIT_ASSERT_EQUAL(1969, dateTime.Date().Year()); +} + + +CppUnit::Test* +DateTimeTestSuite() +{ + CppUnit::TestSuite* testSuite = new CppUnit::TestSuite(); + + testSuite->addTest(new DateTimeTest("BDateTime")); + + return testSuite; +} diff --git a/src/tests/kits/support/DateTimeTest.h b/src/tests/kits/support/DateTimeTest.h new file mode 100644 index 0000000..39548e6 --- /dev/null +++ b/src/tests/kits/support/DateTimeTest.h @@ -0,0 +1,15 @@ +/* + * Copyright 2014, Haiku, Inc. + * Distributed under the terms of the MIT License. + */ +#ifndef _DATE_TIME_TEST_H_ +#define _DATE_TIME_TEST_H_ + + +#include "TestCase.h" + + +CppUnit::Test *DateTimeTestSuite(); + + +#endif // _DATE_TIME_TEST_H_ diff --git a/src/tests/kits/support/Jamfile b/src/tests/kits/support/Jamfile index 37304f4..9467802 100644 --- a/src/tests/kits/support/Jamfile +++ b/src/tests/kits/support/Jamfile @@ -29,6 +29,9 @@ UnitTestLib libsupporttest.so AutolockLockerTest.cpp AutolockLooperTest.cpp + # BDateTime + DateTimeTest.cpp + # BLocker (all in ./blocker) LockerTest.cpp BenaphoreLockCountTest1.cpp diff --git a/src/tests/kits/support/SupportKitTestAddon.cpp b/src/tests/kits/support/SupportKitTestAddon.cpp index e611d1a..5f614a0 100644 --- a/src/tests/kits/support/SupportKitTestAddon.cpp +++ b/src/tests/kits/support/SupportKitTestAddon.cpp @@ -10,6 +10,7 @@ #include "bstring/StringTest.h" #include "bblockcache/BlockCacheTest.h" #include "ByteOrderTest.h" +#include "DateTimeTest.h" BTestSuite * @@ -20,6 +21,7 @@ getTestSuite() // ##### Add test suites here ##### suite->addTest("BArchivable", ArchivableTestSuite()); suite->addTest("BAutolock", AutolockTestSuite()); + suite->addTest("BDateTime", DateTimeTestSuite()); suite->addTest("BLocker", LockerTestSuite()); suite->addTest("BMemoryIO", MemoryIOTestSuite()); suite->addTest("BMallocIO", MallocIOTestSuite());