protected function helpTest2($objTestDataArray) { $strOldValue = $objTestDataArray["OldValue"]; $newValue = $objTestDataArray["NewValue"]; $blnChanged = QHtml::SetLength($strOldValue, $newValue); $this->assertEquals($objTestDataArray["Changed"], $blnChanged); $this->assertEquals($objTestDataArray["Expected"], $strOldValue); // problem with sending a percent sign into message, so we just use default message. }
/** * Sets the Css named value to the given property. * * If blnIsLength is true, we assume the value is a unit length specifier, and so send it to the QHtml helper * function, which has the ability to perform arithmetic operations on the old value. * * Will set the value of the parent classes blnModified value if something changes. * * @param string $strName * @param string $strValue * @param bool $blnIsLength true if this is a unit specifier e.g. 2px * @return bool true if the style was actually changed (vs. it was already set that way) */ public function SetCssStyle($strName, $strValue, $blnIsLength = false) { $ret = false; if (!is_null($strValue)) { if ($blnIsLength) { if (isset($this->styles[$strName])) { $oldValue = $this->styles[$strName]; } else { $oldValue = ''; } if (QHtml::SetLength($oldValue, $strValue)) { $ret = true; $this->MarkAsModified(); $this->styles[$strName] = $oldValue; // oldValue was updated } } elseif (!isset($this->styles[$strName]) || $this->styles[$strName] !== $strValue) { $this->styles[$strName] = $strValue; $this->MarkAsModified(); $ret = true; } } else { if (isset($this->styles[$strName])) { unset($this->styles[$strName]); $this->MarkAsModified(); $ret = true; } } return $ret; }