sw/source/filter/xml/xmlimp.cxx     |    8 ++++----
 sw/source/uibase/app/docshini.cxx   |    5 +++--
 sw/source/uibase/config/usrpref.cxx |    4 ++++
 sw/source/uibase/config/viewopt.cxx |    2 +-
 4 files changed, 12 insertions(+), 7 deletions(-)

New commits:
commit f5a9b83cf9403594d9c37df8397fe01a103ae67e
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sun May 14 21:14:24 2023 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon May 15 10:59:04 2023 +0200

    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.mcnam...@collabora.com>

diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index a4e4bbc266d9..e22b40589da6 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -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");
 
diff --git a/sw/source/uibase/app/docshini.cxx 
b/sw/source/uibase/app/docshini.cxx
index 5c629ebd3d54..7407de9ef6f5 100644
--- a/sw/source/uibase/app/docshini.cxx
+++ b/sw/source/uibase/app/docshini.cxx
@@ -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) );
diff --git a/sw/source/uibase/config/usrpref.cxx 
b/sw/source/uibase/config/usrpref.cxx
index e2599f4092b3..181b863e130c 100644
--- a/sw/source/uibase/config/usrpref.cxx
+++ b/sw/source/uibase/config/usrpref.cxx
@@ -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();
diff --git a/sw/source/uibase/config/viewopt.cxx 
b/sw/source/uibase/config/viewopt.cxx
index 2f456a317e92..59a9c19dbf1d 100644
--- a/sw/source/uibase/config/viewopt.cxx
+++ b/sw/source/uibase/config/viewopt.cxx
@@ -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;
 

Reply via email to