summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/Chat/MUCController.cpp4
-rw-r--r--Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp50
2 files changed, 27 insertions, 27 deletions
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp
index 4c3f524..139f425 100644
--- a/Swift/Controllers/Chat/MUCController.cpp
+++ b/Swift/Controllers/Chat/MUCController.cpp
@@ -1285,10 +1285,10 @@ void MUCController::requestSecurityMarking() {
auto markingBackgroundColor = roomInfoForm->getField("x-isode#roominfo_marking_bg_color");
std::string markingForegroundColorValue = "Black";
std::string markingBackgroundColorValue = "White";
- if (markingForegroundColor) {
+ if (markingForegroundColor && markingForegroundColor->getTextSingleValue() != "") {
markingForegroundColorValue = markingForegroundColor->getTextSingleValue();
}
- if (markingBackgroundColor) {
+ if (markingBackgroundColor && markingBackgroundColor->getTextSingleValue() != "") {
markingBackgroundColorValue = markingBackgroundColor->getTextSingleValue();
}
setMUCSecurityMarking(markingValue, markingForegroundColorValue, markingBackgroundColorValue);
diff --git a/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp b/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp
index 012bcd0..05ab3a7 100644
--- a/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp
+++ b/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp
@@ -674,31 +674,31 @@ TEST_F(MUCControllerTest, testSecurityMarkingRequestCompleteMarkingWithExtraForm
ASSERT_EQ(std::string("Red"), window_->markingBackgroundColorValue_);
}
-// TEST_F(MUCControllerTest, testSecurityMarkingRequestNoColorsInMarking) {
-// auto formTypeField = std::make_shared<FormField>(FormField::Type::HiddenType, "http://jabber.org/protocol/muc#roominfo");
-// auto markingField = std::make_shared<FormField>(FormField::Type::TextSingleType, "Test|Highest Possible Security");
-// auto markingForegroundColorField = std::make_shared<FormField>(FormField::Type::TextSingleType, "");
-// auto markingBackgroundColorField = std::make_shared<FormField>(FormField::Type::TextSingleType, "");
-// formTypeField->setName("FORM_TYPE");
-// markingField->setName("x-isode#roominfo_marking");
-// markingForegroundColorField->setName("x-isode#roominfo_marking_fg_color");
-// markingBackgroundColorField->setName("x-isode#roominfo_marking_bg_color");
-
-// auto form = std::make_shared<Form>(Form::Type::ResultType);
-// form->addField(formTypeField);
-// form->addField(markingField);
-// form->addField(markingForegroundColorField);
-// form->addField(markingBackgroundColorField);
-
-// auto discoInfoRef = std::make_shared<DiscoInfo>();
-// discoInfoRef->addExtension(form);
-
-// auto infoResponse = IQ::createResult(self_, mucJID_, "test-id", discoInfoRef);
-// iqChannel_->onIQReceived(infoResponse);
-// ASSERT_EQ(std::string("Test|Highest Possible Security"), window_->markingValue_);
-// ASSERT_EQ(std::string("Black"), window_->markingForegroundColorValue_);
-// ASSERT_EQ(std::string("White"), window_->markingBackgroundColorValue_);
-// }
+TEST_F(MUCControllerTest, testSecurityMarkingRequestNoColorsInMarking) {
+ auto formTypeField = std::make_shared<FormField>(FormField::Type::HiddenType, "http://jabber.org/protocol/muc#roominfo");
+ auto markingField = std::make_shared<FormField>(FormField::Type::TextSingleType, "Test|Highest Possible Security");
+ auto markingForegroundColorField = std::make_shared<FormField>(FormField::Type::TextSingleType, "");
+ auto markingBackgroundColorField = std::make_shared<FormField>(FormField::Type::TextSingleType, "");
+ formTypeField->setName("FORM_TYPE");
+ markingField->setName("x-isode#roominfo_marking");
+ markingForegroundColorField->setName("x-isode#roominfo_marking_fg_color");
+ markingBackgroundColorField->setName("x-isode#roominfo_marking_bg_color");
+
+ auto form = std::make_shared<Form>(Form::Type::ResultType);
+ form->addField(formTypeField);
+ form->addField(markingField);
+ form->addField(markingForegroundColorField);
+ form->addField(markingBackgroundColorField);
+
+ auto discoInfoRef = std::make_shared<DiscoInfo>();
+ discoInfoRef->addExtension(form);
+
+ auto infoResponse = IQ::createResult(self_, mucJID_, "test-id", discoInfoRef);
+ iqChannel_->onIQReceived(infoResponse);
+ ASSERT_EQ(std::string("Test|Highest Possible Security"), window_->markingValue_);
+ ASSERT_EQ(std::string("Black"), window_->markingForegroundColorValue_);
+ ASSERT_EQ(std::string("White"), window_->markingBackgroundColorValue_);
+}
TEST_F(MUCControllerTest, testSecurityMarkingRequestEmptyMarking) {
setMUCSecurityMarking("", "", "", true);