ofz#58942 tweak so fuzzing uses the same defaults as real world writer

I have a looping document which loops in layout in the fuzzer but
not in writer but we want easy to reproduce findings rather than
load document, ctrl+a, format paragraph and set widow control to 2

Change-Id: I7739a5ebf4eaeac2152afcf8b431c42362374f2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151741
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara
2023-05-14 21:14:24 +01:00
parent d1dce8d84a
commit f5a9b83cf9
4 changed files with 12 additions and 7 deletions

View File

@@ -1793,10 +1793,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestPDFExportFODT(SvStream &rStream)
Reference<css::frame::XLoadable> xModelLoad(xModel, UNO_QUERY_THROW);
xModelLoad->initNew();
css::uno::Reference<css::frame::XController2> xController(xModel->createDefaultViewController(xTargetFrame), UNO_SET_THROW);
utl::ConnectFrameControllerModel(xTargetFrame, xController, xModel);
uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory());
uno::Reference<io::XInputStream> xStream(new utl::OSeekableInputStreamWrapper(rStream));
uno::Reference<uno::XInterface> xInterface(xMultiServiceFactory->createInstance("com.sun.star.comp.Writer.XmlFilterAdaptor"), uno::UNO_SET_THROW);
@@ -1831,6 +1827,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestPDFExportFODT(SvStream &rStream)
uno::Reference<document::XFilter> xFODTFilter(xInterface, uno::UNO_QUERY_THROW);
bool ret = xFODTFilter->filter(aArgs);
css::uno::Reference<css::frame::XController2> xController(xModel->createDefaultViewController(xTargetFrame), UNO_SET_THROW);
utl::ConnectFrameControllerModel(xTargetFrame, xController, xModel);
utl::MediaDescriptor aMediaDescriptor;
aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export");

View File

@@ -649,7 +649,8 @@ void SwDocShell::SubInitNew()
//! get lingu options without loading lingu DLL
SvtLinguOptions aLinguOpt;
if (!utl::ConfigManager::IsFuzzing())
const bool bFuzzing = utl::ConfigManager::IsFuzzing();
if (!bFuzzing)
SvtLinguConfig().GetOptions(aLinguOpt);
LanguageType nVal = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, css::i18n::ScriptType::LATIN),
@@ -684,7 +685,7 @@ void SwDocShell::SubInitNew()
m_xDoc->SetDefaultPageMode( bSquaredPageMode );
// only set Widow/Orphan defaults on a new, non-web document - not an opened one
if( GetMedium() && GetMedium()->GetOrigURL().isEmpty() )
if (GetMedium() && GetMedium()->GetOrigURL().isEmpty() && !bFuzzing)
{
m_xDoc->SetDefault( SvxWidowsItem( sal_uInt8(2), RES_PARATR_WIDOWS) );
m_xDoc->SetDefault( SvxOrphansItem( sal_uInt8(2), RES_PARATR_ORPHANS) );

View File

@@ -57,6 +57,10 @@ SwMasterUsrPref::SwMasterUsrPref(bool bWeb) :
if (utl::ConfigManager::IsFuzzing())
{
m_eHScrollMetric = m_eVScrollMetric = m_eUserMetric = FieldUnit::CM;
// match defaults
SetCore2Option(true, ViewOptCoreFlags2::CursorInProt);
SetCore2Option(false, ViewOptCoreFlags2::HiddenPara);
m_nDefTabInMm100 = 1250;
return;
}
MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();

View File

@@ -281,7 +281,7 @@ SwViewOption::SwViewOption() :
}
m_nDivisionX = m_nDivisionY = 1;
m_bSelectionInReadonly = !utl::ConfigManager::IsFuzzing() && SW_MOD()->GetAccessibilityOptions().IsSelectionInReadonly();
m_bSelectionInReadonly = utl::ConfigManager::IsFuzzing() || SW_MOD()->GetAccessibilityOptions().IsSelectionInReadonly();
m_bIdle = true;