~MockDisplayDevice()
{}
- void outputAdded(IDSDisplayDeviceOutput *output) {
+ void outputAdded(std::shared_ptr<IDSDisplayDeviceOutput> output) {
flagOutputAdded = true;
}
- void outputRemoved(IDSDisplayDeviceOutput *output) {
+ void outputRemoved(std::shared_ptr<IDSDisplayDeviceOutput> output) {
flagOutputRemoved = true;
}
{
std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
EXPECT_TRUE(displayDevice != nullptr);
- std::list<IDSDisplayDeviceOutput *> outputList = displayDevice->getOutputList();
+ std::list<std::shared_ptr<IDSDisplayDeviceOutput>> outputList = displayDevice->getOutputList();
EXPECT_TRUE(outputList.size() != 0);
}
TEST_F(DSDisplayDeviceTDMImplTest, DeviceOutput_getInitialValues)
{
std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- std::list<IDSDisplayDeviceOutput *> outputList = displayDevice->getOutputList();
+ std::list<std::shared_ptr<IDSDisplayDeviceOutput>> outputList = displayDevice->getOutputList();
EXPECT_TRUE(outputList.size() != 0);
IDSDisplayDeviceOutput::ConnectorType connType;
IDSDisplayDeviceOutput::ConnectState connState;
- for (IDSDisplayDeviceOutput *output : outputList) {
+ for (std::shared_ptr<IDSDisplayDeviceOutput> output : outputList) {
connType = output->getConnectType();
EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI);
connState = output->getConnectState();
TEST_F(DSDisplayDeviceTDMImplTest, DeviceOutput_setModeBestResolution)
{
std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- std::list<IDSDisplayDeviceOutput *> outputList = displayDevice->getOutputList();
+ std::list<std::shared_ptr<IDSDisplayDeviceOutput>> outputList = displayDevice->getOutputList();
EXPECT_TRUE(outputList.size() != 0);
IDSDisplayDeviceOutput::ConnectorType connType;
IDSDisplayDeviceOutput::ConnectState connState;
DSDisplayDeviceOutputMode *bestMode;
- for (IDSDisplayDeviceOutput *output : outputList) {
+ for (std::shared_ptr<IDSDisplayDeviceOutput> output : outputList) {
connType = output->getConnectType();
EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI);
connState = output->getConnectState();
{}
~MockDisplayDeviceOutput() = default;
- void outputConnected(IDSDisplayDeviceOutput *deviceOuptut) {
+ void outputConnected(std::shared_ptr<IDSDisplayDeviceOutput> displayDeviceOuptut) {
flagOutputConnected = true;
}
- void outputDisconnected(IDSDisplayDeviceOutput *deviceOuptut) {
+ void outputDisconnected(std::shared_ptr<IDSDisplayDeviceOutput> displayDeviceOuptut) {
flagOutputDisconnected = true;
}
- void outputResolutionSet(IDSDisplayDeviceOutput *deviceOuptut) {
+ void outputResolutionSet(std::shared_ptr<IDSDisplayDeviceOutput> displayDeviceOuptut) {
flagOutputResolutionSet = true;
}
TEST_F(DSDisplayDeviceTDMImplTest, DeviceOutput_registerCallbackOutputConnected)
{
std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- std::list<IDSDisplayDeviceOutput *> outputList = displayDevice->getOutputList();
- for (IDSDisplayDeviceOutput *output : outputList) {
- std::shared_ptr<MockDisplayDeviceOutput> mockDisplayDeviceOutput = std::make_shared<MockDisplayDeviceOutput>();
- DSDisplayDeviceOutputTDMImpl *displayDeviceOutput = static_cast<DSDisplayDeviceOutputTDMImpl *>(output);
+ auto outputList = displayDevice->getOutputList();
+ for (auto displayDeviceOutput : outputList) {
+ auto mockDisplayDeviceOutput = std::make_shared<MockDisplayDeviceOutput>();
displayDeviceOutput->registerCallbackOutputConnected(mockDisplayDeviceOutput.get(), std::bind(&MockDisplayDeviceOutput::outputConnected, mockDisplayDeviceOutput, std::placeholders::_1));
- displayDeviceOutput->callCallbackOutputConnected();
+
+ auto displayDeviceOutputTDM = std::dynamic_pointer_cast<DSDisplayDeviceOutputTDMImpl>(displayDeviceOutput); // down-casting of std::shared_ptr
+ displayDeviceOutputTDM->callCallbackOutputConnected();
EXPECT_TRUE(mockDisplayDeviceOutput->flagOutputConnected);
}
}
TEST_F(DSDisplayDeviceTDMImplTest, DeviceOutput_registerCallbackOutputDisconnected)
{
std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- std::list<IDSDisplayDeviceOutput *> outputList = displayDevice->getOutputList();
- for (IDSDisplayDeviceOutput *output : outputList) {
- std::shared_ptr<MockDisplayDeviceOutput> mockDisplayDeviceOutput = std::make_shared<MockDisplayDeviceOutput>();
- DSDisplayDeviceOutputTDMImpl *displayDeviceOutput = static_cast<DSDisplayDeviceOutputTDMImpl *>(output);
+ auto outputList = displayDevice->getOutputList();
+ for (auto displayDeviceOutput : outputList) {
+ auto mockDisplayDeviceOutput = std::make_shared<MockDisplayDeviceOutput>();
displayDeviceOutput->registerCallbackOutputDisconnected(mockDisplayDeviceOutput.get(), std::bind(&MockDisplayDeviceOutput::outputDisconnected, mockDisplayDeviceOutput, std::placeholders::_1));
- displayDeviceOutput->callCallbackOutputDisconnected();
+
+ auto displayDeviceOutputTDM = std::dynamic_pointer_cast<DSDisplayDeviceOutputTDMImpl>(displayDeviceOutput); // down-casting of std::shared_ptr
+ displayDeviceOutputTDM->callCallbackOutputDisconnected();
EXPECT_TRUE(mockDisplayDeviceOutput->flagOutputDisconnected);
}
}
TEST_F(DSDisplayDeviceTDMImplTest, DeviceOutput_registerCallbackOutputResolutionSet)
{
std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- std::list<IDSDisplayDeviceOutput *> outputList = displayDevice->getOutputList();
- for (IDSDisplayDeviceOutput *output : outputList) {
- std::shared_ptr<MockDisplayDeviceOutput> mockDisplayDeviceOutput = std::make_shared<MockDisplayDeviceOutput>();
- DSDisplayDeviceOutputTDMImpl *displayDeviceOutput = static_cast<DSDisplayDeviceOutputTDMImpl *>(output);
+ auto outputList = displayDevice->getOutputList();
+ for (auto displayDeviceOutput : outputList) {
+ auto mockDisplayDeviceOutput = std::make_shared<MockDisplayDeviceOutput>();
displayDeviceOutput->registerCallbackOutputResolutionSet(mockDisplayDeviceOutput.get(), std::bind(&MockDisplayDeviceOutput::outputResolutionSet, mockDisplayDeviceOutput, std::placeholders::_1));
- displayDeviceOutput->callCallbackOutputResolutionSet();
+
+ auto displayDeviceOutputTDM = std::dynamic_pointer_cast<DSDisplayDeviceOutputTDMImpl>(displayDeviceOutput); // down-casting of std::shared_ptr
+ displayDeviceOutputTDM->callCallbackOutputResolutionSet();
EXPECT_TRUE(mockDisplayDeviceOutput->flagOutputResolutionSet);
}
}
TEST_F(DSDisplayDeviceTDMImplTest, DeviceOutput_createHWCWindow)
{
std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- std::list<IDSDisplayDeviceOutput *> outputList = displayDevice->getOutputList();
+ std::list<std::shared_ptr<IDSDisplayDeviceOutput>> outputList = displayDevice->getOutputList();
EXPECT_TRUE(outputList.size() != 0);
IDSDisplayDeviceOutput::ConnectorType connType;
IDSDisplayDeviceHWC *deviceHWC;
IDSDisplayDeviceHWCWindow *deviceHWCWindow;
- for (IDSDisplayDeviceOutput *output : outputList) {
+ for (std::shared_ptr<IDSDisplayDeviceOutput> output : outputList) {
connType = output->getConnectType();
EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI);
connState = output->getConnectState();
TEST_F(DSDisplayDeviceTDMImplTest, DeviceHWC_commit)
{
std::unique_ptr<IDSDisplayDevice> displayDevice = std::make_unique<DSDisplayDeviceTDMImpl>();
- std::list<IDSDisplayDeviceOutput *> outputList = displayDevice->getOutputList();
+ std::list<std::shared_ptr<IDSDisplayDeviceOutput>> outputList = displayDevice->getOutputList();
EXPECT_TRUE(outputList.size() != 0);
IDSDisplayDeviceOutput::ConnectorType connType;
IDSDisplayDeviceHWC *deviceHWC;
IDSDisplayDeviceHWCWindow *deviceHWCWindow;
- for (IDSDisplayDeviceOutput *output : outputList) {
+ for (std::shared_ptr<IDSDisplayDeviceOutput> output : outputList) {
connType = output->getConnectType();
EXPECT_TRUE(connType <= IDSDisplayDeviceOutput::TYPE_DSI);
connState = output->getConnectState();