summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--physical.hpp4
-rw-r--r--test/physical.cpp18
2 files changed, 20 insertions, 2 deletions
diff --git a/physical.hpp b/physical.hpp
index c8ef4fd..3d99066 100644
--- a/physical.hpp
+++ b/physical.hpp
@@ -13,10 +13,10 @@ namespace phosphor
namespace led
{
/** @brief Assert LED by writing 255 */
-constexpr auto ASSERT = 255;
+constexpr unsigned long ASSERT = 255;
/** @brief De-assert by writing "0" */
-constexpr auto DEASSERT = 0;
+constexpr unsigned long DEASSERT = 0;
/** @class Physical
* @brief Responsible for applying actions on a particular physical LED
diff --git a/test/physical.cpp b/test/physical.cpp
index 9312598..f62caa2 100644
--- a/test/physical.cpp
+++ b/test/physical.cpp
@@ -66,6 +66,7 @@ class MockLed : public phosphor::led::SysfsLed
MOCK_METHOD1(setDelayOff, void(unsigned long ms));
};
+using ::testing::InSequence;
using ::testing::NiceMock;
using ::testing::Return;
using ::testing::Throw;
@@ -125,3 +126,20 @@ TEST(Physical, ctor_none_trigger_asserted_brightness)
EXPECT_CALL(led, getBrightness()).WillRepeatedly(Return(val));
phosphor::led::Physical phy(bus, LED_OBJ, led);
}
+
+TEST(Physical, on_to_off)
+{
+ InSequence s;
+
+ auto bus = sdbusplus::bus::new_default();
+ NiceMock<MockLed> led;
+ EXPECT_CALL(led, getTrigger()).Times(1).WillOnce(Return("none"));
+ constexpr auto deasserted = phosphor::led::DEASSERT;
+ EXPECT_CALL(led, getBrightness()).WillOnce(Return(deasserted));
+ constexpr auto asserted = phosphor::led::ASSERT;
+ EXPECT_CALL(led, setBrightness(asserted));
+ EXPECT_CALL(led, setBrightness(deasserted));
+ phosphor::led::Physical phy(bus, LED_OBJ, led);
+ phy.state(Action::On);
+ phy.state(Action::Off);
+}
OpenPOWER on IntegriCloud